Preserve the InBounds flag when evaluating a getelementptr instruction
into a getelementptr ConstantExpr. llvm-svn: 81162
This commit is contained in:
parent
f7f3fb1133
commit
19244eaa4a
|
@ -2227,7 +2227,8 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
|
|||
for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end();
|
||||
i != e; ++i)
|
||||
GEPOps.push_back(getVal(Values, *i));
|
||||
InstResult =
|
||||
InstResult = cast<GEPOperator>(GEP)->isInBounds() ?
|
||||
ConstantExpr::getInBoundsGetElementPtr(P, &GEPOps[0], GEPOps.size()) :
|
||||
ConstantExpr::getGetElementPtr(P, &GEPOps[0], GEPOps.size());
|
||||
} else if (LoadInst *LI = dyn_cast<LoadInst>(CurInst)) {
|
||||
if (LI->isVolatile()) return false; // no volatile accesses.
|
||||
|
|
Loading…
Reference in New Issue