[ValueLattice] Add new state for undef constants.
authorFlorian Hahn <flo@fhahn.com>
Sat, 14 Mar 2020 16:50:09 +0000 (16:50 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 14 Mar 2020 17:19:59 +0000 (17:19 +0000)
commit4878aa36d4aa27df644430139fab2734fde4a000
treed63dc2c18ba3cfa68de668d9f269f8a58dae504d
parentb236b4cb430674a98917ad1b2fa9f7f9838e66f1
[ValueLattice] Add new state for undef constants.

This patch adds a new undef lattice state, which is used to represent
UndefValue constants or instructions producing undef.

The main difference to the unknown state is that merging undef values
with constants (or single element constant ranges) produces  the
constant/constant range, assuming all uses of the merge result will be
replaced by the found constant.

Contrary, merging non-single element ranges with undef needs to go to
overdefined. Using unknown for UndefValues currently causes mis-compiles
in CVP/LVI (PR44949) and will become problematic once we use
ValueLatticeElement for SCCP.

Reviewers: efriedma, reames, davide, nikic

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D75120
llvm/include/llvm/Analysis/ValueLattice.h
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/lib/Analysis/ValueLattice.cpp
llvm/lib/Transforms/Scalar/SCCP.cpp
llvm/test/Transforms/CorrelatedValuePropagation/merge-range-and-undef.ll
llvm/test/Transforms/JumpThreading/ne-undef.ll [new file with mode: 0644]
llvm/test/Transforms/SCCP/float-phis.ll [new file with mode: 0644]
llvm/test/Transforms/SCCP/int-phis.ll [new file with mode: 0644]