[llvm] [AMDGPU] Improve MIR pattern for FMinFMaxLegacy combine. NFC. (PR #90968)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 06:48:39 PDT 2024


================
@@ -159,17 +160,14 @@ bool AMDGPUPostLegalizerCombinerImpl::tryCombineAll(MachineInstr &MI) const {
 }
 
 bool AMDGPUPostLegalizerCombinerImpl::matchFMinFMaxLegacy(
-    MachineInstr &MI, FMinFMaxLegacyInfo &Info) const {
-  // FIXME: Type predicate on pattern
-  if (MRI.getType(MI.getOperand(0).getReg()) != LLT::scalar(32))
-    return false;
-
-  Register Cond = MI.getOperand(1).getReg();
-  if (!MRI.hasOneNonDBGUse(Cond) ||
-      !mi_match(Cond, MRI,
-                m_GFCmp(m_Pred(Info.Pred), m_Reg(Info.LHS), m_Reg(Info.RHS))))
+    MachineInstr &MI, MachineInstr &FCmp, FMinFMaxLegacyInfo &Info) const {
+  if (!MRI.hasOneNonDBGUse(FCmp.getOperand(0).getReg()))
----------------
jayfoad wrote:

> The G_FCMP could be used by other MIs.

I know. I would like to write something in the pattern to check for this, instead of writing C++ to check for this.

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


More information about the llvm-commits mailing list