Skip to content

Commit e9ca8e2

Browse files
committed
[BOLT][NFC] Don't remove nops in non-simple functions
Follow the logic of https://reviews.llvm.org/D143887 patch (fixed later by llvm#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.
1 parent 0954205 commit e9ca8e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "bolt/Core/ParallelUtilities.h"
1616
#include "bolt/Passes/ReorderAlgorithm.h"
1717
#include "bolt/Passes/ReorderFunctions.h"
18+
#include "bolt/Utils/CommandLineOpts.h"
1819
#include "llvm/Support/CommandLine.h"
1920
#include <atomic>
2021
#include <mutex>
@@ -1923,7 +1924,7 @@ Error RemoveNops::runOnFunctions(BinaryContext &BC) {
19231924
};
19241925

19251926
ParallelUtilities::PredicateTy SkipFunc = [&](const BinaryFunction &BF) {
1926-
return BF.shouldPreserveNops();
1927+
return BF.shouldPreserveNops() || (!opts::StrictMode && !BF.isSimple());
19271928
};
19281929

19291930
ParallelUtilities::runOnEachFunction(

0 commit comments

Comments
 (0)