@@ -21,7 +21,12 @@ using namespace llvm;
2121namespace llvm {
2222namespace bolt {
2323
24+ static bool PassFailed = false ;
25+
2426void InsertNegateRAState::runOnFunction (BinaryFunction &BF) {
27+ if (PassFailed)
28+ return ;
29+
2530 BinaryContext &BC = BF.getBinaryContext ();
2631
2732 if (BF.getState () == BinaryFunction::State::Empty)
@@ -39,7 +44,6 @@ void InsertNegateRAState::runOnFunction(BinaryFunction &BF) {
3944 for (FunctionFragment &FF : BF.getLayout ().fragments ()) {
4045 coverFunctionFragmentStart (BF, FF);
4146 bool FirstIter = true ;
42- MCInst PrevInst;
4347 bool PrevRAState = false ;
4448 // As this pass runs after function splitting, we should only check
4549 // consecutive instructions inside FunctionFragments.
@@ -52,6 +56,8 @@ void InsertNegateRAState::runOnFunction(BinaryFunction &BF) {
5256 if (!RAState) {
5357 BC.errs () << " BOLT-ERROR: unknown RAState after inferUnknownStates "
5458 << " in function " << BF.getPrintName () << " \n " ;
59+ PassFailed = true ;
60+ return ;
5561 }
5662 if (!FirstIter) {
5763 // Consecutive instructions with different RAState means we need to
@@ -62,7 +68,6 @@ void InsertNegateRAState::runOnFunction(BinaryFunction &BF) {
6268 } else {
6369 FirstIter = false ;
6470 }
65- PrevInst = *It;
6671 PrevRAState = *RAState;
6772 }
6873 }
@@ -90,6 +95,7 @@ void InsertNegateRAState::coverFunctionFragmentStart(BinaryFunction &BF,
9095 if (!RAState) {
9196 BC.errs () << " BOLT-ERROR: unknown RAState after inferUnknownStates "
9297 << " in function " << BF.getPrintName () << " \n " ;
98+ PassFailed = true ;
9399 return ;
94100 }
95101 if (*RAState)
@@ -151,6 +157,8 @@ Error InsertNegateRAState::runOnFunctions(BinaryContext &BC) {
151157 << " functions "
152158 << format (" (%.2lf%%).\n " , (100.0 * FunctionsModified) /
153159 BC.getBinaryFunctions ().size ());
160+ if (PassFailed)
161+ return createFatalBOLTError (" " );
154162 return Error::success ();
155163}
156164
0 commit comments