[llvm] [BOLT][NFC] Refactor function state check (PR #73420)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 25 20:17:55 PST 2023


https://github.com/maksfb updated https://github.com/llvm/llvm-project/pull/73420

>From c3ed683e6c0bc78768dadc1e51625ef245f25eab Mon Sep 17 00:00:00 2001
From: Maksim Panchenko <maks at fb.com>
Date: Sat, 25 Nov 2023 18:13:00 -0800
Subject: [PATCH 1/2] [BOLT][NFC] Refactor function state check

Properly check function emission state in updateOutputValues().
---
 bolt/lib/Core/BinaryFunction.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index b9d45db1cd782be..ce6505b6e688bef 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -4144,7 +4144,7 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
     return;
 
   // Output ranges should match the input if the body hasn't changed.
-  if (!isSimple() && !BC.HasRelocations)
+  if (!isEmitted())
     return;
 
   // AArch64 may have functions that only contains a constant island (no code).

>From 39bdf5078012b50c9fb4831768a61218294cb9b2 Mon Sep 17 00:00:00 2001
From: Maksim Panchenko <maks at fb.com>
Date: Sat, 25 Nov 2023 20:17:27 -0800
Subject: [PATCH 2/2] fixup! [BOLT][NFC] Refactor function state check

---
 bolt/lib/Core/BinaryFunction.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index ce6505b6e688bef..99d18893e4c54e8 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -4143,10 +4143,6 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
   if (!requiresAddressMap())
     return;
 
-  // Output ranges should match the input if the body hasn't changed.
-  if (!isEmitted())
-    return;
-
   // AArch64 may have functions that only contains a constant island (no code).
   if (getLayout().block_empty())
     return;



More information about the llvm-commits mailing list