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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 05:10:50 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))) {
----------------
jayfoad wrote:

`m_AnyZeroFP` doesn't capture so you can't write `m_AnyZeroFP(C1)`. But it probably should.

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


More information about the llvm-commits mailing list