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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 07:56:19 PST 2024


================
@@ -1028,7 +1028,14 @@ CanRedirectPredsOfEmptyBBToSucc(BasicBlock *BB, BasicBlock *Succ,
   if (!BB->hasNPredecessorsOrMore(2))
     return false;
 
-  // Get single common predecessors of both BB and Succ
+  if (any_of(BBPreds, [](const BasicBlock *Pred) {
+        return isa<PHINode>(Pred->begin()) &&
----------------
nikic wrote:

I don't understand why phi blocks in the predecessor are relevant here. Your test case happens to have a phi, but if I replace the phi with an argument I still get the same miscompile after your patch.

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


More information about the llvm-commits mailing list