[llvm] [RISCV][NFC] Prepare for Short Forward Branch of branches with immediates (PR #182456)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 13:58:42 PST 2026


================
@@ -216,14 +216,15 @@ bool RISCVExpandPseudo::expandCCOp(MachineBasicBlock &MBB,
 
   // We want to copy the "true" value when the condition is true which means
   // we need to invert the branch condition to jump over TrueBB when the
-  // condition is false.
-  auto CC = static_cast<RISCVCC::CondCode>(MI.getOperand(3).getImm());
-  CC = RISCVCC::getInverseBranchCondition(CC);
+  // condition is false. We can directly use the branch opcode which has been
+  // inverted when SDNodeXform transforms were applied on it.
----------------
lenary wrote:

Can you rewrite this comment? Maybe something like:
```
// We want to copy the "true" value only when the branch is executed.
// The SDNodeXform is responsible for the inversion.
```

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


More information about the llvm-commits mailing list