-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[SPARC] Allow overaligned alloca
s
#107223
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
8 commits
Select commit
Hold shift + click to select a range
fc64ded
[WIP][SPARC] Allow overaligned `alloca`s
koachan 3c87042
Update generic test
koachan 54408df
Apply code suggestions
koachan cc2a061
Drop legalize comments
koachan bfc07e5
Fix return value calculation
koachan 80f1564
Fix calculation for alignment over 128 bytes
koachan f671f2d
XFAIL alloca_vla_interact.cpp asan test for SPARC
koachan 54c7669
Apply suggestions
koachan 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
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,93 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -march=sparc < %s | FileCheck %s --check-prefixes=CHECK32 | ||
; RUN: llc -march=sparcv9 < %s | FileCheck %s --check-prefixes=CHECK64 | ||
|
||
define void @variable_alloca_with_overalignment(i32 %num) nounwind { | ||
; CHECK32-LABEL: variable_alloca_with_overalignment: | ||
; CHECK32: ! %bb.0: | ||
; CHECK32-NEXT: save %sp, -96, %sp | ||
; CHECK32-NEXT: add %sp, 80, %i1 | ||
; CHECK32-NEXT: and %i1, -64, %o0 | ||
; CHECK32-NEXT: add %o0, -96, %sp | ||
; CHECK32-NEXT: add %i0, 7, %i0 | ||
; CHECK32-NEXT: and %i0, -8, %i0 | ||
; CHECK32-NEXT: sub %sp, %i0, %i0 | ||
; CHECK32-NEXT: add %i0, -8, %sp | ||
; CHECK32-NEXT: call foo | ||
; CHECK32-NEXT: add %i0, 88, %o1 | ||
; CHECK32-NEXT: ret | ||
; CHECK32-NEXT: restore | ||
; | ||
; CHECK64-LABEL: variable_alloca_with_overalignment: | ||
; CHECK64: ! %bb.0: | ||
; CHECK64-NEXT: save %sp, -128, %sp | ||
; CHECK64-NEXT: add %sp, 2159, %i1 | ||
; CHECK64-NEXT: and %i1, -64, %o0 | ||
; CHECK64-NEXT: add %o0, -2175, %sp | ||
; CHECK64-NEXT: srl %i0, 0, %i0 | ||
; CHECK64-NEXT: add %i0, 15, %i0 | ||
; CHECK64-NEXT: sethi 4194303, %i1 | ||
; CHECK64-NEXT: or %i1, 1008, %i1 | ||
; CHECK64-NEXT: sethi 0, %i2 | ||
; CHECK64-NEXT: or %i2, 1, %i2 | ||
; CHECK64-NEXT: sllx %i2, 32, %i2 | ||
; CHECK64-NEXT: or %i2, %i1, %i1 | ||
; CHECK64-NEXT: and %i0, %i1, %i0 | ||
; CHECK64-NEXT: sub %sp, %i0, %i0 | ||
; CHECK64-NEXT: add %i0, 2175, %o1 | ||
; CHECK64-NEXT: mov %i0, %sp | ||
; CHECK64-NEXT: call foo | ||
; CHECK64-NEXT: add %sp, -48, %sp | ||
; CHECK64-NEXT: add %sp, 48, %sp | ||
; CHECK64-NEXT: ret | ||
; CHECK64-NEXT: restore | ||
%aligned = alloca i32, align 64 | ||
%var_size = alloca i8, i32 %num, align 4 | ||
call void @foo(ptr %aligned, ptr %var_size) | ||
ret void | ||
} | ||
|
||
;; Same but with the alloca itself overaligned | ||
define void @variable_alloca_with_overalignment_2(i32 %num) nounwind { | ||
; CHECK32-LABEL: variable_alloca_with_overalignment_2: | ||
; CHECK32: ! %bb.0: | ||
; CHECK32-NEXT: save %sp, -96, %sp | ||
; CHECK32-NEXT: add %i0, 7, %i0 | ||
; CHECK32-NEXT: and %i0, -8, %i0 | ||
; CHECK32-NEXT: sub %sp, %i0, %i0 | ||
; CHECK32-NEXT: add %i0, 88, %i0 | ||
; CHECK32-NEXT: and %i0, -64, %o1 | ||
; CHECK32-NEXT: add %o1, -96, %sp | ||
; CHECK32-NEXT: call foo | ||
; CHECK32-NEXT: mov %g0, %o0 | ||
; CHECK32-NEXT: ret | ||
; CHECK32-NEXT: restore | ||
; | ||
; CHECK64-LABEL: variable_alloca_with_overalignment_2: | ||
; CHECK64: ! %bb.0: | ||
; CHECK64-NEXT: save %sp, -128, %sp | ||
; CHECK64-NEXT: srl %i0, 0, %i0 | ||
; CHECK64-NEXT: add %i0, 15, %i0 | ||
; CHECK64-NEXT: sethi 4194303, %i1 | ||
; CHECK64-NEXT: or %i1, 1008, %i1 | ||
; CHECK64-NEXT: sethi 0, %i2 | ||
; CHECK64-NEXT: or %i2, 1, %i2 | ||
; CHECK64-NEXT: sllx %i2, 32, %i2 | ||
; CHECK64-NEXT: or %i2, %i1, %i1 | ||
; CHECK64-NEXT: and %i0, %i1, %i0 | ||
; CHECK64-NEXT: sub %sp, %i0, %i0 | ||
; CHECK64-NEXT: add %i0, 2175, %i0 | ||
; CHECK64-NEXT: and %i0, -64, %o1 | ||
; CHECK64-NEXT: add %o1, -2175, %sp | ||
; CHECK64-NEXT: add %sp, -48, %sp | ||
; CHECK64-NEXT: call foo | ||
; CHECK64-NEXT: mov %g0, %o0 | ||
; CHECK64-NEXT: add %sp, 48, %sp | ||
; CHECK64-NEXT: ret | ||
; CHECK64-NEXT: restore | ||
%var_size = alloca i8, i32 %num, align 64 | ||
call void @foo(ptr null, ptr %var_size) | ||
ret void | ||
} | ||
|
||
declare void @foo(ptr, ptr); |
This file was deleted.
Oops, something went wrong.
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.
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.
Uh oh!
There was an error while loading. Please reload this page.