[llvm] [LAA][NFC] Refactor deref no-wrap check; expose broken reverse-loop bounds (PR #211960)

Aleksandr Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 06:01:25 PDT 2026


================
@@ -210,6 +210,14 @@ static const SCEV *mulSCEVNoOverflow(const SCEV *A, const SCEV *B,
 
 /// Return true, if evaluating \p AR at \p MaxBTC cannot wrap, because \p AR at
 /// \p MaxBTC is guaranteed inbounds of the accessed object.
+///
+/// The accessed byte range is [LowestOffset, LowestOffset + SpanBytes), where
+///   SpanBytes    = MaxBTC * |Step| + EltSize,
+///   LowestOffset = smallest byte offset from StartPtr any iteration reaches.
+///
+/// Safety invariants (both directions):
+///   1. LowestOffset >= 0                       — no access below StartPtr.
+///   2. LowestOffset + SpanBytes <= DerefBytes  — no access past the region.
----------------
aleks-tmb wrote:

Update: with StartOffset reverted per the earlier comment, the doc block would introduce LowestOffset as a term the code no longer uses - dropped it too. Both will land together in the fix PR.

https://github.com/llvm/llvm-project/pull/211960


More information about the llvm-commits mailing list