[PATCH] D68265: [InstCombine] Simplify fma multiplication to nan for undef or nan operands.

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 14:51:52 PDT 2019


cameron.mcinally added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4612
   if (FMF.noNaNs() && FMF.noSignedZeros() && match(Op0, m_AnyZeroFP()))
     return ConstantFP::getNullValue(Op1->getType());
 
----------------
spatel wrote:
> cameron.mcinally wrote:
> > fhahn wrote:
> > > cameron.mcinally wrote:
> > > > Side note: these 2 transforms are not correct for X=Inf. I believe that they should return a QNaN in that case.
> > > Yep thanks, I think we are missing `FMF.noInfs`, right?
> > I think that's right.
> > 
> > I'm a little swamped on other projects right now, but I can add it to my TODO list if you'd like. Your call.
> The reasoning here and in at least 1 other fold in instsimplify that I know of is relying on the definition provided in the LangRef:
> "Allow optimizations to assume the arguments and result are not NaN"
> 
> 0 * Inf produces NaN, but that's not an allowable result because of the 'nnan' on this fmul. Therefore, an infinity input can be implicitly disregarded.
> 
> 
Oh, that does make sense. Thanks for the clarification. And sorry for the noise.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68265





More information about the llvm-commits mailing list