[llvm] [X86][APX] Reset SubReg for dst and check isVirtual before getInterval/getPhys (PR #191765)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 22:58:01 PDT 2026


================
@@ -1106,8 +1106,11 @@ foldMemoryOperand(ArrayRef<std::pair<MachineInstr *, unsigned>> Ops,
       LIS.InsertMachineInstrInMaps(MI);
 
   if (CopyMI) {
-    LiveInterval &LI = LIS.getInterval(CopyMI->getOperand(1).getReg());
-    LIS.shrinkToUses(&LI);
+    Register R = CopyMI->getOperand(1).getReg();
----------------
phoebewang wrote:

It comes from register-coalescer. Before:
```
192B      %10:gr64 = COPY $rsp
208B      %0:gr64 = SUB64rr_ND killed %10:gr64, %9:gr64, implicit-def dead $eflags
224B      $rsp = COPY %0:gr64
```
After
```
208B      %0:gr64 = SUB64rr_ND $rsp, %9:gr64, implicit-def dead $eflags
224B      $rsp = COPY %0:gr64
```

Maybe it should do one bit more to
```
208B      $rsp = SUB64rr_ND $rsp, %9:gr64, implicit-def dead $eflags
224B      %0:gr64 = COPY $rsp
```

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


More information about the llvm-commits mailing list