================
@@ -3540,18 +3568,29 @@ foldCondBranchOnValueKnownInPredecessorImpl(BranchInst 
*BI, DomTreeUpdater *DTU,
     return false;
 
   // Now we know that this block has multiple preds and two succs.
-  // Check that the block is small enough and values defined in the block are
-  // not used outside of it.
-  if (!blockIsSimpleEnoughToThreadThrough(BB))
+  // Check that the block is small enough and record which non-local blocks use
+  // values defined in the block.
+
+  BlocksSet NonLocalUseBlocks;
+  BlocksSet ReachesNonLocalUseBlocks;
+  if (!blockIsSimpleEnoughToThreadThrough(BB, NonLocalUseBlocks))
+    return false;
+
+  if (NonLocalUseBlocks.contains(BI->getSuccessor(0)) &&
----------------
dtcxzyw wrote:

Is this a heuristic to check if the non-local uses live in both successors?
Can you add more comments for this check?

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