[PATCH] D100286: [RISCV] Fix StackOffset calculation when using sp to access the fixed stack object in the case of rvv vector objects existed
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 29 20:03:17 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5603ed60ad6c: [RISCV] Fix StackOffset calculation when using sp to access the fixed stackā¦ (authored by StephenFan).
Changed prior to commit:
https://reviews.llvm.org/D100286?vs=336746&id=341751#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100286/new/
https://reviews.llvm.org/D100286
Files:
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
llvm/test/CodeGen/RISCV/rvv/localvar.ll
Index: llvm/test/CodeGen/RISCV/rvv/localvar.ll
===================================================================
--- llvm/test/CodeGen/RISCV/rvv/localvar.ll
+++ llvm/test/CodeGen/RISCV/rvv/localvar.ll
@@ -294,7 +294,10 @@
; RV64IV-NEXT: csrr a0, vlenb
; RV64IV-NEXT: slli a0, a0, 3
; RV64IV-NEXT: sub sp, sp, a0
-; RV64IV-NEXT: ld a0, 32(sp)
+; RV64IV-NEXT: csrr a0, vlenb
+; RV64IV-NEXT: slli a0, a0, 3
+; RV64IV-NEXT: add a0, sp, a0
+; RV64IV-NEXT: ld a0, 32(a0)
; RV64IV-NEXT: csrr a1, vlenb
; RV64IV-NEXT: slli a1, a1, 3
; RV64IV-NEXT: add sp, sp, a1
Index: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -749,9 +749,12 @@
// RVV->getRVVPadding() and it can be zero. It allows us to align the RVV
// objects to 8 bytes.
if (MFI.getStackID(FI) == TargetStackID::Default) {
- Offset += StackOffset::getFixed(MFI.getStackSize());
- if (FI < 0)
- Offset += StackOffset::getFixed(RVFI->getLibCallStackSize());
+ if (MFI.isFixedObjectIndex(FI)) {
+ Offset += StackOffset::get(MFI.getStackSize() + RVFI->getRVVPadding()
+ + RVFI->getLibCallStackSize(), RVFI->getRVVStackSize());
+ } else {
+ Offset += StackOffset::getFixed(MFI.getStackSize());
+ }
} else if (MFI.getStackID(FI) == TargetStackID::ScalableVector) {
Offset += StackOffset::get(
alignTo(MFI.getStackSize() - RVFI->getCalleeSavedStackSize(), 8),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100286.341751.patch
Type: text/x-patch
Size: 1650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210430/b9a3d9d5/attachment.bin>
More information about the llvm-commits
mailing list