Skip to content

Conversation

@yozhu
Copy link
Contributor

@yozhu yozhu commented Aug 30, 2025

We can safely remove the red zone clobbering protection in arm64
instrumentation sequence, since there is no red zone in AArch64
ELF/Linux system.

We can safely remove the red zone clobbering protection in arm64
instrumentation sequence, since there is no red zone in AArch64
ELF/Linux system.
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2025

@llvm/pr-subscribers-bolt

Author: YongKang Zhu (yozhu)

Changes

We can safely remove the red zone clobbering protection in arm64
instrumentation sequence, since there is no red zone in AArch64
ELF/Linux system.


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

1 Files Affected:

  • (modified) bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp (+1-5)
diff --git a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
index 72f95cea6fa1d..fcb645f661ef0 100644
--- a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -2517,10 +2517,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
   createInstrIncMemory(const MCSymbol *Target, MCContext *Ctx, bool IsLeaf,
                        unsigned CodePointerSize) const override {
     unsigned int I = 0;
-    InstructionListType Instrs(IsLeaf ? 12 : 10);
+    InstructionListType Instrs(10);
 
-    if (IsLeaf)
-      createStackPointerIncrement(Instrs[I++], 128);
     createPushRegisters(Instrs[I++], AArch64::X0, AArch64::X1);
     getSystemFlag(Instrs[I++], AArch64::X1);
     InstructionListType Addr = materializeAddress(Target, Ctx, AArch64::X0);
@@ -2535,8 +2533,6 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
     loadReg(Instrs[I++], AArch64::X2, AArch64::SP);
     setSystemFlag(Instrs[I++], AArch64::X1);
     createPopRegisters(Instrs[I++], AArch64::X0, AArch64::X1);
-    if (IsLeaf)
-      createStackPointerDecrement(Instrs[I++], 128);
     return Instrs;
   }
 

@yozhu yozhu requested a review from ElvinaYakubova September 3, 2025 20:47
Copy link
Contributor

@maksfb maksfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yozhu
Copy link
Contributor Author

yozhu commented Sep 4, 2025

LGTM

Thanks for the review, Maksim!

@yozhu yozhu merged commit 93785ff into llvm:main Sep 4, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants