[SCCP] Don't check for UndefValue before calling markConstant()
authorNikita Popov <npopov@redhat.com>
Wed, 22 Jun 2022 09:27:58 +0000 (11:27 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 14 Jul 2022 08:05:56 +0000 (10:05 +0200)
commit6db3edc8588c036680a8696e1735ffc52cb57156
tree789081cf8fa80f2ae42a88a4944090cf434bab26
parentcef349a3c8b873f3a3f7a5f8ff33a63a1092d63f
[SCCP] Don't check for UndefValue before calling markConstant()

The value lattice explicitly represents undef, and markConstant()
internally checks for UndefValue and will create an undef rather
than constant lattice element in that case.

This is mostly a code simplification, it has little practical impact
because we usually get undef results from undef operands, and those
don't get processed.

Only leave the check behind for the CmpInst case, because it
currently goes through this incorrect code in the getCompare()
implementation: https://github.com/llvm/llvm-project/blob/f98697642cea761448dc0f84f750d3f5def8af6b/llvm/include/llvm/Analysis/ValueLattice.h#L456-L457

Differential Revision: https://reviews.llvm.org/D128330
llvm/lib/Transforms/Utils/SCCPSolver.cpp
llvm/test/Transforms/SCCP/undef-resolve.ll