make ConstantExpr::replaceUsesOfWithOnConstant preserve the inbounds
authorChris Lattner <sabre@nondot.org>
Fri, 11 Feb 2011 05:37:21 +0000 (05:37 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 11 Feb 2011 05:37:21 +0000 (05:37 +0000)
flag.  Noticed by Jin Gu Kang!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125366 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp

index 3a5a8b06635ee23f66f29484869fc46f9a6bf9b5..42c60769f5eb4032e7b46c51ee706aaa1274dac7 100644 (file)
@@ -2054,7 +2054,8 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
       Indices.push_back(Val);
     }
     Replacement = ConstantExpr::getGetElementPtr(Pointer,
-                                                 &Indices[0], Indices.size());
+                                                 &Indices[0], Indices.size(),
+                                         cast<GEPOperator>(this)->isInBounds());
   } else if (getOpcode() == Instruction::ExtractValue) {
     Constant *Agg = getOperand(0);
     if (Agg == From) Agg = To;