diff options
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 2b7ca6b..1c25bec 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -40,6 +40,7 @@ #include "llvm/Pass.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" +#include "llvm/Operator.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Target/TargetData.h" @@ -650,17 +651,6 @@ static User *dyn_castGetElementPtr(Value *V) { return false; } -/// getOpcode - If this is an Instruction or a ConstantExpr, return the -/// opcode value. Otherwise return UserOp1. -static unsigned getOpcode(const Value *V) { - if (const Instruction *I = dyn_cast<Instruction>(V)) - return I->getOpcode(); - if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) - return CE->getOpcode(); - // Use UserOp1 to mean there's no opcode. - return Instruction::UserOp1; -} - /// AddOne - Add one to a ConstantInt static Constant *AddOne(Constant *C, LLVMContext *Context) { return Context->getConstantExprAdd(C, @@ -8710,7 +8700,7 @@ Instruction *InstCombiner::visitSExt(SExtInst &CI) { // See if the value being truncated is already sign extended. If so, just // eliminate the trunc/sext pair. - if (getOpcode(Src) == Instruction::Trunc) { + if (Operator::getOpcode(Src) == Instruction::Trunc) { Value *Op = cast<User>(Src)->getOperand(0); unsigned OpBits = Op->getType()->getScalarSizeInBits(); unsigned MidBits = Src->getType()->getScalarSizeInBits(); @@ -9625,7 +9615,7 @@ static unsigned EnforceKnownAlignment(Value *V, User *U = dyn_cast<User>(V); if (!U) return Align; - switch (getOpcode(U)) { + switch (Operator::getOpcode(U)) { default: break; case Instruction::BitCast: return EnforceKnownAlignment(U->getOperand(0), Align, PrefAlign); |