[llvm] [NFC][AArch64] ConditionOptimizer: replace hardcoded CC switch with TII hook (PR #188389)
Hussam Alhassan via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 03:16:41 PDT 2026
================
@@ -375,20 +376,9 @@ void AArch64ConditionOptimizerImpl::updateCmpInstr(MachineInstr *CmpMI,
// Modifies the condition code of a conditional instruction.
void AArch64ConditionOptimizerImpl::updateCondInstr(MachineInstr *CondMI,
AArch64CC::CondCode NewCC) {
- // Get the correct operand index for the conditional instruction
- unsigned CondOpIdx;
- switch (CondMI->getOpcode()) {
- case AArch64::Bcc:
- CondOpIdx = 0;
- break;
- case AArch64::CSINCWr:
- case AArch64::CSINCXr:
- CondOpIdx = 3;
- break;
- default:
- llvm_unreachable("Unsupported conditional instruction");
- }
- CondMI->getOperand(CondOpIdx).setImm(NewCC);
+ int CCOpIdx = TII->findCondCodeOpIdx(*CondMI);
----------------
hussam-alhassan wrote:
We could promote it to a static class member and update the other call sites, in which case should I also rename it to the shorter name anyways?
https://github.com/llvm/llvm-project/pull/188389
More information about the llvm-commits
mailing list