Skip to content

Commit 43b12cd

Browse files
committed
[BOLT] Fixes
1 parent 4137a0c commit 43b12cd

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

bolt/lib/Passes/InsertNegateRAStatePass.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ InsertNegateRAState::getFirstKnownRAState(BinaryContext &BC,
124124
for (const MCInst &Inst : BB) {
125125
if (BC.MIB->isCFI(Inst))
126126
continue;
127-
std::optional<bool> RAStateOpt = BC.MIB->getRAState(Inst);
128-
if (RAStateOpt.has_value())
129-
return RAStateOpt;
127+
std::optional<bool> RAState = BC.MIB->getRAState(Inst);
128+
if (RAState.has_value())
129+
return RAState;
130130
}
131131
return std::nullopt;
132132
}
@@ -139,10 +139,10 @@ void InsertNegateRAState::fillUnknownStateInBB(BinaryContext &BC,
139139
return;
140140
// If the first instruction has unknown RAState, we should copy the first
141141
// known RAState.
142-
std::optional<bool> RAStateOpt = BC.MIB->getRAState(*First);
143-
if (!RAStateOpt.has_value()) {
144-
auto FirstRAState = getFirstKnownRAState(BC, BB);
145-
if (!FirstRAState)
142+
std::optional<bool> RAState = BC.MIB->getRAState(*First);
143+
if (!RAState.has_value()) {
144+
std::optional<bool> FirstRAState = getFirstKnownRAState(BC, BB);
145+
if (!FirstRAState.has_value())
146146
// We fill unknown BBs later.
147147
return;
148148

@@ -162,8 +162,8 @@ void InsertNegateRAState::fillUnknownStateInBB(BinaryContext &BC,
162162
// previous instruction in the previous iteration of the loop.
163163
std::optional<bool> PrevRAState = BC.MIB->getRAState(Prev);
164164

165-
auto RAState = BC.MIB->getRAState(Inst);
166-
if (!RAState) {
165+
std::optional<bool> RAState = BC.MIB->getRAState(Inst);
166+
if (!RAState.has_value()) {
167167
if (BC.MIB->isPSignOnLR(Prev))
168168
PrevRAState = true;
169169
else if (BC.MIB->isPAuthOnLR(Prev))
@@ -206,10 +206,10 @@ void InsertNegateRAState::fillUnknownStubs(BinaryFunction &BF) {
206206
for (FunctionFragment &FF : BF.getLayout().fragments()) {
207207
for (BinaryBasicBlock *BB : FF) {
208208
if (!FirstIter && isUnknownBlock(BC, *BB)) {
209-
// As exlained in issue #160989, the unwind info is incorrect for stubs.
210-
// Indicating the correct RAState without the rest of the unwind info
211-
// being correct is not useful. Instead, we copy the RAState from the
212-
// previous instruction.
209+
// As explained in issue #160989, the unwind info is incorrect for
210+
// stubs. Indicating the correct RAState without the rest of the unwind
211+
// info being correct is not useful. Instead, we copy the RAState from
212+
// the previous instruction.
213213
std::optional<bool> PrevRAState = BC.MIB->getRAState(PrevInst);
214214
if (!PrevRAState.has_value()) {
215215
llvm_unreachable(

0 commit comments

Comments
 (0)