[llvm] 484417a - [Loads] Keep using constant max BTCs for loops w/o computable BTCs.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 00:45:49 PDT 2025


Author: Florian Hahn
Date: 2025-07-14T08:45:23+01:00
New Revision: 484417abe1fdf4ac1e027ffd10cc65b0e74e59b1

URL: https://github.com/llvm/llvm-project/commit/484417abe1fdf4ac1e027ffd10cc65b0e74e59b1
DIFF: https://github.com/llvm/llvm-project/commit/484417abe1fdf4ac1e027ffd10cc65b0e74e59b1.diff

LOG: [Loads] Keep using constant max BTCs for loops w/o computable BTCs.

Follow-up to cad62df49a to preserve the existing behavior for early-exit
loops, to fix vec.stats.ll test failure.

Added: 
    

Modified: 
    llvm/lib/Analysis/Loads.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 89e42ff4e8029..393f2648de3c9 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -333,6 +333,14 @@ bool llvm::isDereferenceableAndAlignedInLoop(
   if (isa<SCEVCouldNotCompute>(MaxBECount))
     return false;
 
+  if (isa<SCEVCouldNotCompute>(BECount)) {
+    // TODO: Support symbolic max backedge taken counts for loops without
+    // computable backedge taken counts.
+    MaxBECount =
+        Predicates
+            ? SE.getPredicatedConstantMaxBackedgeTakenCount(L, *Predicates)
+            : SE.getConstantMaxBackedgeTakenCount(L);
+  }
   const auto &[AccessStart, AccessEnd] = getStartAndEndForAccess(
       L, PtrScev, LI->getType(), BECount, MaxBECount, &SE, nullptr);
   if (isa<SCEVCouldNotCompute>(AccessStart) ||


        


More information about the llvm-commits mailing list