[llvm] [BOLT] Ensure remember and restore CFIs are in the same list (PR #144348)

Ash Dobrescu via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 06:29:27 PDT 2025


https://github.com/Rin18 updated https://github.com/llvm/llvm-project/pull/144348

>From d8a6f1acd8aafab73475a220b88670173ea4104a Mon Sep 17 00:00:00 2001
From: Ash Dobrescu <ash.dobrescu at arm.com>
Date: Mon, 16 Jun 2025 13:05:02 +0000
Subject: [PATCH 1/2] [BOLT] Ensure remember and restore CFIs are in the same
 list

---
 bolt/include/bolt/Core/BinaryFunction.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index ca8b786f4ab69..828c56d818b09 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -1663,7 +1663,7 @@ class BinaryFunction {
       Offset = I->first;
     }
     assert(I->first == Offset && "CFI pointing to unknown instruction");
-    if (I == Instructions.begin()) {
+    if (I == Instructions.begin() && Inst.getOperation() != MCCFIInstruction::OpRememberState) {
       CIEFrameInstructions.emplace_back(std::forward<MCCFIInstruction>(Inst));
       return;
     }

>From f5828ddd03c396d7bc91507e551304fb8ea35097 Mon Sep 17 00:00:00 2001
From: Ash Dobrescu <ash.dobrescu at arm.com>
Date: Mon, 16 Jun 2025 13:27:01 +0000
Subject: [PATCH 2/2] Run clang-format

---
 bolt/include/bolt/Core/BinaryFunction.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index 828c56d818b09..af7149e49c840 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -1663,7 +1663,8 @@ class BinaryFunction {
       Offset = I->first;
     }
     assert(I->first == Offset && "CFI pointing to unknown instruction");
-    if (I == Instructions.begin() && Inst.getOperation() != MCCFIInstruction::OpRememberState) {
+    if (I == Instructions.begin() &&
+        Inst.getOperation() != MCCFIInstruction::OpRememberState) {
       CIEFrameInstructions.emplace_back(std::forward<MCCFIInstruction>(Inst));
       return;
     }



More information about the llvm-commits mailing list