================
@@ -3467,13 +3485,23 @@ static bool 
blockIsSimpleEnoughToThreadThrough(BasicBlock *BB) {
     // live outside of the current basic block.
     for (User *U : I.users()) {
       Instruction *UI = cast<Instruction>(U);
-      if (UI->getParent() != BB || isa<PHINode>(UI))
-        return false;
+      BasicBlock *UsedInBB = UI->getParent();
+      if (UsedInBB == BB) {
+        if (isa<PHINode>(UI))
+          return false;
+      } else
+        UsedInNonLocalBlocksSet.insert(UsedInBB);
     }
 
     // Looks ok, continue checking.
   }
 
+  for (BasicBlock *Succ : successors(BB)) {
+    BlocksSet VisitedBlocksSet;
+    if (reachesUsed(Succ, UsedInNonLocalBlocksSet, VisitedBlocksSet))
----------------
dtcxzyw wrote:

`reachesUsed` is expensive. Can we defer this DFS walk until cheap checks have 
been done (at line 3584)?


https://github.com/llvm/llvm-project/pull/135079
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to