[PATCH] D75401: [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into branch conditions of dominating blocks' terminators
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 12:55:28 PST 2020
reames requested changes to this revision.
reames added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4563
+ if (CxtI) {
+ // If V is used as a branch condition before reaching CxtI, V cannot be
----------------
jdoerfert wrote:
> Style: early exit `!CtxI`.
This should probably be inside programUndefinedIfFullPoison
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4579
+ if (!DT)
+ return hasCond(CxtI->getParent(), V);
+ else {
----------------
This is incorrect. Consider:
b = freeze a
throw_if_a_would_be_poison()
if (a == 5) {}
You can only use branches which either a) dominate the freeze's uses, or b) are guaranteed to execute if any of those uses execute. (a) is a subcase of (b) which happens to be cheap to check. Note that phrasing in terms of "uses" here, not the freeze def.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75401/new/
https://reviews.llvm.org/D75401
More information about the llvm-commits
mailing list