diff options
author | Dan Gohman <gohman@apple.com> | 2010-02-14 02:45:21 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-02-14 02:45:21 +0000 |
commit | 2763dfdc701964a01c4a0386fadd1c4e92be9021 (patch) | |
tree | 845ec67e6c366980c29b73d72630098b47c4b3da | |
parent | ca1c816f2538de02f814c7269121004cca1e2552 (diff) | |
download | external_llvm-2763dfdc701964a01c4a0386fadd1c4e92be9021.zip external_llvm-2763dfdc701964a01c4a0386fadd1c4e92be9021.tar.gz external_llvm-2763dfdc701964a01c4a0386fadd1c4e92be9021.tar.bz2 |
Don't attempt aggressive post-inc uses if TargetLowering is not available,
because profitability can't be sufficiently approximated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96148 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index d3c92e7..0c65e33 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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'); |