[PATCH] D86477: [ValueTracking] Let getGuaranteedNonPoisonOp find multiple non-poison operands

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 13:03:16 PDT 2020


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5121
                          const SmallSet<const Value *, 16>& KnownPoison) {
-  auto *NotPoison = getGuaranteedNonPoisonOp(I);
-  return (NotPoison && KnownPoison.count(NotPoison));
+  SmallSet<const Value *, 4> NonPoisonOps;
+  getGuaranteedNonPoisonOps(I, NonPoisonOps);
----------------
We don't really care about duplicates in this context, so I'd suggest a more efficient SmallVector.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5126
+
+  for (const auto *V : KnownPoison)
+    if (NonPoisonOps.count(V))
----------------
This should be the other way around, i.e. iterate over NonPoisonOps and check if they are in KnownPoison. The NonPoisonOps set is generally expected to be smaller than the KnownPoison one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86477/new/

https://reviews.llvm.org/D86477



More information about the llvm-commits mailing list