[llvm] 88e72c4 - [LAA] Add test where GEPs may wrap.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 12:50:17 PST 2025


Author: Florian Hahn
Date: 2025-02-17T21:49:40+01:00
New Revision: 88e72c401b5bbedb3461039935e940eccff53f02

URL: https://github.com/llvm/llvm-project/commit/88e72c401b5bbedb3461039935e940eccff53f02
DIFF: https://github.com/llvm/llvm-project/commit/88e72c401b5bbedb3461039935e940eccff53f02.diff

LOG: [LAA] Add test where GEPs may wrap.

Added: 
    llvm/test/Analysis/LoopAccessAnalysis/runtime-checks-may-wrap.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/LoopAccessAnalysis/runtime-checks-may-wrap.ll b/llvm/test/Analysis/LoopAccessAnalysis/runtime-checks-may-wrap.ll
new file mode 100644
index 0000000000000..b27937862b261
--- /dev/null
+++ b/llvm/test/Analysis/LoopAccessAnalysis/runtime-checks-may-wrap.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
+
+target datalayout = "p:16:16"
+
+define void @geps_may_wrap(ptr %a, ptr %b, i64 %N) {
+; CHECK-LABEL: 'geps_may_wrap'
+; CHECK-NEXT:    loop:
+; CHECK-NEXT:      Memory dependences are safe with run-time checks
+; CHECK-NEXT:      Dependences:
+; CHECK-NEXT:      Run-time memory checks:
+; CHECK-NEXT:      Check 0:
+; CHECK-NEXT:        Comparing group ([[GRP1:0x[0-9a-f]+]]):
+; CHECK-NEXT:          %gep.iv = getelementptr i32, ptr %a, i64 %iv
+; CHECK-NEXT:        Against group ([[GRP2:0x[0-9a-f]+]]):
+; CHECK-NEXT:        ptr %b
+; CHECK-NEXT:      Grouped accesses:
+; CHECK-NEXT:        Group [[GRP1]]:
+; CHECK-NEXT:          (Low: %a High: (16 + (12 * (trunc i128 ((zext i64 %N to i128) /u 3) to i16)) + %a))
+; CHECK-NEXT:            Member: {%a,+,12}<%loop>
+; CHECK-NEXT:        Group [[GRP2]]:
+; CHECK-NEXT:          (Low: %b High: (4 + %b))
+; CHECK-NEXT:            Member: %b
+; CHECK-EMPTY:
+; CHECK-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; CHECK-NEXT:      SCEV assumptions:
+; CHECK-NEXT:      {0,+,3}<%loop> Added Flags: <nusw>
+; CHECK-EMPTY:
+; CHECK-NEXT:      Expressions re-written:
+;
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %gep.iv = getelementptr i32, ptr %a, i64 %iv
+  store i32 0, ptr %gep.iv, align 1
+  store i32 0, ptr %b, align 1
+  %iv.next = add i64 %iv, 3
+  %.not = icmp ult i64 %N, %iv
+  br i1 %.not, label %exit, label %loop
+
+exit:
+  ret void
+}


        


More information about the llvm-commits mailing list