[llvm] [LiveVariables] Mark use as implicit-def if def is a subregister (PR #119446)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 01:27:24 PST 2024


================
@@ -277,11 +277,22 @@ void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) {
           continue;
         if (PartDefRegs.count(SubReg))
           continue;
+
+        // Check if SubReg is defined at LastPartialDef.
+        bool IsDefinedHere = false;
+        for (int I = 0; I < LastPartialDef->getNumOperands(); ++I) {
----------------
jofrn wrote:

The parent function, `LiveVariables::HandlePhysRegUse`, will additionally collect definitions of `Reg` (e.g. four `COPY` instructions for a use of `$sgpr0_$sgpr1_$sgpr2_sgpr3` in a subsequent instruction), and mark the last definition with its implicit uses and defs.

`modifiesRegister` can be used here in place of this loop.

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


More information about the llvm-commits mailing list