mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-13 16:03:58 +00:00
Preserve the InBounds flag when evaluating a getelementptr instruction
into a getelementptr ConstantExpr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fd54a898be
commit
4a7e6b7a15
@ -2227,8 +2227,9 @@ 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 =
|
||||
ConstantExpr::getGetElementPtr(P, &GEPOps[0], GEPOps.size());
|
||||
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.
|
||||
InstResult = ComputeLoadResult(getVal(Values, LI->getOperand(0)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user