summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-12 22:02:17 +0000
committerDan Gohman <gohman@apple.com>2009-09-12 22:02:17 +0000
commitf436e878137edbeaaf792649a68f0c9a432d1cb1 (patch)
treecdd1feb9821af80012035fe7f3ef569d8cab66f7
parent07b5c40ed8a1ee912aabd196e7c54d97bc5a5149 (diff)
downloadbcm5719-llvm-f436e878137edbeaaf792649a68f0c9a432d1cb1.tar.gz
bcm5719-llvm-f436e878137edbeaaf792649a68f0c9a432d1cb1.zip
Preserve the inbounds flag, so that the constant folder doesn't
recompute it. llvm-svn: 81634
-rw-r--r--llvm/lib/VMCore/ConstantsContext.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/ConstantsContext.h b/llvm/lib/VMCore/ConstantsContext.h
index 9785d377b26..4f55502ff94 100644
--- a/llvm/lib/VMCore/ConstantsContext.h
+++ b/llvm/lib/VMCore/ConstantsContext.h
@@ -437,8 +437,11 @@ struct ConvertConstantType<ConstantExpr, Type> {
case Instruction::GetElementPtr:
// Make everyone now use a constant of the new type...
std::vector<Value*> Idx(OldC->op_begin()+1, OldC->op_end());
- New = ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0),
- &Idx[0], Idx.size());
+ New = cast<GEPOperator>(OldC)->isInBounds() ?
+ ConstantExpr::getInBoundsGetElementPtrTy(NewTy, OldC->getOperand(0),
+ &Idx[0], Idx.size()) :
+ ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0),
+ &Idx[0], Idx.size());
break;
}
OpenPOWER on IntegriCloud