[llvm] Bail out jump threading on indirect branches (PR #103688)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 00:21:03 PDT 2024


================
@@ -1029,11 +1031,12 @@ CanRedirectPredsOfEmptyBBToSucc(BasicBlock *BB, BasicBlock *Succ,
     return false;
 
   // Get single common predecessors of both BB and Succ
+  // TODO: Replace this with a proper `set intersect` algorithm
   for (BasicBlock *SuccPred : SuccPreds) {
     if (BBPreds.count(SuccPred)) {
+      CommonPred = SuccPred;
----------------
nikic wrote:

This change makes no sense -- did you run the tests for this PR at all?

This is finding a single common predecessor, so it bails out if there are multiple. After your change it bails out if there are any common predecessors.

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


More information about the llvm-commits mailing list