[llvm] 114a59d - MachineLICM: Remove unnecessary isReg checks

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 08:44:52 PDT 2024


Author: Matt Arsenault
Date: 2024-04-30T17:44:45+02:00
New Revision: 114a59d4d3743257d7cfdf94a7124060f04cc0db

URL: https://github.com/llvm/llvm-project/commit/114a59d4d3743257d7cfdf94a7124060f04cc0db
DIFF: https://github.com/llvm/llvm-project/commit/114a59d4d3743257d7cfdf94a7124060f04cc0db.diff

LOG: MachineLICM: Remove unnecessary isReg checks

COPY operands are always registers.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineLICM.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 997f6eb085129d..d569a082cebe06 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -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) {


        


More information about the llvm-commits mailing list