[llvm] a8f4f85 - [AArch64][SVE] Remove erroneous assert in resolveFrameOffsetReference
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 01:23:08 PDT 2020
Author: Sander de Smalen
Date: 2020-07-14T09:22:45+01:00
New Revision: a8f4f85d84c17c7e85ca67c88dda458cc0fe8a2e
URL: https://github.com/llvm/llvm-project/commit/a8f4f85d84c17c7e85ca67c88dda458cc0fe8a2e
DIFF: https://github.com/llvm/llvm-project/commit/a8f4f85d84c17c7e85ca67c88dda458cc0fe8a2e.diff
LOG: [AArch64][SVE] Remove erroneous assert in resolveFrameOffsetReference
The code already supports addressing a fixed-size stack object from
the frame-pointer, by first subtracting sizeof(SVE area) from FP.
Reviewers: efriedma, cameron.mcinally, david-arm, rengolin
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D83125
Added:
Modified:
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/test/CodeGen/AArch64/framelayout-sve.mir
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index bd76855f7c64..efa3fd5ca9ce 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -1818,10 +1818,8 @@ StackOffset AArch64FrameLowering::resolveFrameOffsetReference(
bool CanUseBP = RegInfo->hasBasePointer(MF);
if (FPOffsetFits && CanUseBP) // Both are ok. Pick the best.
UseFP = PreferFP;
- else if (!CanUseBP) { // Can't use BP. Forced to use FP.
- assert(!SVEStackSize && "Expected BP to be available");
+ else if (!CanUseBP) // Can't use BP. Forced to use FP.
UseFP = true;
- }
// else we can use BP and FP, but the offset from FP won't fit.
// That will make us scavenge registers which we can probably avoid by
// using BP. If it won't fit for BP either, we'll scavenge anyway.
diff --git a/llvm/test/CodeGen/AArch64/framelayout-sve.mir b/llvm/test/CodeGen/AArch64/framelayout-sve.mir
index 75013bc475a1..046357b860b3 100644
--- a/llvm/test/CodeGen/AArch64/framelayout-sve.mir
+++ b/llvm/test/CodeGen/AArch64/framelayout-sve.mir
@@ -30,6 +30,7 @@
define void @test_address_sve_fp() nounwind { entry: unreachable }
define void @test_stack_arg_sve() nounwind { entry: unreachable }
define void @test_address_sve_out_of_range() nounwind { entry: unreachable }
+ define void @test_address_gpr_vla_nobp() nounwind { entry: unreachable }
define aarch64_sve_vector_pcs void @save_restore_pregs_sve() nounwind { entry: unreachable }
define aarch64_sve_vector_pcs void @save_restore_zregs_sve() nounwind { entry: unreachable }
define aarch64_sve_vector_pcs void @save_restore_sve() nounwind { entry: unreachable }
@@ -334,6 +335,39 @@ body: |
RET_ReallyLR
---
...
+# Test that non-SVE objects are accessed from FP when there is no BP,
+# but the SP cannot be used because of variable-length arrays.
+#
+# +----------+ <- FP
+# | %fstack.0| // 16 scalable bytes
+# +----------+ <- @FP - 16 scalable bytes
+# | %stack.0 | // 16 bytes
+# +----------+ <- @FP - 16 scalable bytes - 16b
+# : %stack.1 : // variable length
+# +----------+ <- SP
+
+# CHECK-LABEL: name: test_address_gpr_vla_nobp
+# CHECK: bb.0.entry:
+# CHECK: $[[TMP:x[0-9]+]] = ADDVL_XXI $fp, -1
+# CHECK-NEXT: STURXi $xzr, killed $[[TMP]], -16
+# CHECK: RET_ReallyLR
+name: test_address_gpr_vla_nobp
+frameInfo:
+ maxAlignment: 16
+fixedStack:
+ - { id: 0, stack-id: sve-vec, size: 16, alignment: 8, offset: -16 }
+stack:
+ - { id: 0, stack-id: default, size: 16, alignment: 8 }
+ - { id: 1, stack-id: default, type: variable-sized }
+body: |
+ bb.0.entry:
+ liveins: $xzr
+
+ STRXui $xzr, %stack.0, 0
+
+ RET_ReallyLR
+---
+...
# CHECK-LABEL: name: save_restore_pregs_sve
# CHECK: $sp = frame-setup ADDVL_XXI $sp, -1
# CHECK: frame-setup STR_PXI killed $p6, $sp, 5
More information about the llvm-commits
mailing list