[llvm] [BOLT][NFC] Don't remove nops in non-simple functions (PR #101964)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 05:02:24 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Vladislav Khmelevsky (yota9)

<details>
<summary>Changes</summary>

Follow the logic of https://reviews.llvm.org/D143887 patch (fixed later
by #<!-- -->71377) we don't want to remove nops in non-simple function just in
case there is undetected jump table to minimize chances to break offsets
in it.


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


1 Files Affected:

- (modified) bolt/lib/Passes/BinaryPasses.cpp (+1-1) 


``````````diff
diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp
index fa95ad7324ac1..fbbbe1e05df2c 100644
--- a/bolt/lib/Passes/BinaryPasses.cpp
+++ b/bolt/lib/Passes/BinaryPasses.cpp
@@ -1923,7 +1923,7 @@ Error RemoveNops::runOnFunctions(BinaryContext &BC) {
   };
 
   ParallelUtilities::PredicateTy SkipFunc = [&](const BinaryFunction &BF) {
-    return BF.shouldPreserveNops();
+    return BF.shouldPreserveNops() || (!opts::StrictMode && !BF.isSimple());
   };
 
   ParallelUtilities::runOnEachFunction(

``````````

</details>


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


More information about the llvm-commits mailing list