[PATCH] D100122: Update m_Undef to match vectors/aggrs with undefs and poisons mixed

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 17 04:19:57 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/include/llvm/IR/PatternMatch.h:92-100
+  static bool check(const Value *V) {
+    if (isa<UndefValue>(V))
+      return true;
+
+    if (auto *CA = dyn_cast<ConstantAggregate>(V))
+      return all_of(CA->operand_values(), check);
+
----------------
aqjune wrote:
> lebedev.ri wrote:
> > I'm not sure i like recursion here.
> > How about a worklist algorithm?
> Thank you for the suggestion! I updated this patch.
The point of that lambda was to check non-aggregate operands on the spot, without adding them into the worklist.
If we don't want that, just inline the lambda into the loop,
and do plain `Worklist.emplace_back(V);` before the loop..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100122



More information about the llvm-commits mailing list