[llvm] [AMDGPU][GISel] Fold 'min(min(x,y),z)' and 'max(max(x,y),z)' into min3 and max3 (PR #200410)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 06:05:34 PDT 2026


================
@@ -519,10 +519,10 @@ bool AMDGPURegBankCombinerImpl::matchMinMaxToMinMax3(
     return false;
 
   Register R0, R1, R2;
-  auto P1 = m_BinOp(Opc, m_OneNonDBGUse(m_BinOp(Opc, m_Reg(R0), m_Reg(R1))),
+  auto P1 = m_CommutativeBinOp(Opc, m_OneNonDBGUse(m_CommutativeBinOp(Opc, m_Reg(R0), m_Reg(R1))),
----------------
petar-avramovic wrote:

the point was to use one matcher, commutative one should match both a b and b a

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


More information about the llvm-commits mailing list