[llvm] [GlobalIsel] Combine freeze (PR #93239)

Dhruv Chawla via llvm-commits llvm-commits at lists.llvm.org
Sat May 25 08:21:02 PDT 2024


Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/93239 at github.com>


================
@@ -265,11 +265,13 @@ bool CombinerHelper::matchFreezeOfSingleMaybePoisonOperand(
     }
   }
 
+  Observer.changingInstr(*OrigDef);
   cast<GenericMachineInstr>(OrigDef)->dropPoisonGeneratingFlags();
+  Observer.changedInstr(*OrigDef);
 
   // Eliminate freeze if all operands are guaranteed non-poison.
   if (!MaybePoisonOperand) {
-    MatchInfo = [=](MachineIRBuilder &B) { MRI.replaceRegWith(DstOp, OrigOp); };
+    MatchInfo = [=](MachineIRBuilder &B) { B.buildCopy(DstOp, OrigOp); };
----------------
dc03-work wrote:

Why the change to building a copy? Also, given that you're introducing something like this as a separate fold with this patch, maybe this can be removed?

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


More information about the llvm-commits mailing list