[llvm] [BOLT][AArch64][instr] Remove red zone clobbering protection (PR #156129)

YongKang Zhu via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 17:42:37 PDT 2025


https://github.com/yozhu created https://github.com/llvm/llvm-project/pull/156129

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

>From 4af534f99b6a1708fe505c2d59c086afe84a881e Mon Sep 17 00:00:00 2001
From: YongKang Zhu <yongzhu at fb.com>
Date: Thu, 28 Aug 2025 21:36:24 -0700
Subject: [PATCH] [BOLT][AArch64][instr] Remove red zone clobbering protection

We can safely remove the red zone clobbering protection in arm64
instrumentation sequence, since there is no red zone in AArch64
ELF/Linux system.
---
 bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

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;
   }
 



More information about the llvm-commits mailing list