[llvm-branch-commits] [BOLT][NFCI] Allow non-simple functions to be in disassembled state (PR #90806)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed May 1 18:08:10 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)

<details>
<summary>Changes</summary>

BOLTed binaries have no relocations, thus all split functions are marked
as non-simple (BinaryContext::registerFragment). In turn, this prevents
them from being disassembled. Relax the restriction to allow instruction
lookups.

Test Plan: NFC


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


2 Files Affected:

- (modified) bolt/lib/Core/BinaryFunction.cpp (-5) 
- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+2-1) 


``````````diff
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index fff53dd25004a4..8b12492aa1a134 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -1437,11 +1437,6 @@ Error BinaryFunction::disassemble() {
 
   clearList(Relocations);
 
-  if (!IsSimple) {
-    clearList(Instructions);
-    return createNonFatalBOLTError("");
-  }
-
   updateState(State::Disassembled);
 
   return Error::success();
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 23f79e3c135a78..f6f597c8cee0d8 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -3343,7 +3343,8 @@ void RewriteInstance::disassembleFunctions() {
 
     if (!Function.isSimple()) {
       assert((!BC->HasRelocations || Function.getSize() == 0 ||
-              Function.hasIndirectTargetToSplitFragment()) &&
+              Function.hasIndirectTargetToSplitFragment() ||
+              Function.hasInternalCalls()) &&
              "unexpected non-simple function in relocation mode");
       continue;
     }

``````````

</details>


https://github.com/llvm/llvm-project/pull/90806


More information about the llvm-branch-commits mailing list