[PATCH] D111643: [ValueTracking] Let propgatesPoison consider single poison operand.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 06:54:56 PDT 2021


fhahn created this revision.
fhahn added reviewers: nikic, reames, nlopes, aqjune.
Herald added a subscriber: hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

This patch extends propgatesPoison to take an optional ValAssumedPoison
argument. If not nullptr, the passed value must be an operand of I. In
that case, propagatesPoison returns true, if I yields poison or raises
UB if ValAssumedPoison is poison.

This allows propagating poison if the condition of a select is poison.
Among other things, this helps improve results for
programUndefinedIfUndefOrPoison and allows removing special select
handling from directlyImpliesPoison.

Alive2 proofs for the changed instcombine tests:

  @land_land_left2  https://alive2.llvm.org/ce/z/SzzJpk
  @land_lor_left2   https://alive2.llvm.org/ce/z/U22JsD
  @lor_land_left2    https://alive2.llvm.org/ce/z/ZKvHkm
  @lor_lor_left2     https://alive2.llvm.org/ce/z/8mxLdQ


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111643

Files:
  llvm/include/llvm/Analysis/ValueTracking.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/unittests/Analysis/ValueTrackingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111643.379022.patch
Type: text/x-patch
Size: 6597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211012/d65d37e1/attachment.bin>


More information about the llvm-commits mailing list