[llvm] [GISel][CombinerHelper] Push freeze through non-poison-producing operands (PR #90618)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 13:29:55 PDT 2024


================
@@ -223,6 +223,64 @@ void CombinerHelper::applyCombineCopy(MachineInstr &MI) {
   replaceRegWith(MRI, DstReg, SrcReg);
 }
 
+bool CombinerHelper::matchFreezeOfSingleMaybePoisonOperand(
+    MachineInstr &MI, BuildFnTy &MatchInfo) {
+  // Ported from InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating
+  Register DstOp = MI.getOperand(0).getReg();
+  Register OrigOp = MI.getOperand(1).getReg();
+
+  if (!MRI.hasOneNonDBGUse(OrigOp))
----------------
arsenm wrote:

There's a PR open to add a dedicated hasOneUse check to patterns 

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


More information about the llvm-commits mailing list