[PATCH] D67553: [InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 07:47:48 PDT 2019


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4561
                               const SimplifyQuery &Q, unsigned MaxRecurse) {
   // fmul X, 1.0 ==> X
   if (match(Op1, m_FPOne()))
----------------
lebedev.ri wrote:
> I'm wondering if 
> ```
> {
> if(isa<Constant>(Op0)) std::swap(Op0, Op1);
> ```
> would be simpler?
I initially also used to swap the operands, but we'd also have to check if it's a 1.1 or 0.0 constant I think, to handle `fmul 10.0, 0.0`. That's not a problem with SimplifyFMulInst, as constant folding would cover this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67553/new/

https://reviews.llvm.org/D67553





More information about the llvm-commits mailing list