Skip to content

Commit c037350

Browse files
committed
!fixup docment why evaluating at BTC should be safe
1 parent 66825de commit c037350

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ static std::pair<const SCEV *, const SCEV *> getStartAndEndForAccess(
228228
ScStart = AR->getStart();
229229
const SCEV *BTC = PSE.getBackedgeTakenCount();
230230
if (!isa<SCEVCouldNotCompute>(BTC))
231+
// Evaluating AR at an exact BTC is safe: LAA separately checks that
232+
// accesses cannot wrap in the loop. If evaluating AR at BTC wraps, then
233+
// the loop either triggers UB when executing a memory access with a
234+
// poison pointer or the wrapping/poisoned pointer is not used.
231235
ScEnd = AR->evaluateAtIteration(BTC, *SE);
232236
else {
233237
// Evaluating AR at MaxBTC may wrap and create an expression that is less

0 commit comments

Comments
 (0)