Reapply [ValueLattice] Fix getCompare() for undef values
authorNikita Popov <npopov@redhat.com>
Tue, 1 Nov 2022 15:39:20 +0000 (16:39 +0100)
committerNikita Popov <npopov@redhat.com>
Wed, 2 Nov 2022 09:23:06 +0000 (10:23 +0100)
commit7ad3bb527e25eb0a9d147d2e93f9dca605c75688
tree343f3d052b11449a6626408cdfd4ed7c93c5e0a2
parent41dba9e6a3096d54de6005ef4e648af1ff02b90c
Reapply [ValueLattice] Fix getCompare() for undef values

Relative to the previous attempt, this also updates the
ValueLattice unit tests.

-----

Resolve the TODO about incorrect getCompare() behavior. This can
be made more precise (e.g. by materializing the undef value and
performing constant folding on it), but for now just return an
unknown result to fix the correctness issue.

This should be NFC in terms of user-visible behavior, because the
only user of this method (SCCP) was already guarding against
UndefValue results.
llvm/include/llvm/Analysis/ValueLattice.h
llvm/lib/Transforms/Utils/SCCPSolver.cpp
llvm/unittests/Analysis/ValueLatticeTest.cpp