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

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Sat May 25 08:42:19 PDT 2024


================
@@ -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); };
----------------
tschuett wrote:

It was mainly motivated by stylish/debugging. The better question is: is the code reachable or dead?

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


More information about the llvm-commits mailing list