Skip to content

Commit c549da9

Browse files
committed
[BranchRelaxation] Move faulting_op check into callee [nfc]
Mostly to remove a special case from an upcoming patch.
1 parent 0eff46f commit c549da9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/CodeGen/BranchRelaxation.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ MachineBasicBlock *BranchRelaxation::splitBlockBeforeInstr(MachineInstr &MI,
284284
/// specific BB can fit in MI's displacement field.
285285
bool BranchRelaxation::isBlockInRange(
286286
const MachineInstr &MI, const MachineBasicBlock &DestBB) const {
287+
288+
// FAULTING_OP's destination is not encoded in the instruction stream
289+
// and thus always in range.
290+
if (MI.getOpcode() == TargetOpcode::FAULTING_OP)
291+
return true;
292+
287293
int64_t BrOffset = getInstrOffset(MI);
288294
int64_t DestOffset = BlockInfo[DestBB.getNumber()].Offset;
289295

@@ -558,11 +564,6 @@ bool BranchRelaxation::relaxBranchInstructions() {
558564
if (!MI.isConditionalBranch())
559565
continue;
560566

561-
if (MI.getOpcode() == TargetOpcode::FAULTING_OP)
562-
// FAULTING_OP's destination is not encoded in the instruction stream
563-
// and thus never needs relaxed.
564-
continue;
565-
566567
MachineBasicBlock *DestBB = TII->getBranchDestBlock(MI);
567568
if (!isBlockInRange(MI, *DestBB)) {
568569
if (Next != MBB.end() && Next->isConditionalBranch()) {

0 commit comments

Comments
 (0)