Skip to content
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

[SVE] Fix incorrect offset calculation when rewriting an instruction's frame index. #70315

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5657,7 +5657,7 @@ int llvm::isAArch64FrameOffsetLegal(const MachineInstr &MI,
Offset = Remainder;
else {
NewOffset = NewOffset < 0 ? MinOff : MaxOff;
Offset = Offset - NewOffset * Scale + Remainder;
Offset = Offset - NewOffset * Scale;
}

if (EmittableOffset)
Expand Down
22 changes: 22 additions & 0 deletions llvm/test/CodeGen/AArch64/framelayout-sve.mir
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
define aarch64_sve_vector_pcs void @save_restore_sve_realign() uwtable { entry: unreachable }
define aarch64_sve_vector_pcs void @frame_layout() uwtable { entry: unreachable }
define void @fp_relative_index_with_float_save() uwtable { entry: unreachable }
define void @fp_relative_that_is_not_a_multiple_of_VLx16() uwtable { entry: unreachable }

...
# +----------+
Expand Down Expand Up @@ -1287,3 +1288,24 @@ body: |

RET_ReallyLR
---
...
# CHECK-LABEL: name: fp_relative_that_is_not_a_multiple_of_VLx16
# CHECK: - { id: 0, name: '', type: default, offset: -156, size: 156, alignment: 1,
# CHECK-NEXT: stack-id: scalable-vector
# CHECK: - { id: 1, name: '', type: variable-sized, offset: -32, alignment: 1,
# CHECK-NEXT: stack-id: default

# CHECK: $x8 = ADDPL_XXI $fp, -14
# CHECK-NEXT: $z0 = LD1W_IMM killed renamable $p0, killed $x8, -8

name: fp_relative_that_is_not_a_multiple_of_VLx16
stack:
- { id: 0, stack-id: scalable-vector, size: 156, alignment: 1 }
- { id: 1, stack-id: default, type: variable-sized, alignment: 1 }
body: |
bb.0.entry:
liveins: $p0

renamable $z0 = LD1W_IMM killed renamable $p0, %stack.0, 0
RET_ReallyLR
---
Loading