[llvm] 5bc36c8 - [X86] Add necessary check isReg() when updating LiveVariables in convertToThreeAddress

Bing1 Yu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 05:12:13 PST 2022


Author: Bing1 Yu
Date: 2022-11-10T21:12:00+08:00
New Revision: 5bc36c8cb483413bc127960552cd00f168475fc0

URL: https://github.com/llvm/llvm-project/commit/5bc36c8cb483413bc127960552cd00f168475fc0
DIFF: https://github.com/llvm/llvm-project/commit/5bc36c8cb483413bc127960552cd00f168475fc0.diff

LOG: [X86] Add necessary check isReg() when updating LiveVariables in convertToThreeAddress

Reviewed By: RKSimon

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

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86InstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 4668a35c76cb..51fb860c67a9 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -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);
     }
   }


        


More information about the llvm-commits mailing list