@@ -128,15 +128,26 @@ Error InsertNegateRAState::runOnFunctions(BinaryContext &BC) {
128128 return !BF.containedNegateRAState () || BF.isIgnored ();
129129 };
130130
131- ParallelUtilities::runOnEachFunction (
132- BC, ParallelUtilities::SchedulingPolicy::SP_TRIVIAL, WorkFun,
133- SkipPredicate, " InsertNegateRAStatePass" );
134-
135- BC.outs () << " BOLT-INFO: rewritten pac-ret DWARF info in "
136- << FunctionsModified << " out of " << BC.getBinaryFunctions ().size ()
137- << " functions "
138- << format (" (%.2lf%%).\n " , (100.0 * FunctionsModified) /
139- BC.getBinaryFunctions ().size ());
131+ int Total = llvm::count_if (
132+ BC.getBinaryFunctions (),
133+ [&](std::pair<const unsigned long , BinaryFunction> &P) {
134+ return P.second .containedNegateRAState () && !P.second .isIgnored ();
135+ });
136+
137+ // If we attempt to run the pass, but SkipPredicate skips all functions,
138+ // we get a warning that the SchedulingPolicy is changed to trivial.
139+ // This would break bolt/test/AArch64/unmarked-data.test.
140+ if (Total != 0 ) {
141+ ParallelUtilities::runOnEachFunction (
142+ BC, ParallelUtilities::SchedulingPolicy::SP_INST_LINEAR, WorkFun,
143+ SkipPredicate, " InsertNegateRAStatePass" );
144+
145+ BC.outs () << " BOLT-INFO: rewritten pac-ret DWARF info in "
146+ << FunctionsModified << " out of "
147+ << BC.getBinaryFunctions ().size () << " functions "
148+ << format (" (%.2lf%%).\n " , (100.0 * FunctionsModified) /
149+ BC.getBinaryFunctions ().size ());
150+ }
140151 return Error::success ();
141152}
142153
0 commit comments