[llvm] [DA] Refine identical SameSD addrec dependences (PR #206425)
Ehsan Amiri via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 29 08:55:06 PDT 2026
amehsan wrote:
> where L0 and L1 are sibling loops with the same trip count and depth. The generic subscript classifier requires addrecs accepted by checkSubscript(). Depending on how SCEV derives nowrap flags, one side may not carry a signed no-wrap flag even when the corresponding induction increment has nsw. As a result, the pair is classified as NonLinear before DA can recognize that the two SameSD recurrences are identical, and LoopFusion rejects a safe fusion.
>
> Teach DA to recognize identical addrecs in SameSD loops as SIV directly when their starts are known equal, their steps match, and their start/step expressions are loop-invariant for the corresponding loop nests.
Haven't looked at the code yet, but this seems suspicious to me. If we have two identical loops (by identical I mean same iteration space and same depth in the nest) why SCEV can prove `nsw` for one and not for the other. This seems more like a problem that should be addressed in SCEV (if my understanding of the description is correct).
https://github.com/llvm/llvm-project/pull/206425
More information about the llvm-commits
mailing list