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

[RISCV] Remove getOffsetOfLocalArea() #93765

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

wangpc-pp
Copy link
Contributor

For RISC-V, it's always 0 and I don't see any reason we will
change it in the future.

@llvmbot
Copy link
Member

llvmbot commented May 30, 2024

@llvm/pr-subscribers-backend-risc-v

Author: Pengcheng Wang (wangpc-pp)

Changes

For RISC-V, it's always 0 and I don't see any reason we will
change it in the future.


Full diff: https://github.com/llvm/llvm-project/pull/93765.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVFrameLowering.cpp (+2-3)
diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index 436bd4a38a319..4931e3a994e38 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -878,9 +878,8 @@ RISCVFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
           StackID == TargetStackID::ScalableVector) &&
          "Unexpected stack ID for the frame object.");
   if (StackID == TargetStackID::Default) {
-    Offset =
-        StackOffset::getFixed(MFI.getObjectOffset(FI) - getOffsetOfLocalArea() +
-                              MFI.getOffsetAdjustment());
+    Offset = StackOffset::getFixed(MFI.getObjectOffset(FI) +
+                                   MFI.getOffsetAdjustment());
   } else if (StackID == TargetStackID::ScalableVector) {
     Offset = StackOffset::getScalable(MFI.getObjectOffset(FI));
   }

@wangpc-pp wangpc-pp requested review from asb and topperc May 30, 2024 04:11
@jrtc27
Copy link
Collaborator

jrtc27 commented May 30, 2024

If it exists I feel like we really should be including it, even if it is 0 in practice?

@wangpc-pp
Copy link
Contributor Author

If it exists I feel like we really should be including it, even if it is 0 in practice?

Just a rough scan, only X86 has different LocalAreaOffset.

@francisvm
Copy link
Collaborator

Maybe we should assert it's zero before the if? Otherwise all in favor of simplifying all these offset calculations.

For RISC-V, it's always 0 and I don't see any reason we will
change it in the future.
@wangpc-pp wangpc-pp force-pushed the main-riscv-remove-local-area-offset branch from 49a12b8 to 9cc760b Compare May 31, 2024 04:41
@wangpc-pp wangpc-pp merged commit 94a6b9c into llvm:main Jun 17, 2024
5 of 7 checks passed
@wangpc-pp wangpc-pp deleted the main-riscv-remove-local-area-offset branch June 17, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants