[PATCH] D143256: [SDAG] Check fminnum for non zero operand.
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Feb  6 07:21:44 PST 2023
    
    
  
spatel added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7980
 
+  auto IsConstantNonZero = [](SDValue N) {
+    if (auto *Input = dyn_cast<ConstantFPSDNode>(N))
----------------
samparker wrote:
> spatel wrote:
> > spatel wrote:
> > > Is this different than 
> > >   auto *C = isConstOrConstSplatFP(N));
> > >   return C && C->isZero();
> > > 
> > Oops - invert that isZero() result (we're looking for non-zero constant).
> For splats, I think your suggestion would work, and that's what I originally tried to do... but it doesn't work for the BUILD_VECTOR case, where we need to check if //any// element is a zero.
Ah, right. It looks like we do have the basic call already:
SelectionDAG::isKnownNeverZeroFloat().
...and it has a TODO comment about handling a vector constant, so just append that part there?
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143256/new/
https://reviews.llvm.org/D143256
    
    
More information about the llvm-commits
mailing list