[PATCH] D126962: [SCCP] Don't mark edges feasible when resolving undefs

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 06:33:55 PDT 2022


nikic created this revision.
nikic added a reviewer: 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.

As branch on undef is immediate undefined behavior, there is no need to mark one of the edges as feasible. We can leave all the edges non-feasible. In IPSCCP, we can replace the branch with an unreachable terminator.

Unfortunately, while this does make undef resolution much simpler, we do still need the other part of it (which marks instructions as overdefined). I think what we currently do there is somewhat non-optimal, but having some kind of undef resolution phase is probably not avoidable.


https://reviews.llvm.org/D126962

Files:
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/lib/Transforms/Utils/SCCPSolver.cpp
  llvm/test/Transforms/FunctionSpecialization/bug52821-use-after-free.ll
  llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll
  llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
  llvm/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
  llvm/test/Transforms/SCCP/PR26044.ll
  llvm/test/Transforms/SCCP/indirectbr.ll
  llvm/test/Transforms/SCCP/ipsccp-branch-unresolved-undef.ll
  llvm/test/Transforms/SCCP/return-zapped.ll
  llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
  llvm/test/Transforms/SCCP/switch-undef-constantfoldterminator.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126962.434010.patch
Type: text/x-patch
Size: 19554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220603/fcd9a680/attachment.bin>


More information about the llvm-commits mailing list