summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2010-12-07 08:25:19 +0000
committerJay Foad <jay.foad@gmail.com>2010-12-07 08:25:19 +0000
commit583abbc4df3d9b9e5a86a56ae581970b98dc5249 (patch)
tree62e559937dd04e2a764f7423e50f94a5641022f9 /llvm/lib/Analysis/ConstantFolding.cpp
parent10e1b56e2c9b920d5f3509abb8a6df3815200839 (diff)
downloadbcm5719-llvm-583abbc4df3d9b9e5a86a56ae581970b98dc5249.tar.gz
bcm5719-llvm-583abbc4df3d9b9e5a86a56ae581970b98dc5249.zip
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121120
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 70ee9ddfa60..68a55b6b94d 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -610,10 +610,8 @@ static Constant *SymbolicallyEvaluateGEP(Constant *const *Ops, unsigned NumOps,
APInt BasePtr(BitWidth, 0);
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
if (CE->getOpcode() == Instruction::IntToPtr)
- if (ConstantInt *Base = dyn_cast<ConstantInt>(CE->getOperand(0))) {
- BasePtr = Base->getValue();
- BasePtr.zextOrTrunc(BitWidth);
- }
+ if (ConstantInt *Base = dyn_cast<ConstantInt>(CE->getOperand(0)))
+ BasePtr = Base->getValue().zextOrTrunc(BitWidth);
if (Ptr->isNullValue() || BasePtr != 0) {
Constant *C = ConstantInt::get(Ptr->getContext(), Offset+BasePtr);
return ConstantExpr::getIntToPtr(C, ResultTy);
OpenPOWER on IntegriCloud