diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-11-29 21:40:55 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-11-29 21:40:55 +0000 |
commit | fac554a1317bf32daf5698740670025ae14e6bcc (patch) | |
tree | ace4cef5a84f4a0a11f19dee5314a65156ed6c89 /lib/Analysis/ConstantFolding.cpp | |
parent | e6f329476c6598db1b45c3d573eac9cf65179831 (diff) |
Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | lib/Analysis/ConstantFolding.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 8d60907f8c..96f738edad 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -564,6 +564,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant *const *Ops, unsigned NumOps, // we eliminate over-indexing of the notional static type array bounds. // This makes it easy to determine if the getelementptr is "inbounds". // Also, this helps GlobalOpt do SROA on GlobalVariables. + Ptr = cast<Constant>(Ptr->stripPointerCasts()); const Type *Ty = Ptr->getType(); SmallVector<Constant*, 32> NewIdxs; do { |