[llvm] [DA] Add initial support for monotonicity check (PR #162280)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 12:57:01 PDT 2025


nikic wrote:

@amehsan The size of allocated objects is already limited to at most half the address space, see https://llvm.org/docs/LangRef.html#allocated-objects.

The kind of reasoning you do is indeed valid (*), and something that LAA already does, see: https://github.com/llvm/llvm-project/blob/ef87da06326e879ba74d0935673a8c18d0e69825/llvm/lib/Analysis/LoopAccessAnalysis.cpp#L1026-L1033

However, this reasoning critically depends on the assumption that the GEP feeds into a memory access that will be executed. The way this is handled in LAA is not entirely correct, see the fix in https://github.com/llvm/llvm-project/pull/161445. We can't use this reasoning in conditionally executed code.

(*) It may not be valid in multi-provenance models -- but that's mostly an argument against having a multi-provenance model...

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


More information about the llvm-commits mailing list