[PATCH] D54892: [LAA] Avoid generating RT checks for known deps preventing vectorization.
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 26 23:28:43 PST 2018
Ayal added inline comments.
================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:1620
+ // Runtime checks are only feasible if only unknown dependences prevent
+ // vectorization.
MaxSafeDepDistBytes = -1;
----------------
Right, but comment best be placed elsewhere.
================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:1661
+ // the runtime checks at compile time.
+ RuntimeChecksFeasible &= Type == Dependence::Unknown || DepSafe;
----------------
Suggest to add and call `Dependence::isUnsafeForVectorization(Type)` which will determine if there's a dependence that cannot be overcome by runtime checks. Perhaps find a better name - it implies but is not equivalent to `!isSafeForVectorization(Type)`.
Then bail-out as soon as such a dependence is encountered; there's no point in continuing to `RecordDependences`.
This could alternatively be done here as follows, by leveraging `ShouldRetryWithRuntimeCheck`, which essentially already indicates if runtime checks may be useful (but then early bail-out is necessary):
```
if (!DepSafe && Type != Dependence::Unknown) {
ShouldRetryWithRuntimeCheck = false;
RecordDependences = false;
Dependences.clear();
LLVM_DEBUG(dbgs() << "Found unsafe dependence\n");
return false;
}
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54892/new/
https://reviews.llvm.org/D54892
More information about the llvm-commits
mailing list