[llvm] [TII] Split isTrivialReMaterializable into two versions [nfc] (PR #160377)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 07:43:39 PDT 2025


================
@@ -2212,11 +2212,7 @@ findPrologueEndLoc(const MachineFunction *MF) {
       -> std::optional<std::pair<const MachineInstr *, bool>> {
     // Is this instruction trivial data shuffling or frame-setup?
     bool isCopy = (TII.isCopyInstr(MI) ? true : false);
-    bool isTrivRemat =
-        TII.isTriviallyReMaterializable(MI) &&
-        llvm::all_of(MI.all_uses(), [](const MachineOperand &MO) {
-          return MO.getReg().isVirtual();
-        });
+    bool isTrivRemat = TII.isTriviallyReMaterializable(MI);
----------------
preames wrote:

Ah, you are completely correct.  Oops.  This was a major bug in https://github.com/llvm/llvm-project/pull/160319.  The check should have been "are all of the operands not a virtual register", but this is not what actually got written and landed.  

I think this change accidentally fixed this (by doing what the intention had been all along), but boy does that make both patch descriptions misleading.  Do you think this is worth a revert-and-reapply on both?  

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


More information about the llvm-commits mailing list