diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 6b7f20a73cf..52b861da156 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2580,7 +2580,10 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {        // obvious.        Value *Op = GEP.getOperand(i);        if (Op->getType()->getPrimitiveSize() > TD->getPointerSize()) -        if (!isa<Constant>(Op)) { +        if (Constant *C = dyn_cast<Constant>(Op)) { +          GEP.setOperand(i, ConstantExpr::getCast(C, TD->getIntPtrType())); +          MadeChange = true; +        } else {            Op = InsertNewInstBefore(new CastInst(Op, TD->getIntPtrType(),                                                  Op->getName()), GEP);            GEP.setOperand(i, Op); | 

