[PATCH] D123394: [CodeGen] Late cleanup of redundant address/immediate definitions.

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 00:13:26 PST 2022


uabelho added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp:114-123
+      if (MO.isReg() && TRI->regsOverlap(MO.getReg(), Reg)) {
+        if (MO.isDef())
+          return;
+        if (MO.readsReg()) {
+          MO.setIsKill(false);
+          Found = true; // Keep going for an implicit kill of the super-reg.
+        }
----------------
I wonder if this won't abort too early? Or are we really guaranteed to find an implicit kill of the super-reg within this instruction if we find a kill of a sub-reg?

At least for my target I've found cases like
```
DEF superreg
USE killed subreg1
USE killed subreg2
DEF superreg
USE killed subreg1
```
and with the current implementation we get
```
DEF super reg
USE killed subreg1
USE subreg2
USE killed subreg1
```
and then the verifier complains on the second use of subreg1.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123394/new/

https://reviews.llvm.org/D123394



More information about the llvm-commits mailing list