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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 13:42:30 PDT 2024


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

Can you move this up, and combine with the existing handling of x * 0 -> copysign(0, x) 

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


More information about the llvm-commits mailing list