[llvm-commits] [llvm] r96148 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Dan Gohman
gohman at apple.com
Sat Feb 13 18:45:21 PST 2010
Author: djg
Date: Sat Feb 13 20:45:21 2010
New Revision: 96148
URL: http://llvm.org/viewvc/llvm-project?rev=96148&view=rev
Log:
Don't attempt aggressive post-inc uses if TargetLowering is not available,
because profitability can't be sufficiently approximated.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=96148&r1=96147&r2=96148&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sat Feb 13 20:45:21 2010
@@ -1503,7 +1503,11 @@
// 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 @@
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');
More information about the llvm-commits
mailing list