-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[DA] add testcase #116631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DA] add testcase #116631
Conversation
@llvm/pr-subscribers-testing-tools @llvm/pr-subscribers-llvm-analysis Author: Sebastian Pop (sebpop) ChangesMake sure the testcase for this bug continues to work: #31196 Full diff: https://github.com/llvm/llvm-project/pull/116631.diff 1 Files Affected:
diff --git a/llvm/test/Analysis/DependenceAnalysis/PR31848.ll b/llvm/test/Analysis/DependenceAnalysis/PR31848.ll
new file mode 100644
index 00000000000000..02e7c54f9e941d
--- /dev/null
+++ b/llvm/test/Analysis/DependenceAnalysis/PR31848.ll
@@ -0,0 +1,67 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
+
+define void @foo(i32* nocapture %A, i32 %n) {
+entry:
+ %n.cmp = icmp sgt i32 %n, 0
+ br i1 %n.cmp, label %for.j.header, label %exit
+
+for.j.header:
+ %j= phi i32 [ %j.inc, %for.j.latch ], [ 0, %entry ]
+ br label %for.i.header
+
+for.i.header:
+ %i = phi i32 [ %i.inc, %for.i.latch ], [ 0, %for.j.header ]
+ br label %for.di.header
+
+for.di.header:
+ %di = phi i32 [ -1, %for.i.header ], [ %di.inc, %for.di.latch ]
+ %di.add = add nsw i32 %di, %i
+ br label %for.dj.header
+
+for.dj.header:
+ %dj = phi i32 [ -1, %for.di.header ], [ %dj.inc, %body ]
+ %dj.add = add nsw i32 %dj, %j
+ br label %while.x
+
+while.x:
+ %x = phi i32 [ %di.add, %for.dj.header ], [ %x.inc, %while.x ]
+ %x.cmp = icmp slt i32 %x, 0
+ %x.inc = add nsw i32 %x, %n
+ br i1 %x.cmp, label %while.x, label %while.y
+
+while.y:
+ %y = phi i32 [ %y.inc, %while.y ], [ %dj.add, %while.x ]
+ %y.cmp = icmp slt i32 %y, 0
+ %y.inc = add nsw i32 %y, %n
+ br i1 %y.cmp, label %while.y, label %body
+
+body:
+ %mul = mul nsw i32 %y, %n
+ %add = add nsw i32 %mul, %x
+ %idxprom = sext i32 %add to i64
+ %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
+; CHECK: da analyze - output [* * * *]
+ store i32 7, i32* %arrayidx, align 4
+ %dj.inc = add nsw i32 %dj, 1
+ %dj.exitcond = icmp eq i32 %dj.inc, 2
+ br i1 %dj.exitcond, label %for.di.latch, label %for.dj.header
+
+for.di.latch:
+ %di.inc = add nsw i32 %di, 1
+ %di.exitcond = icmp eq i32 %di.inc, 2
+ br i1 %di.exitcond, label %for.i.latch, label %for.di.header
+
+for.i.latch:
+ %i.inc = add nuw nsw i32 %i, 1
+ %i.exitcond = icmp eq i32 %i.inc, %n
+ br i1 %i.exitcond, label %for.j.latch, label %for.i.header
+
+for.j.latch:
+ %j.inc = add nuw nsw i32 %j, 1
+ %j.exitcond = icmp eq i32 %j.inc, %n
+ br i1 %j.exitcond, label %exit, label %for.j.header
+
+exit:
+ ret void
+}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a test case is always a good thing, so LGTM.
One nit that can be addressed before merging this, some explanations/comments why we expect output [* * * *]
would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a side note, it would be nice to add support for DA to update_analyze_test_checks.py, so we can use generated check lines.
; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \ | ||
; RUN: | FileCheck %s | ||
|
||
define void @foo(i32* nocapture %A, i32 %n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define void @foo(i32* nocapture %A, i32 %n) { | |
define void @foo(ptr nocapture %A, i32 %n) { |
etc. Convert to opaque pointers please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, it would be nice to add a comment to the test to explain what it's guarding against, as it's not super obvious here (looking at the issue, it's a crash).
Make sure the testcase for this bug continues to work: llvm#31196
%add10 = add nsw i32 %phi9, %phi | ||
br label %bb11 | ||
|
||
bb11: ; preds = %bb11, %bb8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just used opt -passes=metarenamer -S a.ll
to prepare the testcase with more standard names. I guess we could improve the metarenamer to produce more readable BB and var names.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/30/builds/14883 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/12690 Here is the relevant piece of the build log for the reference
|
Make sure the testcase for this bug continues to work: #31196