[PATCH] D128330: [SCCP] Don't check for UndefValue before calling markConstant()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 02:54:21 PDT 2022


nikic created this revision.
nikic added reviewers: efriedma, fhahn.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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

Depends on D128251 <https://reviews.llvm.org/D128251>.


https://reviews.llvm.org/D128330

Files:
  llvm/lib/Transforms/Utils/SCCPSolver.cpp
  llvm/test/Transforms/SCCP/undef-resolve.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128330.438956.patch
Type: text/x-patch
Size: 3702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220622/a1cd8d79/attachment.bin>


More information about the llvm-commits mailing list