[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:58:24 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:

> It can't point at a specific constant in the non-splat case.

I'd expect it to point at the whole vector-typed `Constant`.

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


More information about the llvm-commits mailing list