Skip to content

Commit

Permalink
MachineLICM: Remove unnecessary isReg checks
Browse files Browse the repository at this point in the history
COPY operands are always registers.
  • Loading branch information
arsenm committed Apr 30, 2024
1 parent a9c73f6 commit 114a59d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions llvm/lib/CodeGen/MachineLICM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,9 +1265,8 @@ bool MachineLICMBase::IsProfitableToHoist(MachineInstr &MI,
// If we have a COPY with other uses in the loop, hoist to allow the users to
// also be hoisted.
Register DefReg;
if (MI.isCopy() && MI.getOperand(0).isReg() &&
(DefReg = MI.getOperand(0).getReg()).isVirtual() &&
MI.getOperand(1).isReg() && MI.getOperand(1).getReg().isVirtual() &&
if (MI.isCopy() && (DefReg = MI.getOperand(0).getReg()).isVirtual() &&
MI.getOperand(1).getReg().isVirtual() &&
IsLoopInvariantInst(MI, CurLoop) &&
any_of(MRI->use_nodbg_instructions(MI.getOperand(0).getReg()),
[&CurLoop, this, DefReg, Cost](MachineInstr &UseMI) {
Expand Down

0 comments on commit 114a59d

Please sign in to comment.