[PATCH] D137027: [llvm] Improve performance of programUndefinedIfUndefOrPoison
Geza Lore via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 29 16:24:31 PDT 2022
gezalore updated this revision to Diff 471792.
gezalore edited the summary of this revision.
gezalore added a comment.
Simplify according to feedback
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137027/new/
https://reviews.llvm.org/D137027
Files:
llvm/lib/Analysis/ValueTracking.cpp
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -5729,11 +5729,6 @@
SmallSet<const BasicBlock *, 4> Visited;
YieldsPoison.insert(V);
- auto Propagate = [&](const User *User) {
- if (propagatesPoison(cast<Operator>(User)))
- YieldsPoison.insert(User);
- };
- for_each(V->users(), Propagate);
Visited.insert(BB);
while (true) {
@@ -5747,9 +5742,16 @@
if (!isGuaranteedToTransferExecutionToSuccessor(&I))
return false;
- // Mark poison that propagates from I through uses of I.
- if (YieldsPoison.count(&I))
- for_each(I.users(), Propagate);
+ // If this instruction propagates poison, mark it as poison if any of
+ // its operands are poison
+ if (propagatesPoison(cast<Operator>(&I))) {
+ for (const Use &U : I.operands()) {
+ if (YieldsPoison.count(U.get())) {
+ YieldsPoison.insert(&I);
+ break;
+ }
+ }
+ }
}
BB = BB->getSingleSuccessor();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137027.471792.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221029/c9d0b1e3/attachment.bin>
More information about the llvm-commits
mailing list