summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-03-26 03:01:27 +0000
committerDale Johannesen <dalej@apple.com>2007-03-26 03:01:27 +0000
commite5866e7b897712580bae1fc3681065b7f5b544ca (patch)
tree267a1f27e6b799ae6f911bb5ec441c8f6cddd880 /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent7a86dc5c27dd35f46e8de83fdb607b2d40d33038 (diff)
downloadbcm5719-llvm-e5866e7b897712580bae1fc3681065b7f5b544ca.tar.gz
bcm5719-llvm-e5866e7b897712580bae1fc3681065b7f5b544ca.zip
Look through bitcast when finding IVs. (Chris' patch really.)
llvm-svn: 35347
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 4ace17f7a4a..f48f828cb6f 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud