[llvm] [AMDGPU] clang-tidy: no else after return etc. NFC. (PR #99298)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 13:10:56 PDT 2024


================
@@ -739,38 +740,36 @@ unsigned R600InstrInfo::insertBranch(MachineBasicBlock &MBB,
     if (Cond.empty()) {
       BuildMI(&MBB, DL, get(R600::JUMP)).addMBB(TBB);
       return 1;
-    } else {
-      MachineInstr *PredSet = findFirstPredicateSetterFrom(MBB, MBB.end());
-      assert(PredSet && "No previous predicate !");
-      addFlag(*PredSet, 0, MO_FLAG_PUSH);
-      PredSet->getOperand(2).setImm(Cond[1].getImm());
-
-      BuildMI(&MBB, DL, get(R600::JUMP_COND))
-             .addMBB(TBB)
-             .addReg(R600::PREDICATE_BIT, RegState::Kill);
-      MachineBasicBlock::iterator CfAlu = FindLastAluClause(MBB);
-      if (CfAlu == MBB.end())
-        return 1;
-      assert (CfAlu->getOpcode() == R600::CF_ALU);
-      CfAlu->setDesc(get(R600::CF_ALU_PUSH_BEFORE));
-      return 1;
     }
-  } else {
     MachineInstr *PredSet = findFirstPredicateSetterFrom(MBB, MBB.end());
     assert(PredSet && "No previous predicate !");
     addFlag(*PredSet, 0, MO_FLAG_PUSH);
     PredSet->getOperand(2).setImm(Cond[1].getImm());
+
     BuildMI(&MBB, DL, get(R600::JUMP_COND))
-            .addMBB(TBB)
-            .addReg(R600::PREDICATE_BIT, RegState::Kill);
-    BuildMI(&MBB, DL, get(R600::JUMP)).addMBB(FBB);
+        .addMBB(TBB)
+        .addReg(R600::PREDICATE_BIT, RegState::Kill);
     MachineBasicBlock::iterator CfAlu = FindLastAluClause(MBB);
     if (CfAlu == MBB.end())
-      return 2;
+      return 1;
----------------
jayfoad wrote:

Yeah, you can get a more readable diff for that part if you select "Hide whitespace" under the gear wheel icon at the top of the whole diff.

https://github.com/llvm/llvm-project/pull/99298


More information about the llvm-commits mailing list