Skip to content

Commit 484417a

Browse files
committed
[Loads] Keep using constant max BTCs for loops w/o computable BTCs.
Follow-up to cad62df to preserve the existing behavior for early-exit loops, to fix vec.stats.ll test failure.
1 parent a6e1700 commit 484417a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Analysis/Loads.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ bool llvm::isDereferenceableAndAlignedInLoop(
333333
if (isa<SCEVCouldNotCompute>(MaxBECount))
334334
return false;
335335

336+
if (isa<SCEVCouldNotCompute>(BECount)) {
337+
// TODO: Support symbolic max backedge taken counts for loops without
338+
// computable backedge taken counts.
339+
MaxBECount =
340+
Predicates
341+
? SE.getPredicatedConstantMaxBackedgeTakenCount(L, *Predicates)
342+
: SE.getConstantMaxBackedgeTakenCount(L);
343+
}
336344
const auto &[AccessStart, AccessEnd] = getStartAndEndForAccess(
337345
L, PtrScev, LI->getType(), BECount, MaxBECount, &SE, nullptr);
338346
if (isa<SCEVCouldNotCompute>(AccessStart) ||

0 commit comments

Comments
 (0)