[llvm] [SimplifyCFG][NFC] Improve compile time for TryToSimplifyUncondBranchFromEmptyBlock optimization. (PR #110715)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 13:01:45 PDT 2024


================
@@ -1042,7 +1043,8 @@ CanRedirectPredsOfEmptyBBToSucc(BasicBlock *BB, BasicBlock *Succ,
 
   // Get the single common predecessor of both BB and Succ. Return false
   // when there are more than one common predecessors.
-  for (BasicBlock *SuccPred : SuccPreds) {
+  for (BasicBlock *SuccPred : predecessors(Succ)) {
+    SuccPredsOut.insert(SuccPred);
----------------
aemerson wrote:

I think it was the checks in this loop.

https://github.com/llvm/llvm-project/pull/110715


More information about the llvm-commits mailing list