diff options
author | Philip Reames <preames@rivosinc.com> | 2023-05-01 10:38:44 -0700 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2023-05-01 10:49:51 -0700 |
commit | 30cdb2ac7e9b28dfaf25771fc7e8ff805d855f7a (patch) | |
tree | 45271a51b723719270a1a0acf9eb2ad121852cf2 /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 8f0dd4ef3ed2137d1e2554204127434fc46ee190 (diff) | |
download | llvm-30cdb2ac7e9b28dfaf25771fc7e8ff805d855f7a.zip llvm-30cdb2ac7e9b28dfaf25771fc7e8ff805d855f7a.tar.gz llvm-30cdb2ac7e9b28dfaf25771fc7e8ff805d855f7a.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index c2cdd3c..351e090 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -137,6 +137,11 @@ static cl::opt<unsigned> MaxForkedSCEVDepth( cl::desc("Maximum recursion depth when finding forked SCEVs (default = 5)"), cl::init(5)); +static cl::opt<bool> SpeculateUnitStride( + "laa-speculate-unit-stride", cl::Hidden, + cl::desc("Speculate that non-constant strides are unit in LAA"), + cl::init(true)); + bool VectorizerParams::isInterleaveForced() { return ::VectorizationInterleave.getNumOccurrences() > 0; } @@ -2694,6 +2699,11 @@ void LoopAccessInfo::collectStridedAccess(Value *MemAccess) { "versioning:"); LLVM_DEBUG(dbgs() << " Ptr: " << *Ptr << " Stride: " << *Stride << "\n"); + if (!SpeculateUnitStride) { + LLVM_DEBUG(dbgs() << " Chose not to due to -laa-speculate-unit-stride\n"); + return; + } + // Avoid adding the "Stride == 1" predicate when we know that // Stride >= Trip-Count. Such a predicate will effectively optimize a single // or zero iteration loop, as Trip-Count <= Stride == 1. |