-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Analysis] Attribute Range should not prevent tail call optimization #91122
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
11 commits
Select commit
Hold shift + click to select a range
eead1a5
Remove Range attr when comparing for tailcall
jsji b079469
Add test for testcall with range
jsji 6b78e63
Update Attr in TargetLowering as well
jsji c0ab0a9
Update tests
jsji 7d3aa09
Revert "Update Attr in TargetLowering as well"
jsji 071cef9
Revert "Revert "Update Attr in TargetLowering as well""
jsji d748bd2
Add target lowering test
jsji 88a3076
remove vargs in test
jsji b2bdaf9
Update tests
jsji 779993b
fix indents
jsji bab465d
Avoid UB
jsji 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 | ||
; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s | ||
|
||
define range(i32 0, 2) i32 @foo(ptr %this) { | ||
; CHECK-LABEL: foo: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: movzbl (%rdi), %eax | ||
; CHECK-NEXT: retq | ||
entry: | ||
%call = load volatile i1, ptr %this, align 1 | ||
%spec.select = zext i1 %call to i32 | ||
ret i32 %spec.select | ||
} | ||
|
||
define range(i32 0, 2) i32 @bar(ptr %this) { | ||
; CHECK-LABEL: bar: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: xorl %edi, %edi | ||
; CHECK-NEXT: jmp foo@PLT # TAILCALL | ||
entry: | ||
%ret = musttail call i32 @foo(ptr null) | ||
ret i32 %ret | ||
} | ||
|
||
declare i64 @llvm.llround.f32(float) nounwind readnone | ||
define range(i64 0, 8) i64 @testmsxs(float %x) { | ||
; CHECK-LABEL: testmsxs: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: jmp llroundf@PLT # TAILCALL | ||
entry: | ||
%ret = tail call i64 @llvm.llround.f32(float %x) | ||
ret i64 %ret | ||
} | ||
|
||
declare i32 @callee() | ||
|
||
define range(i32 0, 2) i32 @func_with_range_attr() { | ||
; CHECK-LABEL: func_with_range_attr: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: jmp callee@PLT # TAILCALL | ||
entry: | ||
%ret = musttail call i32 @callee() | ||
ret i32 %ret | ||
} | ||
|
||
define i32 @call_with_range_attr() { | ||
; CHECK-LABEL: call_with_range_attr: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: jmp callee@PLT # TAILCALL | ||
entry: | ||
%ret = musttail call range(i32 0, 2) i32 @callee() | ||
ret i32 %ret | ||
} | ||
jsji marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Uh oh!
There was an error while loading. Please reload this page.