[llvm-dev] DAG Combines that drop flags

Nemanja Ivanovic via llvm-dev llvm-dev at lists.llvm.org
Wed May 13 10:17:14 PDT 2020


While fixing something, I discovered that the DAG combiner will drop the
flags from ISD::FMAXNUM if it is swapping operands to canonicalize the
constant operand on the RHS.
That is presumably because of this code in the DAG combiner:
  // Canonicalize to constant on RHS.
  if (isConstantFPBuildVectorOrConstantFP(N0) &&
      !isConstantFPBuildVectorOrConstantFP(N1))
    return DAG.getNode(N->getOpcode(), SDLoc(N), VT, N1, N0);

As a result, the DAG transformations that are applied to something like
call fast <4 x float> @llvm.maxnum.v4f32(<4 x float> %3, <4 x float>
zeroinitializer)
vs.
call fast <4 x float> @llvm.maxnum.v4f32(<4 x float> zeroinitializer, <4 x
float> %3)
will be very different.

I wanted to get some opinions on how prevalent this is and whether there is
any effort ongoing to fix it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200513/0cb6873b/attachment.html>


More information about the llvm-dev mailing list