Skip to content

Commit d1f66f7

Browse files
committed
[BOLT] Bugfix: use getFirstNonPseudo() instead of begin()
RA states are only assigned to non-pseudo instructions. Because of this, CFI instructions are skipped. Here, I incorrectly used begin(), not skipping CFIs.
1 parent a873e78 commit d1f66f7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bolt/lib/Passes/InsertNegateRAStatePass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ void InsertNegateRAState::coverFunctionFragmentStart(BinaryFunction &BF,
9191
});
9292
// If a function is already split in the input, the first FF can also start
9393
// with Signed state. This covers that scenario as well.
94-
auto RAState = BC.MIB->getRAState(*(*FirstNonEmpty)->begin());
94+
auto II = (*FirstNonEmpty)->getFirstNonPseudo();
95+
auto RAState = BC.MIB->getRAState(*II);
9596
if (!RAState) {
9697
BC.errs() << "BOLT-ERROR: unknown RAState after inferUnknownStates "
9798
<< " in function " << BF.getPrintName() << "\n";
9899
PassFailed = true;
99100
return;
100101
}
101102
if (*RAState)
102-
BF.addCFIInstruction(*FirstNonEmpty, (*FirstNonEmpty)->begin(),
103+
BF.addCFIInstruction(*FirstNonEmpty, II,
103104
MCCFIInstruction::createNegateRAState(nullptr));
104105
}
105106

0 commit comments

Comments
 (0)