From: Dan Gohman Date: Sat, 12 Sep 2009 22:02:17 +0000 (+0000) Subject: Preserve the inbounds flag, so that the constant folder doesn't X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4acac62e8d0d90aac3368ae43bab7595c444fac0;p=oota-llvm.git Preserve the inbounds flag, so that the constant folder doesn't recompute it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81634 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/ConstantsContext.h b/lib/VMCore/ConstantsContext.h index 9785d377b26..4f55502ff94 100644 --- a/lib/VMCore/ConstantsContext.h +++ b/lib/VMCore/ConstantsContext.h @@ -437,8 +437,11 @@ struct ConvertConstantType { case Instruction::GetElementPtr: // Make everyone now use a constant of the new type... std::vector Idx(OldC->op_begin()+1, OldC->op_end()); - New = ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0), - &Idx[0], Idx.size()); + New = cast(OldC)->isInBounds() ? + ConstantExpr::getInBoundsGetElementPtrTy(NewTy, OldC->getOperand(0), + &Idx[0], Idx.size()) : + ConstantExpr::getGetElementPtrTy(NewTy, OldC->getOperand(0), + &Idx[0], Idx.size()); break; }