[PATCH] D87571: [DAGCombiner] Fold fmin/fmax with INF

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 13:44:17 PDT 2020


nikic marked 3 inline comments as done.
nikic added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14080-14082
   if (isConstantFPBuildVectorOrConstantFP(N0) &&
       !isConstantFPBuildVectorOrConstantFP(N1))
     return DAG.getNode(N->getOpcode(), SDLoc(N), VT, N1, N0);
----------------
spatel wrote:
> There's a bug here that should be addressed first (probably lacking test coverage) - we dropped the FMF when creating the new node.
> It would be more efficient to std::swap(N0, N1) and just use those local names in all of the later code?
I added some tests with nnan and commuted operands. Turns out that for the scalar case this canonicalization happens somewhere else already (maybe node building already handles it?) and this code only affects the vector constant case.

I've kept the code (with fmf propagation) as the same canonicalization seems to also be done for other commutative nodes.


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

https://reviews.llvm.org/D87571



More information about the llvm-commits mailing list