[llvm] [InstCombine] Fold (X * 0.0) * constant => X * 0.0 #85241 (PR #92512)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 04:52:39 PDT 2024


================
@@ -905,6 +905,16 @@ Instruction *InstCombinerImpl::visitFMul(BinaryOperator &I) {
     }
   }
 
+  // (X * 0.0) * constant => X * 0.0
+  Constant *C1;
+  if (match(Op0, m_FMul(m_Value(X), m_Constant(C1))) &&
+      match(C1, m_AnyZeroFP()) && match(Op1, m_Constant(C))) {
----------------
arsenm wrote:

The match of C1 to m_AnyZeroFP is redundant, you can just directly check m_AnyZeroFP where you first matched C1 

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


More information about the llvm-commits mailing list