-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[MIPS][ISel] Fix musttail #161860
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
Open
djtodoro
wants to merge
7
commits into
llvm:main
Choose a base branch
from
djtodoro:pr/fix-mips-musttail
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+147
−27
Open
[MIPS][ISel] Fix musttail #161860
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ac9497e
[MIPS][ISel] Fix musttail
djtodoro 9a77adf
Address comments
djtodoro 1e26120
Apply clang-format
djtodoro 20d634f
address comments
djtodoro eaa5678
Clean up and improve tests
djtodoro 54412fe
apply clang-format
djtodoro b9e145d
apply clang-format on Mips16ISelLowering.h
djtodoro 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
Some comments aren't visible on the classic Files Changed page.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=mips-unknown-linux-gnu < %s | FileCheck %s --check-prefix=MIPS32 | ||
; RUN: llc -mtriple=mips64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=MIPS64 | ||
|
||
; Test musttail support for MIPS | ||
|
||
declare void @external_func() | ||
|
||
; Test basic musttail with external function | ||
define void @test_musttail_external() { | ||
; MIPS32-LABEL: test_musttail_external: | ||
; MIPS32: # %bb.0: | ||
; MIPS32-NEXT: j external_func | ||
; MIPS32-NEXT: nop | ||
; | ||
; MIPS64-LABEL: test_musttail_external: | ||
; MIPS64: # %bb.0: | ||
; MIPS64-NEXT: j external_func | ||
; MIPS64-NEXT: nop | ||
musttail call void @external_func() | ||
ret void | ||
} | ||
|
||
declare i32 @callee_args(i32 %a, i32 %b, i32 %c) | ||
|
||
define i32 @test_musttail_args(i32 %x, i32 %y, i32 %z) { | ||
; MIPS32-LABEL: test_musttail_args: | ||
; MIPS32: # %bb.0: | ||
; MIPS32-NEXT: j callee_args | ||
; MIPS32-NEXT: nop | ||
; | ||
; MIPS64-LABEL: test_musttail_args: | ||
; MIPS64: # %bb.0: | ||
; MIPS64-NEXT: j callee_args | ||
; MIPS64-NEXT: nop | ||
%ret = musttail call i32 @callee_args(i32 %x, i32 %y, i32 %z) | ||
ret i32 %ret | ||
} |
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.
Uh don't we still need to check it's eligible?
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.
Well, that thing confuses me in the case of
musttail
. On ARM, we do check it. Lets do it for MIPS as well.Uh oh!
There was an error while loading. Please reload this page.
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.
@jrtc27 yep, it does make sense to still check it. I incorporated in the new commit (basically - do not check for the optional mips flag for enabling tail call optimizations in case of
musttial
, and I also enabled tail call opts fordso_local
functions (1dcb9110612ab
) ). Thanks for the review!