[ValueTracking] Consider single poison operands in propgatesPoison.
authorFlorian Hahn <flo@fhahn.com>
Mon, 19 Dec 2022 11:47:51 +0000 (11:47 +0000)
committerFlorian Hahn <flo@fhahn.com>
Mon, 19 Dec 2022 11:47:51 +0000 (11:47 +0000)
commit8a3efcd40b48543d5b77ff9d6e0d1950847e824e
treea98a70d166d481156cc1d0b55fe228b02af2d405
parent60228733726e25d011b1f9221e005732191cc077
[ValueTracking] Consider single poison operands in propgatesPoison.

This patch updates propgatesPoison to take a Use as argument and
propagatesPoison now returns true if the passed in operand causes the
user to yield poison if the operand is poison

This allows propagating poison if the condition of a select is poison.
This helps improve results for programUndefinedIfUndefOrPoison.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D111643
llvm/include/llvm/Analysis/ValueTracking.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Transforms/Instrumentation/PoisonChecking.cpp
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
llvm/test/Analysis/ScalarEvolution/exit-count-select.ll
llvm/test/Analysis/ScalarEvolution/nsw.ll
llvm/test/Instrumentation/PoisonChecking/ub-checks.ll
llvm/unittests/Analysis/ValueTrackingTest.cpp