[X86] Add necessary check isReg() when updating LiveVariables in convertToThreeAddress
authorBing1 Yu <bing1.yu@intel.com>
Fri, 4 Nov 2022 06:20:43 +0000 (14:20 +0800)
committerBing1 Yu <bing1.yu@intel.com>
Thu, 10 Nov 2022 13:12:00 +0000 (21:12 +0800)
Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D137388

llvm/lib/Target/X86/X86InstrInfo.cpp

index 4668a35..51fb860 100644 (file)
@@ -1768,7 +1768,7 @@ MachineInstr *X86InstrInfo::convertToThreeAddress(MachineInstr &MI,
   if (LV) {  // Update live variables
     for (unsigned I = 0; I < NumRegOperands; ++I) {
       MachineOperand &Op = MI.getOperand(I);
-      if (Op.isDead() || Op.isKill())
+      if (Op.isReg() && (Op.isDead() || Op.isKill()))
         LV->replaceKillInstruction(Op.getReg(), MI, *NewMI);
     }
   }