[llvm] 19c9a1c - [LAA] Include IndirectUnsafe in ::isPossiblyBackward.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 14:09:28 PDT 2024


Author: Florian Hahn
Date: 2024-07-18T22:09:05+01:00
New Revision: 19c9a1c2fd2c3849439bca2ba5084dada4d1f47f

URL: https://github.com/llvm/llvm-project/commit/19c9a1c2fd2c3849439bca2ba5084dada4d1f47f
DIFF: https://github.com/llvm/llvm-project/commit/19c9a1c2fd2c3849439bca2ba5084dada4d1f47f.diff

LOG: [LAA] Include IndirectUnsafe in ::isPossiblyBackward.

Similarly to Unknown, IndirectUnsafe should also be considered possibly
backward, as it may be a backwards dependency e.g. via loading
different base pointers.

This also brings isPossiblyBackward in line with
Dependence::isSafeForVectorization. At the moment this can't be tested,
as it is not possible to write a test with an AddRec that is based on a
loop varying value. But this may change in the future and may cause
mis-compiles in the future.

Added: 
    

Modified: 
    llvm/lib/Analysis/LoopAccessAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 91994f33f3046..84214c47a10e1 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1730,7 +1730,7 @@ bool MemoryDepChecker::Dependence::isBackward() const {
 }
 
 bool MemoryDepChecker::Dependence::isPossiblyBackward() const {
-  return isBackward() || Type == Unknown;
+  return isBackward() || Type == Unknown || Type == IndirectUnsafe;
 }
 
 bool MemoryDepChecker::Dependence::isForward() const {


        


More information about the llvm-commits mailing list