-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[DeadArgElim] fix verifier failure when changing musttail's function signature #127366
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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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
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 |
---|---|---|
@@ -1,16 +1,22 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt -passes=deadargelim -S < %s | FileCheck %s | ||
; PR36441 | ||
; Dead arguments should not be removed in presence of `musttail` calls. | ||
|
||
; CHECK-LABEL: define internal void @test(i32 %a, i32 %b) | ||
; CHECK: musttail call void @foo(i32 %a, i32 0) | ||
; FIXME: we should replace those with `undef`s | ||
define internal void @test(i32 %a, i32 %b) { | ||
; CHECK-LABEL: define internal void @test( | ||
; CHECK-SAME: i32 [[A:%.*]], i32 [[B:%.*]]) { | ||
; CHECK-NEXT: musttail call void @foo(i32 poison, i32 poison) | ||
; CHECK-NEXT: ret void | ||
; | ||
musttail call void @foo(i32 %a, i32 0) | ||
ret void | ||
} | ||
|
||
; CHECK-LABEL: define internal void @foo(i32 %a, i32 %b) | ||
define internal void @foo(i32 %a, i32 %b) { | ||
; CHECK-LABEL: define internal void @foo( | ||
; CHECK-SAME: i32 [[A:%.*]], i32 [[B:%.*]]) { | ||
; CHECK-NEXT: ret void | ||
; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; Testcases comes from PR126817 and PR107569 | ||
; See PR54964 and langref for more information about how llvm deal with musttail currently | ||
; RUN: opt -passes=deadargelim -S < %s | FileCheck %s | ||
|
||
define i64 @A() { | ||
; CHECK-LABEL: define i64 @A() { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[V2660:%.*]] = musttail call i64 @B() | ||
; CHECK-NEXT: ret i64 [[V2660]] | ||
; | ||
entry: | ||
%v2660 = musttail call i64 @B() | ||
ret i64 %v2660 | ||
} | ||
|
||
define internal i64 @B() { | ||
; CHECK-LABEL: define internal i64 @B() { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: ret i64 0 | ||
; | ||
entry: | ||
ret i64 0 | ||
} | ||
|
||
define internal i64 @C() { | ||
; CHECK-LABEL: define internal i64 @C() { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[V30543:%.*]] = musttail call i64 @B() | ||
; CHECK-NEXT: ret i64 [[V30543]] | ||
; | ||
entry: | ||
%v30543 = musttail call i64 @B() | ||
ret i64 %v30543 | ||
} | ||
|
||
%struct.S = type { double } | ||
|
||
define internal %struct.S @F38() { | ||
; CHECK-LABEL: define internal %struct.S @F38() { | ||
; CHECK-NEXT: ret [[STRUCT_S:%.*]] zeroinitializer | ||
; | ||
ret %struct.S { double 0.0 } | ||
} | ||
|
||
define internal %struct.S @F36() { | ||
; CHECK-LABEL: define internal %struct.S @F36() { | ||
; CHECK-NEXT: [[TMP1:%.*]] = alloca [[STRUCT_S:%.*]], align 8 | ||
; CHECK-NEXT: [[TMP2:%.*]] = musttail call [[STRUCT_S]] @[[F38:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]() | ||
; CHECK-NEXT: ret [[STRUCT_S]] [[TMP2]] | ||
; | ||
%1 = alloca %struct.S, align 8 | ||
%3 = musttail call %struct.S @F38() | ||
ret %struct.S %3 | ||
} | ||
|
||
define double @foo() { | ||
; CHECK-LABEL: define double @foo() { | ||
; CHECK-NEXT: [[TMP1:%.*]] = call [[STRUCT_S:%.*]] @[[F36:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]() | ||
; CHECK-NEXT: [[TMP2:%.*]] = extractvalue [[STRUCT_S]] [[TMP1]], 0 | ||
; CHECK-NEXT: ret double [[TMP2]] | ||
; | ||
%3 = call %struct.S @F36() | ||
%5 = extractvalue %struct.S %3, 0 | ||
ret double %5 | ||
} |
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.
I guess this secondary pass is effectively redundant with iteration over uses of the function in surveyFunction.
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.
If you mean
propagateVirtMustcallLiveness
...Yes it is redundant after the change.