diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-21 18:27:26 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-21 18:27:26 +0000 |
commit | c0b967dfb4aa2420613a65322d8d76c042637d61 (patch) | |
tree | 16ead7fe3a7ec5d35384e84d3407d83c2f768ed6 /llvm/lib/Analysis | |
parent | dff54eff8e4bc3cc2b56f03f2fe136823264521c (diff) | |
download | bcm5719-llvm-c0b967dfb4aa2420613a65322d8d76c042637d61.tar.gz bcm5719-llvm-c0b967dfb4aa2420613a65322d8d76c042637d61.zip |
Don't assume that the operand of an inttoptr is an pointer-sized integer.
llvm-svn: 79651
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 19ea6033752..5dcb021acf6 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -138,8 +138,10 @@ static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps, // otherwise we can't. if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr)) if (CE->getOpcode() == Instruction::IntToPtr) - if (ConstantInt *Base = dyn_cast<ConstantInt>(CE->getOperand(0))) + if (ConstantInt *Base = dyn_cast<ConstantInt>(CE->getOperand(0))) { BasePtr = Base->getValue(); + BasePtr.zextOrTrunc(BitWidth); + } if (BasePtr == 0) BaseIsInt = false; |