diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-09 19:12:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-09 19:12:34 +0000 |
commit | 42ec4eb351f41bc3316295b4319cad1508e16d69 (patch) | |
tree | 07a12b9bdbd49159eea346aea36c96dff5191b8e /llvm/lib/Transforms | |
parent | dfea9989efd493ca75f0fe31425384ed1e3bfacb (diff) | |
download | bcm5719-llvm-42ec4eb351f41bc3316295b4319cad1508e16d69.tar.gz bcm5719-llvm-42ec4eb351f41bc3316295b4319cad1508e16d69.zip |
When looking for loop-invariant users, look through no-op instructions,
so that an unfortunately placed bitcast doesn't pin a value in a
register.
llvm-svn: 100883
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index ee966edc03b..04f388477bc 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1947,9 +1947,17 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() { continue; // Ignore uses which are part of other SCEV expressions, to avoid // analyzing them multiple times. - if (SE.isSCEVable(UserInst->getType()) && - !isa<SCEVUnknown>(SE.getSCEV(const_cast<Instruction *>(UserInst)))) - continue; + if (SE.isSCEVable(UserInst->getType())) { + const SCEV *UserS = SE.getSCEV(const_cast<Instruction *>(UserInst)); + // If the user is a no-op, look through to its uses. + if (!isa<SCEVUnknown>(UserS)) + continue; + if (UserS == U) { + Worklist.push_back( + SE.getUnknown(const_cast<Instruction *>(UserInst))); + continue; + } + } // Ignore icmp instructions which are already being analyzed. if (const ICmpInst *ICI = dyn_cast<ICmpInst>(UserInst)) { unsigned OtherIdx = !UI.getOperandNo(); |