From 33a8f3385b2b6145fe640b390fcb2579cb4fe671 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 11 Feb 2011 05:37:21 +0000 Subject: [PATCH] make ConstantExpr::replaceUsesOfWithOnConstant preserve the inbounds 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 3a5a8b06635..42c60769f5e 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -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(this)->isInBounds()); } else if (getOpcode() == Instruction::ExtractValue) { Constant *Agg = getOperand(0); if (Agg == From) Agg = To;