[llvm] [LiveVariables] Mark use as implicit-def if defined at instr (PR #119446)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 12:25:16 PDT 2025


================
@@ -262,28 +249,12 @@ void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) {
     // ...
     //    = EAX
     // All of the sub-registers must have been defined before the use of Reg!
-    SmallSet<Register, 4> PartDefRegs;
-    MachineInstr *LastPartialDef = FindLastPartialDef(Reg, PartDefRegs);
+    // MachineInstr *LastPartialDef = FindLastPartialDef(Reg);
     // If LastPartialDef is NULL, it must be using a livein register.
-    if (LastPartialDef) {
-      LastPartialDef->addOperand(MachineOperand::CreateReg(Reg, true/*IsDef*/,
-                                                           true/*IsImp*/));
-      PhysRegDef[Reg.id()] = LastPartialDef;
-      SmallSet<MCPhysReg, 8> Processed;
-      for (MCPhysReg SubReg : TRI->subregs(Reg)) {
-        if (Processed.count(SubReg))
-          continue;
-        if (PartDefRegs.count(SubReg))
-          continue;
-        // This part of Reg was defined before the last partial def. It's killed
-        // here.
-        LastPartialDef->addOperand(MachineOperand::CreateReg(SubReg,
-                                                             false/*IsDef*/,
-                                                             true/*IsImp*/));
-        PhysRegDef[SubReg] = LastPartialDef;
-        Processed.insert_range(TRI->subregs(SubReg));
-      }
-    }
+    // if (LastPartialDef) {
+    //   LastPartialDef->addOperand(
+    //     MachineOperand::CreateReg(Reg, true /*IsDef*/, true /*IsImp*/));
+    // }
----------------
arsenm wrote:

The code is needed or not, leaving it commented out doesn't improve the situation 

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


More information about the llvm-commits mailing list