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 | 7178010a168a378df5d9be95956093a3e5f963fd (patch) | |
tree | 4e11a20b407102ddf2b886bbcedf18a26b865229 /lib/Analysis/ConstantFolding.cpp | |
parent | 636e258a53b20695e841a70774f42c052c4c0bfd (diff) |
Don't assume that the operand of an inttoptr is an pointer-sized integer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79651 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | lib/Analysis/ConstantFolding.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 19ea603375..5dcb021acf 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/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; |