-
Notifications
You must be signed in to change notification settings - Fork 15k
[DA] Replace delinearization for fixed size array #161822
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
aa3e203
66cfa34
e89cb44
c7dc3af
795f2f8
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 |
|---|---|---|
|
|
@@ -149,11 +149,10 @@ define void @multidim_accesses(ptr %A) { | |
| ; CHECK-NEXT: Src: store i32 1, ptr %idx0, align 4 --> Dst: store i32 1, ptr %idx0, align 4 | ||
| ; CHECK-NEXT: da analyze - none! | ||
| ; CHECK-NEXT: Src: store i32 1, ptr %idx0, align 4 --> Dst: store i32 1, ptr %idx1, align 4 | ||
| ; CHECK-NEXT: da analyze - consistent output [0 0 0|<]! | ||
| ; CHECK-NEXT: da analyze - output [<= * *|<]! | ||
| ; CHECK-NEXT: Src: store i32 1, ptr %idx1, align 4 --> Dst: store i32 1, ptr %idx1, align 4 | ||
| ; CHECK-NEXT: da analyze - none! | ||
| ; | ||
| ; FIXME: the dependence distance is not constant. Distance vector should be [* * *|<]! | ||
|
Comment on lines
-152
to
-156
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. This change means fixing a known issue. |
||
| ; for (i = 0; i < 256; i++) | ||
| ; for (j = 0; j < 256; j++) | ||
| ; for (k = 0; k < 256; k++) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
| ; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \ | ||
| ; RUN: | FileCheck %s | ||
|
|
||
| ; XFAIL: * | ||
| ; Currently fails since delinearization doesn't work as expected. | ||
|
||
|
|
||
| ; Test for a bug, which caused an assert when an invalid | ||
| ; SCEVAddRecExpr is created in addToCoefficient. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,7 +148,7 @@ define void @non_samebd0(ptr %A) nounwind uwtable ssp { | |
| ; CHECK-NEXT: Src: store i64 %i.013, ptr %arrayidx12, align 8 --> Dst: store i64 %i.013, ptr %arrayidx12, align 8 | ||
| ; CHECK-NEXT: da analyze - none! | ||
| ; CHECK-NEXT: Src: store i64 %i.013, ptr %arrayidx12, align 8 --> Dst: store i64 %l17.04, ptr %arrayidx24, align 8 | ||
| ; CHECK-NEXT: da analyze - output [-4 -3]! | ||
|
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. Seems regression, but less important, I believe. |
||
| ; CHECK-NEXT: da analyze - output [> *]! | ||
| ; CHECK-NEXT: Src: store i64 %l17.04, ptr %arrayidx24, align 8 --> Dst: store i64 %l17.04, ptr %arrayidx24, align 8 | ||
| ; CHECK-NEXT: da analyze - none! | ||
| ; | ||
|
|
||
|
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. This also will be removed in #160924. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,10 +149,10 @@ exit: | |
| ;; for (int k = 0; k < 19; k++) | ||
| ;; b[i][j][k] = b[i][5][k + 1]; | ||
| ;; | ||
| ;; The direction vector of `b` is [= * <]. We cannot interchange all the loops. | ||
| ;; The direction vector of `b` is [= * *]. We cannot interchange all the loops. | ||
|
|
||
| ; CHECK: Dependency matrix before interchange: | ||
| ; CHECK-NEXT: = * < | ||
| ; CHECK-NEXT: = * * | ||
|
Comment on lines
+152
to
+155
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. I remember I added this test in #139690. It should be sufficient to ensure no interchange occurs for this case. |
||
| ; CHECK-NEXT: Processing InnerLoopId = 2 and OuterLoopId = 1 | ||
| ; CHECK-NEXT: Failed interchange InnerLoopId = 2 and OuterLoopId = 1 due to dependence | ||
| ; CHECK-NEXT: Not interchanging loops. Cannot prove legality. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| ; RUN: opt < %s -passes=loop-interchange -pass-remarks-missed='loop-interchange' -pass-remarks-output=%t \ | ||
| ; RUN: -verify-dom-info -verify-loop-info -verify-loop-lcssa | ||
| ; RUN: FileCheck --input-file=%t %s | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6 | ||
| ; RUN: opt < %s -passes=loop-interchange \ | ||
| ; RUN: -verify-dom-info -verify-loop-info -verify-loop-lcssa -S 2>&1 | FileCheck %s | ||
|
|
||
| ;; The original code: | ||
| ;; | ||
|
|
@@ -15,19 +15,51 @@ | |
| ;; | ||
| ;; The entry of the direction vector for the outermost loop is `DVEntry::LE`. | ||
| ;; We need to treat this as `*`, not `<`. See issue #123920 for details. | ||
|
|
||
| ; CHECK: --- !Missed | ||
| ; CHECK-NEXT: Pass: loop-interchange | ||
| ; CHECK-NEXT: Name: Dependence | ||
| ; CHECK-NEXT: Function: f | ||
| ; CHECK: --- !Missed | ||
| ; CHECK-NEXT: Pass: loop-interchange | ||
| ; CHECK-NEXT: Name: Dependence | ||
| ; CHECK-NEXT: Function: f | ||
|
Comment on lines
19
to
26
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 in #124901. Also enough to check no interchange happens, so I switched from checking remarks to using 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. I prefer the remark output. Check lines from update_test_checks give no clue what is intended to be checked 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. Reverted. The output has changed, but it should be fine since this test ensures that no interchange happens. |
||
| ;; In conclusion, we must not interchange the loops. | ||
|
|
||
| @a = dso_local global [16 x [16 x [16 x i32]]] zeroinitializer, align 4 | ||
|
|
||
| define dso_local void @f() { | ||
| ; CHECK-LABEL: define dso_local void @f() { | ||
| ; CHECK-NEXT: [[ENTRY:.*]]: | ||
| ; CHECK-NEXT: br label %[[FOR_COND1_PREHEADER:.*]] | ||
| ; CHECK: [[FOR_COND1_PREHEADER]]: | ||
| ; CHECK-NEXT: [[I_039:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[INC26:%.*]], %[[FOR_COND_CLEANUP3:.*]] ] | ||
| ; CHECK-NEXT: [[SUB:%.*]] = add nuw nsw i32 [[I_039]], 3 | ||
| ; CHECK-NEXT: [[IDXPROM:%.*]] = zext nneg i32 [[SUB]] to i64 | ||
| ; CHECK-NEXT: [[MUL:%.*]] = shl nuw nsw i32 [[I_039]], 1 | ||
| ; CHECK-NEXT: [[IDXPROM13:%.*]] = zext nneg i32 [[MUL]] to i64 | ||
| ; CHECK-NEXT: br label %[[FOR_COND5_PREHEADER:.*]] | ||
| ; CHECK: [[FOR_COND_CLEANUP:.*]]: | ||
| ; CHECK-NEXT: ret void | ||
| ; CHECK: [[FOR_COND5_PREHEADER]]: | ||
| ; CHECK-NEXT: [[J_038:%.*]] = phi i32 [ 1, %[[FOR_COND1_PREHEADER]] ], [ [[INC23:%.*]], %[[FOR_COND_CLEANUP7:.*]] ] | ||
| ; CHECK-NEXT: [[IDXPROM11:%.*]] = zext nneg i32 [[J_038]] to i64 | ||
| ; CHECK-NEXT: [[SUB18:%.*]] = add nsw i32 [[J_038]], -1 | ||
| ; CHECK-NEXT: [[IDXPROM19:%.*]] = sext i32 [[SUB18]] to i64 | ||
| ; CHECK-NEXT: br label %[[FOR_BODY8:.*]] | ||
| ; CHECK: [[FOR_COND_CLEANUP3]]: | ||
| ; CHECK-NEXT: [[INC26]] = add nuw nsw i32 [[I_039]], 1 | ||
| ; CHECK-NEXT: [[CMP:%.*]] = icmp samesign ult i32 [[I_039]], 3 | ||
| ; CHECK-NEXT: br i1 [[CMP]], label %[[FOR_COND1_PREHEADER]], label %[[FOR_COND_CLEANUP]] | ||
| ; CHECK: [[FOR_COND_CLEANUP7]]: | ||
| ; CHECK-NEXT: [[INC23]] = add nuw nsw i32 [[J_038]], 1 | ||
| ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i32 [[J_038]], 7 | ||
| ; CHECK-NEXT: br i1 [[CMP2]], label %[[FOR_COND5_PREHEADER]], label %[[FOR_COND_CLEANUP3]] | ||
| ; CHECK: [[FOR_BODY8]]: | ||
| ; CHECK-NEXT: [[K_037:%.*]] = phi i32 [ 1, %[[FOR_COND5_PREHEADER]] ], [ [[ADD15:%.*]], %[[FOR_BODY8]] ] | ||
| ; CHECK-NEXT: [[IDXPROM9:%.*]] = zext nneg i32 [[K_037]] to i64 | ||
| ; CHECK-NEXT: [[ARRAYIDX12:%.*]] = getelementptr inbounds nuw [16 x [16 x [16 x i32]]], ptr @a, i64 0, i64 [[IDXPROM]], i64 [[IDXPROM9]], i64 [[IDXPROM11]] | ||
| ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX12]], align 4 | ||
| ; CHECK-NEXT: [[ADD15]] = add nuw nsw i32 [[K_037]], 1 | ||
| ; CHECK-NEXT: [[IDXPROM16:%.*]] = zext nneg i32 [[ADD15]] to i64 | ||
| ; CHECK-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds [16 x [16 x [16 x i32]]], ptr @a, i64 0, i64 [[IDXPROM13]], i64 [[IDXPROM16]], i64 [[IDXPROM19]] | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX20]], align 4 | ||
| ; CHECK-NEXT: [[SUB21:%.*]] = sub nsw i32 [[TMP1]], [[TMP0]] | ||
| ; CHECK-NEXT: store i32 [[SUB21]], ptr [[ARRAYIDX20]], align 4 | ||
| ; CHECK-NEXT: [[CMP6:%.*]] = icmp samesign ult i32 [[K_037]], 7 | ||
| ; CHECK-NEXT: br i1 [[CMP6]], label %[[FOR_BODY8]], label %[[FOR_COND_CLEANUP7]] | ||
| ; | ||
| entry: | ||
| br label %for.cond1.preheader | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,9 @@ | |
|
|
||
| target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" | ||
|
|
||
| ; XFAIL: * | ||
| ; The transformation seems to have succeeded "accidentally". | ||
|
|
||
|
Comment on lines
+6
to
+8
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. Maybe conflicting with #156578. I will rebase after that PR is merged. |
||
| ; CHECK-LABEL: sub_sub_less | ||
| ; CHECK: %j = phi | ||
| ; CHECK-NOT: %j.1 = phi | ||
|
|
||
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 believe this test will be removed in #160924.