-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[LoopInterchange] Bail out when finding a dependency with all * elements
#149049
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
Changes from all commits
24a7257
144582a
5502f32
c51edff
0e4e759
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ; RUN: opt < %s -passes=loop-interchange -pass-remarks-output=%t \ | ||
| ; RUN: -disable-output | ||
| ; RUN: FileCheck -input-file %t %s | ||
|
|
||
| ; Check that loop interchange bails out early when finding a direction vector | ||
| ; with all '*' elements. | ||
| ; | ||
| ; for (int i = 0; i < 4; i++) | ||
| ; for (int j = 0; j < 4; j++) | ||
| ; A[i & val][j & val] = 0; | ||
|
|
||
| ; CHECK: --- !Missed | ||
| ; CHECK-NEXT: Pass: loop-interchange | ||
| ; CHECK-NEXT: Name: Dependence | ||
| ; CHECK-NEXT: Function: f | ||
| ; CHECK-NEXT: Args: | ||
| ; CHECK-NEXT: - String: All loops have dependencies in all directions. | ||
| ; CHECK-NEXT: ... | ||
| define void @f(ptr %A, i64 %val) { | ||
| entry: | ||
| br label %for.i.header | ||
|
|
||
| for.i.header: | ||
| %i = phi i64 [ 0, %entry ], [ %i.next, %for.i.latch ] | ||
| br label %for.j | ||
|
|
||
| for.j: | ||
| %j = phi i64 [ 0, %for.i.header ], [ %j.next, %for.j ] | ||
| %subscript.0 = and i64 %i, %val | ||
| %subscript.1 = and i64 %j, %val | ||
| %idx = getelementptr inbounds [4 x i8], ptr %A, i64 %subscript.0, i64 %subscript.1 | ||
| store i8 0, ptr %idx | ||
| %j.next = add nuw nsw i64 %j, 1 | ||
| %exit.j = icmp eq i64 %j.next, 4 | ||
| br i1 %exit.j, label %for.i.latch, label %for.j | ||
|
|
||
| for.i.latch: | ||
| %i.next = add nuw nsw i64 %i, 1 | ||
| %exit.i = icmp eq i64 %i.next, 4 | ||
| br i1 %exit.i, label %exit, label %for.i.header | ||
|
|
||
| exit: | ||
| ret void | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| ; REQUIRES: asserts | ||
| ; RUN: opt < %s -passes=loop-interchange -verify-dom-info -verify-loop-info \ | ||
| ; RUN: -disable-output -debug 2>&1 | FileCheck %s | ||
| ; RUN: opt < %s -passes=loop-interchange -pass-remarks-output=%t \ | ||
| ; RUN: -disable-output | ||
| ; RUN: FileCheck -input-file %t %s | ||
|
|
||
| ;; In the following case, p0 and p1 may alias, so the direction vector must be [* *]. | ||
| ;; | ||
|
|
@@ -10,9 +10,13 @@ | |
| ;; p0[4 * i + j] = p1[4 * j + i]; | ||
| ;; } | ||
|
|
||
| ; CHECK: Dependency matrix before interchange: | ||
| ; CHECK-NEXT: * * | ||
| ; CHECK-NEXT: Processing InnerLoopId = 1 and OuterLoopId = 0 | ||
| ; CHECK: --- !Missed | ||
| ; CHECK-NEXT: Pass: loop-interchange | ||
| ; CHECK-NEXT: Name: Dependence | ||
| ; CHECK-NEXT: Function: may_alias | ||
| ; CHECK-NEXT: Args: | ||
| ; CHECK-NEXT: - String: All loops have dependencies in all directions. | ||
| ; CHECK-NEXT: ... | ||
|
Comment on lines
-13
to
+19
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed because the previous CHECK directives check the debug outputs, which are no longer printed due to this change. |
||
| define void @may_alias(ptr %p0, ptr %p1) { | ||
| entry: | ||
| br label %for.i.header | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,13 @@ | |
| ; RUN: opt < %s -passes=loop-interchange -S -debug 2>&1 | FileCheck %s | ||
|
|
||
| ; CHECK: Dependency matrix before interchange: | ||
| ; CHECK-NEXT: * * | ||
| ; CHECK-NEXT: = * | ||
| ; CHECK-NEXT: < * | ||
| ; CHECK-NEXT: Processing InnerLoopId | ||
|
|
||
| ; This example is taken from github issue #54176 | ||
| ; | ||
| define void @foo(i32 noundef %n, i32 noundef %m, ptr nocapture noundef %aa, ptr nocapture noundef readonly %bb, ptr nocapture noundef writeonly %cc) { | ||
| define void @foo(i32 noundef %n, i32 noundef %m, ptr nocapture noundef noalias %aa, ptr nocapture noundef readonly noalias %bb, ptr nocapture noundef writeonly noalias %cc) { | ||
|
Comment on lines
-5
to
+11
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
| entry: | ||
| %arrayidx7 = getelementptr inbounds i8, ptr %aa, i64 512 | ||
| br label %for.cond1.preheader | ||
|
|
||
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.
Can be reworded to the following for clarity.
// If all the elements of any direction vector have only '*', legality can't be proven.
// Exit early to save compile time.
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.
fixed, thanks