[PATCH] D47026: [DAG] fold FP binops with undef operands to NaN

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 12:46:34 PDT 2018


spatel created this revision.
spatel added reviewers: efriedma, RKSimon, arsenm, jlebar, mcberg2017, craig.topper.
Herald added subscribers: kristof.beyls, tpr, nhaehnle, wdng, mcrosier, jholewinski.
Herald added a reviewer: javed.absar.

This is the FP sibling of https://reviews.llvm.org/D43141 with the corresponding IR change in https://reviews.llvm.org/rL327212.

We can't propagate undef here because if a variable operand is a NaN, these binops must propagate NaN. Neither global nor node-level fast-math makes a difference. If we have 'nnan', I think later folds can turn the NaN into undef.

The tests in X86/fp-undef.ll are meant to be the definitive verification for these folds - everything reduces identically now.

The other test changes are collateral damage that I wasn't sure what to do with (see the many test changes I committed in the last day for attempts to preserve functionality independently of this change).

Let me describe those test diffs, and someone with a better understanding may be able to fix those tests:
AArch64/fcvt_combine.ll - we constant folded the fmul, not sure why the expectation was different
AMDGPU/mad-mix-lo.ll - don't know anything about what's happening here
NVPTX/implicit-def.ll - this isn't testing what it intended to test, but I don't know how to do that...could just delete the file?
X86/pr23103.ll - this isn't testing what it intended to test, but I don't know how to do that...could just delete the file?
X86/vector-reduce-fadd.ll and X86/vector-reduce-fmul.ll - I think all of these diffs are the unexpected case where the accumulator param is supposed to be used because it's a strict reduction, but we're passing in undef. Just verifies that we don't crash?
http://llvm.org/docs/LangRef.html#llvm-experimental-vector-reduce-fadd-intrinsic


https://reviews.llvm.org/D47026

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  test/CodeGen/AArch64/fcvt_combine.ll
  test/CodeGen/AMDGPU/mad-mix-lo.ll
  test/CodeGen/NVPTX/implicit-def.ll
  test/CodeGen/X86/fp-undef.ll
  test/CodeGen/X86/pr23103.ll
  test/CodeGen/X86/vector-reduce-fadd.ll
  test/CodeGen/X86/vector-reduce-fmul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47026.147370.patch
Type: text/x-patch
Size: 54984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180517/5bf0f10a/attachment.bin>


More information about the llvm-commits mailing list