[DAG] make binops with undef operands consistent with IR
authorSanjay Patel <spatel@rotateright.com>
Mon, 12 Feb 2018 21:37:27 +0000 (21:37 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 12 Feb 2018 21:37:27 +0000 (21:37 +0000)
commit014c000f6aa84528dfe492bfb02a04ef2993b98c
treed1b3dfbdb8ab99e9ffcb16d366cbc6d451d1eb35
parente7ed8807615e75f8f76d2c5c76b52b59e9a1fdcc
[DAG] make binops with undef operands consistent with IR

This started by noticing that scalar and vector types were producing different results with div ops in PR36305:
https://bugs.llvm.org/show_bug.cgi?id=36305

...but the problem is bigger. I couldn't keep it straight without a table, so I'm attaching that as a PDF to
the review. The x86 tests in undef-ops.ll correspond to that table.

Green means that instsimplify and the DAG agree on the result for all types.
Red means the DAG was returning undef when IR was not.
Yellow means the DAG was returning a non-undef result when IR returned undef.

This patch assumes that we're currently doing the right thing in IR.

Note: I couldn't find any problems with lowering vector constants as the code comments were warning,
but those comments were written long ago in rL36413 .

Differential Revision: https://reviews.llvm.org/D43141

llvm-svn: 324941
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/Hexagon/tail-dup-subreg-map.ll
llvm/test/CodeGen/X86/pr13577.ll
llvm/test/CodeGen/X86/pr33960.ll
llvm/test/CodeGen/X86/undef-ops.ll