diff options
author | Dale Johannesen <dalej@apple.com> | 2007-03-26 03:01:27 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-03-26 03:01:27 +0000 |
commit | da91f49751b9b55a41d315b9fbdbb14614587b03 (patch) | |
tree | a539d6395f908224c4246c5f0567c7412eac82f3 /lib/Transforms | |
parent | 5eeb4b5bf6c3380fc27f38ab5a59c19550869ba0 (diff) | |
download | external_llvm-da91f49751b9b55a41d315b9fbdbb14614587b03.zip external_llvm-da91f49751b9b55a41d315b9fbdbb14614587b03.tar.gz external_llvm-da91f49751b9b55a41d315b9fbdbb14614587b03.tar.bz2 |
Look through bitcast when finding IVs. (Chris' patch really.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4ace17f..f48f828 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -235,6 +235,16 @@ DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts) { /// GetExpressionSCEV - Compute and return the SCEV for the specified /// instruction. SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp, Loop *L) { + // Pointer to pointer bitcast instructions return the same value as their + // operand. + if (BitCastInst *BCI = dyn_cast<BitCastInst>(Exp)) { + if (SE->hasSCEV(BCI) || !isa<Instruction>(BCI->getOperand(0))) + return SE->getSCEV(BCI); + SCEVHandle R = GetExpressionSCEV(cast<Instruction>(BCI->getOperand(0)), L); + SE->setSCEV(BCI, R); + return R; + } + // Scalar Evolutions doesn't know how to compute SCEV's for GEP instructions. // If this is a GEP that SE doesn't know about, compute it now and insert it. // If this is not a GEP, or if we have already done this computation, just let |