[llvm] [CodeGen][NFC] Guard copy propogation in machine CSE against undefs (PR #97413)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 06:10:08 PDT 2024


================
@@ -184,7 +184,7 @@ bool MachineCSE::PerformTrivialCopyPropagation(MachineInstr *MI,
       continue;
     bool OnlyOneUse = MRI->hasOneNonDBGUse(Reg);
     MachineInstr *DefMI = MRI->getVRegDef(Reg);
-    if (!DefMI->isCopy())
+    if (!DefMI || !DefMI->isCopy())
----------------
arsenm wrote:

I think it would be better if we moved towards making undef operands a verifier error for SSA MIR. These undefined reg checks really should be unnecessary 

https://github.com/llvm/llvm-project/pull/97413


More information about the llvm-commits mailing list