-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm][X86] Fix merging of large sp updates #125007
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
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
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,32 @@ | ||
; RUN: llc < %s -mtriple=x86_64-linux-unknown -verify-machineinstrs -o %t.s | ||
; RUN: FileCheck --input-file=%t.s %s | ||
|
||
; Double-check that we are able to assemble the generated '.s'. A symptom of the | ||
; problem that led to this test is an assembler failure when using | ||
; '-save-temps'. For example: | ||
; | ||
; > ...s:683:7: error: invalid operand for instruction | ||
; > addq $2147483679, %rsp # imm = 0x8000001F | ||
; | ||
; RUN: llvm-mc -triple x86_64-unknown-unknown %t.s | ||
|
||
; Check that the stack update after calling bar gets merged into the second add | ||
; and not the first which is already at the chunk size limit (0x7FFFFFFF). | ||
|
||
define void @foo(ptr %rhs) { | ||
; CHECK-LABEL: foo | ||
entry: | ||
%lhs = alloca [5 x [5 x [3 x [162 x [161 x [161 x double]]]]]], align 16 | ||
store ptr %lhs, ptr %rhs, align 8 | ||
%0 = call i32 @baz() | ||
call void @bar(i64 0, i64 0, i64 0, i64 0, i64 0, ptr null, ptr %rhs, ptr null, ptr %rhs) | ||
; CHECK: call{{.*}}bar | ||
; CHECK: addq{{.*}}$2147483647, %rsp | ||
; CHECK: addq{{.*}}$372037585, %rsp | ||
; CHECK: .cfi_adjust_cfa_offset -2519521232 | ||
ret void | ||
} | ||
|
||
declare void @bar(i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr) | ||
|
||
declare i32 @baz() |
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 compared the assembly before and after this patch, but the CFI directive doesn't look correct to me after this patch.
Before:
After:
Can you take a look please?
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.
Latest version updates
.cfi_adjust_cfa_offset
to account for total stack adjustment:My understanding is limited, but the
.cfi_adjust_cfa_offset
before my change seems incorrect in that it does not account for the following addq.