-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AArch64] Unfold adds when eliminating frame index with scalable offset #158597
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 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
27c6b10
[AArch64] Avoid apply S-form on frame index in peephole
XChy a30b328
Unfold adds
XChy 18c3c7b
format
XChy a4b824a
Remove debugging
XChy f2fa5b4
rename
XChy 66b3256
format
XChy ebbd0ce
resolve comments
XChy b5ac53a
reduce test
XChy 36616d7
rename variable
XChy 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,96 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
XChy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
; RUN: llc -mtriple=aarch64 < %s | FileCheck %s | ||
|
||
define void @i(ptr %ad, ptr %0) #0 { | ||
; CHECK-LABEL: i: | ||
; CHECK: // %bb.0: // %entry | ||
; CHECK-NEXT: str d11, [sp, #-48]! // 8-byte Folded Spill | ||
; CHECK-NEXT: stp x29, x30, [sp, #16] // 16-byte Folded Spill | ||
; CHECK-NEXT: add x29, sp, #16 | ||
; CHECK-NEXT: stp x28, x19, [sp, #32] // 16-byte Folded Spill | ||
; CHECK-NEXT: sub sp, sp, #16 | ||
; CHECK-NEXT: addvl sp, sp, #-1 | ||
; CHECK-NEXT: .cfi_def_cfa w29, 32 | ||
; CHECK-NEXT: .cfi_offset w19, -8 | ||
; CHECK-NEXT: .cfi_offset w28, -16 | ||
; CHECK-NEXT: .cfi_offset w30, -24 | ||
; CHECK-NEXT: .cfi_offset w29, -32 | ||
; CHECK-NEXT: .cfi_offset b11, -48 | ||
; CHECK-NEXT: //APP | ||
; CHECK-NEXT: //NO_APP | ||
; CHECK-NEXT: // %bb.1: // %asm.fallthrough | ||
; CHECK-NEXT: .LBB0_2: // Inline asm indirect target | ||
; CHECK-NEXT: // %ah.preheader.preheader | ||
; CHECK-NEXT: // Label of block must be emitted | ||
; CHECK-NEXT: mov x8, #-35417 // =0xffffffffffff75a7 | ||
; CHECK-NEXT: mov x9, #35417 // =0x8a59 | ||
; CHECK-NEXT: mov w19, #1 // =0x1 | ||
; CHECK-NEXT: movk x8, #29436, lsl #16 | ||
; CHECK-NEXT: movk x9, #36099, lsl #16 | ||
; CHECK-NEXT: stp x1, x0, [sp] // 16-byte Folded Spill | ||
; CHECK-NEXT: movk x8, #64591, lsl #32 | ||
; CHECK-NEXT: movk x9, #944, lsl #32 | ||
; CHECK-NEXT: index z0.d, x9, x8 | ||
; CHECK-NEXT: sub x8, x29, #16 | ||
; CHECK-NEXT: str z0, [x8, #-1, mul vl] // 16-byte Folded Spill | ||
; CHECK-NEXT: .LBB0_3: // Inline asm indirect target | ||
; CHECK-NEXT: // %ah | ||
; CHECK-NEXT: // =>This Inner Loop Header: Depth=1 | ||
; CHECK-NEXT: // Label of block must be emitted | ||
; CHECK-NEXT: sub x9, x29, #16 | ||
; CHECK-NEXT: ldr x8, [sp, #8] // 8-byte Folded Reload | ||
; CHECK-NEXT: ldr z0, [x9, #-1, mul vl] // 16-byte Folded Reload | ||
; CHECK-NEXT: str d0, [x8] | ||
; CHECK-NEXT: movi v0.2d, #0000000000000000 | ||
; CHECK-NEXT: sub x8, x29, #16 | ||
; CHECK-NEXT: str z0, [x8, #-1, mul vl] // 16-byte Folded Spill | ||
; CHECK-NEXT: //APP | ||
; CHECK-NEXT: //NO_APP | ||
; CHECK-NEXT: //APP | ||
; CHECK-NEXT: //NO_APP | ||
; CHECK-NEXT: // %bb.4: // %asm.fallthrough2 | ||
; CHECK-NEXT: // in Loop: Header=BB0_3 Depth=1 | ||
; CHECK-NEXT: bl g | ||
; CHECK-NEXT: add x8, sp, #28 | ||
; CHECK-NEXT: addvl x8, x8, #1 | ||
; CHECK-NEXT: cmp x8, #0 | ||
; CHECK-NEXT: ldp x10, x8, [sp] // 16-byte Folded Reload | ||
; CHECK-NEXT: cset w9, ne | ||
; CHECK-NEXT: strb w19, [x10] | ||
; CHECK-NEXT: str w9, [x8] | ||
; CHECK-NEXT: //APP | ||
; CHECK-NEXT: //NO_APP | ||
; CHECK-NEXT: b .LBB0_3 | ||
entry: | ||
%aj = alloca i32, align 4 | ||
callbr void asm sideeffect "", "!i,!i"() | ||
to label %asm.fallthrough [label %ah.preheader.preheader, label %ah.preheader.preheader] | ||
|
||
ah.preheader.preheader: ; preds = %entry, %entry | ||
%conv = xor i8 0, 1 | ||
br label %ah | ||
|
||
asm.fallthrough: ; preds = %entry | ||
unreachable | ||
|
||
ah: ; preds = %asm.fallthrough2, %asm.fallthrough2, %ah, %ah.preheader.preheader | ||
%af.2 = phi <8 x i64> [ zeroinitializer, %asm.fallthrough2 ], [ <i64 4056814946905, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0>, %ah.preheader.preheader ], [ zeroinitializer, %asm.fallthrough2 ], [ zeroinitializer, %ah ] | ||
%vecext = extractelement <8 x i64> %af.2, i64 0 | ||
store i64 %vecext, ptr %ad, align 8 | ||
call void asm sideeffect "", "~{v11}"() | ||
callbr void asm sideeffect "", "!i"() | ||
to label %asm.fallthrough2 [label %ah] | ||
|
||
asm.fallthrough2: ; preds = %ah | ||
%call = call i32 @g() | ||
store i8 %conv, ptr %0, align 1 | ||
%cmp = icmp ne ptr %aj, null | ||
%conv3 = zext i1 %cmp to i32 | ||
store i32 %conv3, ptr %ad, align 4 | ||
callbr void asm sideeffect "", "!i"() | ||
to label %ah [label %ah] | ||
} | ||
|
||
declare i32 @g(...) | ||
|
||
attributes #0 = { "frame-pointer"="non-leaf" "target-features"="+sve" } |
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.
Nothing here is checking that the stack offset is scalable. If you want to know if the frame-index is describing an object on the stack with scalable size, then you should like at its stack ID.
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.
IIUC, the object on the frame index is unrelated to the stack offset? The stack offset is determined in PrologEpilogInserter. This patch just disallows the optimization for SVE. If we want to optimize precisely, we should reverse the optimization in
emitFrameOffset
.