[PATCH] D69470: [ExpandReductions] Don't push all intrinsics to the worklist. Just push reductions.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 05:20:50 PST 2019


spatel accepted this revision.
spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/ExpandReductions.cpp:81
   SmallVector<IntrinsicInst *, 4> Worklist;
-  for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
-    if (auto II = dyn_cast<IntrinsicInst>(&*I))
-      Worklist.push_back(II);
+  for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
+    if (auto II = dyn_cast<IntrinsicInst>(&*I)) {
----------------
craig.topper wrote:
> spatel wrote:
> > Could reduce with something like:
> >   for (auto &I : instructions(F)) {
> > 
> > Note - either way, this pass may be in danger of dying if used on unreachable blocks that contain weird IR. 
> > See for example: D67766
> Does the UnreachableBlockEliminationPass that we run earlier in the codegen pipeline help prevent that?
Nice - I didn't know that existed. It's just a wrapper around a util function: llvm::EliminateUnreachableBlocks().

So yes, that should make it pretty safe. Still a chance that fuzzers will target this pass in a different pipeline or that something between that running and this running would create a dead block with bogus code, but the odds are low.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69470





More information about the llvm-commits mailing list