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 | e35e6f097ddf754c293a725297920e547f75fd4c (patch) | |
tree | 08ee6d32eb8bd624104a9c6bed6cf325a927ab2a /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | c76493a65da5e80ad7bfbdb2f715f3fbffca6aa9 (diff) | |
download | bcm5719-llvm-e35e6f097ddf754c293a725297920e547f75fd4c.tar.gz bcm5719-llvm-e35e6f097ddf754c293a725297920e547f75fd4c.zip |
Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.
llvm-svn: 90099
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 8d60907f8cb..96f738edad4 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/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 { |