[Lldb-commits] [lldb] [lldb][nfc] Avoid duplicate calls to GetInstructionCondition in UnwindAssemblyInstEmulation (PR #168340)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 17 02:38:16 PST 2025


https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/168340

None

>From 7a7213318c8d3082d696757aee0a58b30bcd7c8e Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Fri, 14 Nov 2025 11:04:24 +0000
Subject: [PATCH] [lldb][nfc] Avoid duplicate calls to GetInstructionCondition
 in UnwindAssemblyInstEmulation

---
 .../InstEmulation/UnwindAssemblyInstEmulation.cpp           | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index 790f230af74c9..8437a51471ca2 100644
--- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -174,8 +174,10 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
 
     m_inst_emulator_up->SetInstruction(inst->GetOpcode(), inst->GetAddress(),
                                        nullptr);
+    const EmulateInstruction::InstructionCondition new_condition =
+        m_inst_emulator_up->GetInstructionCondition();
 
-    if (last_condition != m_inst_emulator_up->GetInstructionCondition()) {
+    if (last_condition != new_condition) {
       // If the last instruction was conditional with a different condition
       // than the current condition then restore the state.
       if (last_condition != EmulateInstruction::UnconditionalCondition) {
@@ -190,7 +192,7 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
       condition_block_start_state = it;
     }
 
-    last_condition = m_inst_emulator_up->GetInstructionCondition();
+    last_condition = new_condition;
 
     m_inst_emulator_up->EvaluateInstruction(
         eEmulateInstructionOptionIgnoreConditions);



More information about the lldb-commits mailing list