[PATCH] D74713: [ConstantFold] fold most FP ops with undef operand to undef rather than NaN

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 06:52:28 PST 2020


spatel created this revision.
spatel added reviewers: nlopes, lebedev.ri, arsenm, cameron.mcinally, efriedma.
Herald added subscribers: hiraditya, wdng, mcrosier.
Herald added a project: LLVM.

A question about this behavior came up on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139003.html
...and as part of backend improvements in D73978 <https://reviews.llvm.org/D73978>, but let's see if we can reach agreement on the transforms in IR first because we already have fairly thorough tests in place here.

If one constant operand to {fadd/fsub/fmul/fdiv/frem} is not {NaN/Inf/0.0/-0.0} and the other constant operand is undef, then we can choose 'undef' as some other value that changes all of the fields (sign, exponent, fraction) in the result FP value. Is that enough to say the result is undef?


https://reviews.llvm.org/D74713

Files:
  llvm/lib/IR/ConstantFold.cpp
  llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll
  llvm/test/Transforms/InstSimplify/fp-undef.ll
  llvm/test/Transforms/NewGVN/pr32607.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74713.244962.patch
Type: text/x-patch
Size: 10421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200217/49994e7d/attachment.bin>


More information about the llvm-commits mailing list