[llvm] [LAA] Add initial support for non-power-of-2 store-load forwarding distance (PR #137873)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 05:08:53 PDT 2025


================
@@ -76,22 +92,38 @@ exit:
 }
 
 define void @test_may_clobber2(ptr %p) {
-; CHECK-LABEL: 'test_may_clobber2'
-; CHECK-NEXT:    loop:
-; CHECK-NEXT:      Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
-; CHECK-NEXT:  Backward loop carried data dependence that prevents store-to-load forwarding.
-; CHECK-NEXT:      Dependences:
-; CHECK-NEXT:        BackwardVectorizableButPreventsForwarding:
-; CHECK-NEXT:            %v = load i64, ptr %a1, align 32 ->
-; CHECK-NEXT:            store i64 %v, ptr %a2, align 32
-; CHECK-EMPTY:
-; CHECK-NEXT:      Run-time memory checks:
-; CHECK-NEXT:      Grouped accesses:
-; CHECK-EMPTY:
-; CHECK-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; CHECK-NEXT:      SCEV assumptions:
-; CHECK-EMPTY:
-; CHECK-NEXT:      Expressions re-written:
+; RISCV64-LABEL: 'test_may_clobber2'
+; RISCV64-NEXT:    loop:
+; RISCV64-NEXT:      Memory dependences are safe with a maximum safe vector width of 576 bits, with a maximum safe store-load forward width of 192 bits
----------------
fhahn wrote:

Not sure if this matches the behavior with power-of-2 I think.

If max safe distance non-pow-2 is 192, then shouldn't the max safe distance with pow-2 be 128?

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


More information about the llvm-commits mailing list