-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[LoopInterchange] Don't rely on ASSERTS build for tests. NFC. #116780
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
llvm/test/Transforms/LoopInterchange/call-instructions-remarks.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
; REQUIRES: asserts | ||
; RUN: opt < %s -passes=loop-interchange -pass-remarks-missed='loop-interchange' -pass-remarks-output=%t -S \ | ||
; RUN: -verify-dom-info -verify-loop-info 2>&1 | ||
; RUN: FileCheck --input-file=%t %s | ||
|
||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
|
||
@A = common global [100 x [100 x i32]] zeroinitializer | ||
|
||
declare void @foo(i64 %a) | ||
declare void @bar(i64 %a) readnone | ||
|
||
;;--------------------------------------Test case 01------------------------------------ | ||
;; Not safe to interchange, because the called function `foo` is not marked as | ||
;; readnone, so it could introduce dependences. | ||
;; | ||
;; for(int i=0;i<100;i++) { | ||
;; for(int j=1;j<100;j++) { | ||
;; foo(i); | ||
;; A[j][i] = A[j][i]+k; | ||
;; } | ||
;; } | ||
|
||
; CHECK: --- !Missed | ||
; CHECK-NEXT: Pass: loop-interchange | ||
; CHECK-NEXT: Name: CallInst | ||
; CHECK-NEXT: Function: interchange_01 | ||
; CHECK-NEXT: Args: | ||
; CHECK-NEXT: - String: Cannot interchange loops due to call instruction. | ||
|
||
define void @interchange_01(i32 %k) { | ||
entry: | ||
br label %for1.header | ||
|
||
for1.header: | ||
%indvars.iv23 = phi i64 [ 0, %entry ], [ %indvars.iv.next24, %for1.inc10 ] | ||
br label %for2 | ||
|
||
for2: | ||
%indvars.iv = phi i64 [ %indvars.iv.next, %for2 ], [ 1, %for1.header ] | ||
call void @foo(i64 %indvars.iv23) | ||
%arrayidx5 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %indvars.iv, i64 %indvars.iv23 | ||
%lv = load i32, ptr %arrayidx5 | ||
%add = add nsw i32 %lv, %k | ||
store i32 %add, ptr %arrayidx5 | ||
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 | ||
%exitcond = icmp eq i64 %indvars.iv, 99 | ||
br i1 %exitcond, label %for2.loopexit , label %for2 | ||
|
||
for2.loopexit: | ||
br label %for1.inc10 | ||
|
||
for1.inc10: | ||
%indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1 | ||
%exitcond26 = icmp eq i64 %indvars.iv23, 99 | ||
br i1 %exitcond26, label %for1.loopexit, label %for1.header | ||
|
||
for1.loopexit: | ||
br label %exit | ||
|
||
exit: | ||
ret void | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
llvm/test/Transforms/LoopInterchange/inner-indvar-depend-on-outer-indvar-remark.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
; REQUIRES: asserts | ||
; RUN: opt < %s -passes=loop-interchange -verify-dom-info -verify-loop-info -S -debug 2>&1 | FileCheck %s | ||
|
||
@A = common global [100 x [100 x i64]] zeroinitializer | ||
@N = dso_local local_unnamed_addr global i64 100, align 8 | ||
|
||
; for(int i=0;i<100;i++) | ||
; for(int j=0;j<i;j++) | ||
; A[j][i] = A[j][i]+k; | ||
; | ||
; Inner loop induction variable exit condition depends on the | ||
; outer loop induction variable, i.e., triangular loops. | ||
; | ||
; CHECK: Loop structure not understood by pass | ||
; CHECK: Not interchanging loops. Cannot prove legality. | ||
; | ||
define void @interchange_01(i64 %k) { | ||
entry: | ||
br label %for1.header | ||
|
||
for1.header: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for1.inc10 ] | ||
br label %for2 | ||
|
||
for2: | ||
%j = phi i64 [ %j.next, %for2 ], [ 0, %for1.header ] | ||
%arrayidx5 = getelementptr inbounds [100 x [100 x i64]], ptr @A, i64 0, i64 %j, i64 %i | ||
%lv = load i64, ptr %arrayidx5 | ||
%add = add nsw i64 %lv, %k | ||
store i64 %add, ptr %arrayidx5 | ||
%j.next = add nuw nsw i64 %j, 1 | ||
%exitcond = icmp eq i64 %j, %i | ||
br i1 %exitcond, label %for1.inc10, label %for2 | ||
|
||
for1.inc10: | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%exitcond26 = icmp eq i64 %i, 99 | ||
br i1 %exitcond26, label %for.end12, label %for1.header | ||
|
||
for.end12: | ||
ret void | ||
} | ||
|
||
|
||
; for(int i=0;i<100;i++) | ||
; for(int j=0;j+i<100;j++) | ||
; A[j][i] = A[j][i]+k; | ||
; | ||
; Inner loop induction variable exit condition depends on the | ||
; outer loop induction variable, i.e., triangular loops. | ||
; | ||
; CHECK: Loop structure not understood by pass | ||
; CHECK: Not interchanging loops. Cannot prove legality. | ||
; | ||
define void @interchange_02(i64 %k) { | ||
entry: | ||
br label %for1.header | ||
|
||
for1.header: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for1.inc10 ] | ||
br label %for2 | ||
|
||
for2: | ||
%j = phi i64 [ %j.next, %for2 ], [ 0, %for1.header ] | ||
%arrayidx5 = getelementptr inbounds [100 x [100 x i64]], ptr @A, i64 0, i64 %j, i64 %i | ||
%lv = load i64, ptr %arrayidx5 | ||
%add = add nsw i64 %lv, %k | ||
store i64 %add, ptr %arrayidx5 | ||
%0 = add nuw nsw i64 %j, %i | ||
%j.next = add nuw nsw i64 %j, 1 | ||
%exitcond = icmp eq i64 %0, 100 | ||
br i1 %exitcond, label %for1.inc10, label %for2 | ||
|
||
for1.inc10: | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%exitcond26 = icmp eq i64 %i, 99 | ||
br i1 %exitcond26, label %for.end12, label %for1.header | ||
|
||
for.end12: | ||
ret void | ||
} | ||
|
||
; for(int i=0;i<100;i++) | ||
; for(int j=0;i>j;j++) | ||
; A[j][i] = A[j][i]+k; | ||
; | ||
; Inner loop induction variable exit condition depends on the | ||
; outer loop induction variable, i.e., triangular loops. | ||
; CHECK: Loop structure not understood by pass | ||
; CHECK: Not interchanging loops. Cannot prove legality. | ||
; | ||
define void @interchange_03(i64 %k) { | ||
entry: | ||
br label %for1.header | ||
|
||
for1.header: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for1.inc10 ] | ||
br label %for2 | ||
|
||
for2: | ||
%j = phi i64 [ %j.next, %for2 ], [ 0, %for1.header ] | ||
%arrayidx5 = getelementptr inbounds [100 x [100 x i64]], ptr @A, i64 0, i64 %j, i64 %i | ||
%lv = load i64, ptr %arrayidx5 | ||
%add = add nsw i64 %lv, %k | ||
store i64 %add, ptr %arrayidx5 | ||
%j.next = add nuw nsw i64 %j, 1 | ||
%exitcond = icmp ne i64 %i, %j | ||
br i1 %exitcond, label %for2, label %for1.inc10 | ||
|
||
for1.inc10: | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%exitcond26 = icmp eq i64 %i, 99 | ||
br i1 %exitcond26, label %for.end12, label %for1.header | ||
|
||
for.end12: | ||
ret void | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remarks don't require asserts I think