diff options
author | Jim Grosbach <grosbach@apple.com> | 2009-11-19 02:05:44 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2009-11-19 02:05:44 +0000 |
commit | 50d67e791be569f67b39362d5862f158212b3663 (patch) | |
tree | cfcc71244d58d054e6cee1416509c627c94293e7 /llvm/lib | |
parent | dcef55b2ef9d441a51f56347bc9c815e9cdb0cf7 (diff) | |
download | bcm5719-llvm-50d67e791be569f67b39362d5862f158212b3663.tar.gz bcm5719-llvm-50d67e791be569f67b39362d5862f158212b3663.zip |
Teach IVUsers to keep things simpler and track loop-invariant strides only
for uses inside the loop. This works better with LSR. Disabled behind
-simplify-iv-users while benchmarking.
llvm-svn: 89299
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/IVUsers.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/IVUsers.cpp b/llvm/lib/Analysis/IVUsers.cpp index cf52320d1f2..efe40e4c6d1 100644 --- a/llvm/lib/Analysis/IVUsers.cpp +++ b/llvm/lib/Analysis/IVUsers.cpp @@ -24,6 +24,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/CommandLine.h" #include <algorithm> using namespace llvm; @@ -31,6 +32,10 @@ char IVUsers::ID = 0; static RegisterPass<IVUsers> X("iv-users", "Induction Variable Users", false, true); +static cl::opt<bool> +SimplifyIVUsers("simplify-iv-users", cl::Hidden, cl::init(false), + cl::desc("Restrict IV Users to loop-invariant strides")); + Pass *llvm::createIVUsersPass() { return new IVUsers(); } @@ -208,6 +213,11 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) { if (!getSCEVStartAndStride(ISE, L, UseLoop, Start, Stride, SE, DT)) return false; // Non-reducible symbolic expression, bail out. + // Keep things simple. Don't touch loop-variant strides. + if (SimplifyIVUsers && !Stride->isLoopInvariant(L) + && L->contains(I->getParent())) + return false; + SmallPtrSet<Instruction *, 4> UniqueUsers; for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) { |