[llvm] c549da9 - [BranchRelaxation] Move faulting_op check into callee [nfc]
    Philip Reames via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Jan 27 11:24:41 PST 2023
    
    
  
Author: Philip Reames
Date: 2023-01-27T11:24:34-08:00
New Revision: c549da959b81902789a17918c5b95d4449e6fdfa
URL: https://github.com/llvm/llvm-project/commit/c549da959b81902789a17918c5b95d4449e6fdfa
DIFF: https://github.com/llvm/llvm-project/commit/c549da959b81902789a17918c5b95d4449e6fdfa.diff
LOG: [BranchRelaxation] Move faulting_op check into callee [nfc]
Mostly to remove a special case from an upcoming patch.
Added: 
    
Modified: 
    llvm/lib/CodeGen/BranchRelaxation.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/lib/CodeGen/BranchRelaxation.cpp b/llvm/lib/CodeGen/BranchRelaxation.cpp
index 016c81dc5aa4..81d13617c37b 100644
--- a/llvm/lib/CodeGen/BranchRelaxation.cpp
+++ b/llvm/lib/CodeGen/BranchRelaxation.cpp
@@ -284,6 +284,12 @@ MachineBasicBlock *BranchRelaxation::splitBlockBeforeInstr(MachineInstr &MI,
 /// specific BB can fit in MI's displacement field.
 bool BranchRelaxation::isBlockInRange(
   const MachineInstr &MI, const MachineBasicBlock &DestBB) const {
+
+  // FAULTING_OP's destination is not encoded in the instruction stream
+  // and thus always in range.
+  if (MI.getOpcode() == TargetOpcode::FAULTING_OP)
+    return true;
+
   int64_t BrOffset = getInstrOffset(MI);
   int64_t DestOffset = BlockInfo[DestBB.getNumber()].Offset;
 
@@ -558,11 +564,6 @@ bool BranchRelaxation::relaxBranchInstructions() {
       if (!MI.isConditionalBranch())
         continue;
 
-      if (MI.getOpcode() == TargetOpcode::FAULTING_OP)
-        // FAULTING_OP's destination is not encoded in the instruction stream
-        // and thus never needs relaxed.
-        continue;
-
       MachineBasicBlock *DestBB = TII->getBranchDestBlock(MI);
       if (!isBlockInRange(MI, *DestBB)) {
         if (Next != MBB.end() && Next->isConditionalBranch()) {
        
    
    
More information about the llvm-commits
mailing list