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

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 04:23:54 PST 2024


================
@@ -277,11 +277,13 @@ void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) {
           continue;
         if (PartDefRegs.count(SubReg))
           continue;
+
+        // Check if SubReg is defined at LastPartialDef.
+        bool IsDefinedHere = LastPartialDef->modifiesRegister(SubReg, TRI);
         // This part of Reg was defined before the last partial def. It's killed
         // here.
-        LastPartialDef->addOperand(MachineOperand::CreateReg(SubReg,
-                                                             false/*IsDef*/,
-                                                             true/*IsImp*/));
+        LastPartialDef->addOperand(
+            MachineOperand::CreateReg(SubReg, IsDefinedHere, true /*IsImp*/));
----------------
jofrn wrote:

Removed a chunk of the code, which also got rid of `w2_hi`, so now it doesn't have a kill point... Need to take a closer look at it to see if we can keep `w2_hi` here.

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


More information about the llvm-commits mailing list