summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-14 02:45:21 +0000
committerDan Gohman <gohman@apple.com>2010-02-14 02:45:21 +0000
commitcb76a806f04c0b64e82bf34c869cc9b246c9315a (patch)
tree3e81b1e9399a5d87abfc68f5f2fe1cf300d569e2 /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent184b3383bf2ade55a49c797d49b920102dca62ea (diff)
downloadbcm5719-llvm-cb76a806f04c0b64e82bf34c869cc9b246c9315a.tar.gz
bcm5719-llvm-cb76a806f04c0b64e82bf34c869cc9b246c9315a.zip
Don't attempt aggressive post-inc uses if TargetLowering is not available,
because profitability can't be sufficiently approximated. llvm-svn: 96148
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index d3c92e77a09..0c65e33c61d 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1503,7 +1503,11 @@ LSRInstance::OptimizeLoopTermCond() {
// Conservatively avoid trying to use the post-inc value in non-latch
// exits if there may be pre-inc users in intervening blocks.
- if (LatchBlock != ExitingBlock)
+ if (LatchBlock != ExitingBlock) {
+ // Without target lowering, we won't be able to query about valid reuse.
+ if (!TLI)
+ continue;
+
for (IVUsers::const_iterator UI = IU.begin(), E = IU.end(); UI != E; ++UI)
// Test if the use is reachable from the exiting block. This dominator
// query is a conservative approximation of reachability.
@@ -1535,13 +1539,14 @@ LSRInstance::OptimizeLoopTermCond() {
const Type *AccessTy = getAccessType(UI->getUser());
TargetLowering::AddrMode AM;
AM.Scale = D->getValue()->getSExtValue();
- if (TLI && TLI->isLegalAddressingMode(AM, AccessTy))
+ if (TLI->isLegalAddressingMode(AM, AccessTy))
goto decline_post_inc;
AM.Scale = -AM.Scale;
- if (TLI && TLI->isLegalAddressingMode(AM, AccessTy))
+ if (TLI->isLegalAddressingMode(AM, AccessTy))
goto decline_post_inc;
}
}
+ }
DEBUG(dbgs() << " Change loop exiting icmp to use postinc iv: "
<< *Cond << '\n');
OpenPOWER on IntegriCloud