mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
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
This commit is contained in:
parent
f5f954f888
commit
3a0e57424e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user