-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[RISC-V] Only emit multiples of 16 as immediate for cm.push #84935
Open
nemanjai
wants to merge
3
commits into
llvm:main
Choose a base branch
from
nemanjai:nemanja/fix-zcmp-e-stack
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.
Open
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
This file contains 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 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
define ptr @func(ptr %s, i32 %_c, ptr %incdec.ptr, i1 %0, i8 %conv14) #0 { | ||
; RV32-LABEL: func: | ||
; RV32: # %bb.0: # %entry | ||
; RV32-NEXT: cm.push {ra, s0-s1}, -24 | ||
; RV32-NEXT: cm.push {ra, s0-s1}, -32 | ||
; RV32-NEXT: .cfi_def_cfa_offset 24 | ||
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. Aren't these cfi directives wrong, since the stack pointer was moved by 32 not 24? 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. They most certainly appear to be wrong. |
||
; RV32-NEXT: .cfi_offset ra, -12 | ||
; RV32-NEXT: .cfi_offset s0, -8 | ||
|
@@ -31,7 +31,7 @@ define ptr @func(ptr %s, i32 %_c, ptr %incdec.ptr, i1 %0, i8 %conv14) #0 { | |
; RV32-NEXT: lw a0, 4(sp) # 4-byte Folded Reload | ||
; RV32-NEXT: sb a0, 0(s0) | ||
; RV32-NEXT: mv a0, s1 | ||
; RV32-NEXT: cm.popret {ra, s0-s1}, 24 | ||
; RV32-NEXT: cm.popret {ra, s0-s1}, 32 | ||
entry: | ||
br label %while.body | ||
|
||
|
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.
Does this mean we can move the sp by more than StackSize? Doesn't that make the position of sp out of sync with the rest of the code?
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, if the amount of space in the offset for the
cm.push
is more than the additional stack space required, then yes we could. I don't follow why this is a problem though. Or maybe I am misunderstanding what theStackSize
variable actually represents - the way I have interpreted it is "The amount of stack space required for parameters and local objects (not including the space to spill CSR's)". Of course, if my interpretation is correct, I'd certainly make the argument that the variable is poorly named, but hey.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.
We can move the sp by more than StackSize here, and if it does, the stack pointer will be readjusted in the following if statement where
StackSize != 0
.