Skip to content

Commit 30cdb2a

Browse files
committed
[LAA] Add command line flag to disable unit stride speculation
This is purely so that we can expose and work through downstream codegen issues. My intention is to see if we can get this disabled by default, but that requires fixing a bunch of downstream issues first.
1 parent 8f0dd4e commit 30cdb2a

File tree

2 files changed

+415
-269
lines changed

2 files changed

+415
-269
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ static cl::opt<unsigned> MaxForkedSCEVDepth(
137137
cl::desc("Maximum recursion depth when finding forked SCEVs (default = 5)"),
138138
cl::init(5));
139139

140+
static cl::opt<bool> SpeculateUnitStride(
141+
"laa-speculate-unit-stride", cl::Hidden,
142+
cl::desc("Speculate that non-constant strides are unit in LAA"),
143+
cl::init(true));
144+
140145
bool VectorizerParams::isInterleaveForced() {
141146
return ::VectorizationInterleave.getNumOccurrences() > 0;
142147
}
@@ -2694,6 +2699,11 @@ void LoopAccessInfo::collectStridedAccess(Value *MemAccess) {
26942699
"versioning:");
26952700
LLVM_DEBUG(dbgs() << " Ptr: " << *Ptr << " Stride: " << *Stride << "\n");
26962701

2702+
if (!SpeculateUnitStride) {
2703+
LLVM_DEBUG(dbgs() << " Chose not to due to -laa-speculate-unit-stride\n");
2704+
return;
2705+
}
2706+
26972707
// Avoid adding the "Stride == 1" predicate when we know that
26982708
// Stride >= Trip-Count. Such a predicate will effectively optimize a single
26992709
// or zero iteration loop, as Trip-Count <= Stride == 1.

0 commit comments

Comments
 (0)