[llvm] [DA] add testcase (PR #116631)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 02:00:41 PST 2024


================
@@ -0,0 +1,74 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
+
+; DependenceAnalysis used to run into a heap buffer overflow on this testcase.
+; See https://github.com/llvm/llvm-project/issues/31196 for details.
+
+define void @barney(ptr nocapture %arg, i32 %arg1) {
+; CHECK-LABEL: 'barney'
+; CHECK-NEXT:  Src: store i32 7, ptr %getelementptr, align 4 --> Dst: store i32 7, ptr %getelementptr, align 4
+; CHECK-NEXT:    da analyze - output [* * * *]!
+;
+bb:
+  %icmp = icmp sgt i32 %arg1, 0
+  br i1 %icmp, label %bb2, label %bb31
+
+bb2:                                              ; preds = %bb28, %bb
+  %phi = phi i32 [ %add29, %bb28 ], [ 0, %bb ]
+  br label %bb3
+
+bb3:                                              ; preds = %bb25, %bb2
+  %phi4 = phi i32 [ %add26, %bb25 ], [ 0, %bb2 ]
+  br label %bb5
+
+bb5:                                              ; preds = %bb22, %bb3
+  %phi6 = phi i32 [ -1, %bb3 ], [ %add23, %bb22 ]
+  %add7 = add nsw i32 %phi6, %phi4
+  br label %bb8
+
+bb8:                                              ; preds = %bb19, %bb5
+  %phi9 = phi i32 [ -1, %bb5 ], [ %add20, %bb19 ]
+  %add10 = add nsw i32 %phi9, %phi
+  br label %bb11
+
+bb11:                                             ; preds = %bb11, %bb8
----------------
fhahn wrote:

Would be great to have more descriptive names, so it is easier to read the test and see the loop structure (e.g. `loop.1.header` for loop headers, `%iv` for inductions and so on

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


More information about the llvm-commits mailing list