-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[Clang][CodeGen][X86] don't coerce int128 into {i64,i64} for SysV-like ABIs
#135230
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
5 commits
Select commit
Hold shift + click to select a range
16068fb
[Clang][CodeGen][X86] don't coerce int128 into `{i64,i64}` for SysV-l…
T0b1-iOS ef48930
[Clang][CodeGen][X86] handle (u)int128_t in structs.
T0b1-iOS b5c9535
fix clang-format
T0b1-iOS 678468d
Always return i128 from GetINTEGERTypeAtOffset and early return in ca…
T0b1-iOS e78426d
Update clang/lib/CodeGen/Targets/X86.cpp
T0b1-iOS 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // no autogeneration since update_cc_test_checks does not support -g | ||
| // RUN: %clang_cc1 -triple x86_64-pc-linux -O1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: define{{.*}} i128 @add(i128 noundef %a) | ||
| // CHECK: #dbg_value(i128 %a, ![[DI:.*]], !DIExpression() | ||
| __int128_t add(__int128_t a) { | ||
| return a + a; | ||
| } | ||
|
|
||
| // CHECK: ![[DI]] = !DILocalVariable(name: "a", arg: 1 |
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
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
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.
Probably remove the handling for int128 in
classify. It's better to useclassifyas the single entry, but I can't get any idea.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 still need to handle i128 in structs.
We could maybe extend GetINTEGERTypeAtOffset to allow it to return i128 when appropriate. (That code is pretty fragile, though; see #76017.)
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 suppose you could make GetINTEGERTypeAtOffset return an i128 if it sees an i128 as the IRType and IROffset is 0 but then you need to check if it did that in classifyArgumentType and return immediately or make GetINTEGERTypeAtOffset return nullptr if the IROffset is >0 to prevent it from creating an aggregate argument? The latter seems like something one could easily trip over though
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.
Something like that, yes. Or maybe it's simpler to do it in a separate function; whatever's more readable.
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 changed GetINTEGERTypeAtOffset to return an i128 when appropriate. That also causes _BitInt(128) to be passed as an i128 but that should be fine as long as it doesn't change how it is passed on the stack.
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.
@efriedma-quic ping. Would this be okay?
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.
@efriedma-quic ping
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.
Sorry about the delay here.
I think this does the right thing, but in a pretty unintuitive way; I had to read through the code multiple times to convince myself this actually works the way it's supposed to.
I'd rather not have GetINTEGERTypeAtOffset return nullptr; instead, the callers of GetINTEGERTypeAtOffset should explicitly check for an i128 return type, and return early. And assert
Hi == Integer.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.
No problem. I changed it to now do an early return. Is that better? I don't think the CI ran again so maybe you need to approve it running or something?
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.
@efriedma-quic Okay, the CI problems are fixed now. It seems there was some external problem with libcxx that made its tests fail before. Maybe you could take a look now