[llvm] [InstCombine][nfc] Remove dead invoke inst check in foldOpIntoPhi (PR #161871)

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 09:20:41 PDT 2025


https://github.com/c-rhodes created https://github.com/llvm/llvm-project/pull/161871

There's a check above the pred block is terminated with an unconditional branch, so this code is unreachable.

>From cfc34731c8079af8e9cf3355fe045cd50163ced3 Mon Sep 17 00:00:00 2001
From: Cullen Rhodes <cullen.rhodes at arm.com>
Date: Fri, 3 Oct 2025 16:10:00 +0000
Subject: [PATCH] [InstCombine][nfc] Remove dead invoke inst check in
 foldOpIntoPhi

There's a check above the pred block is terminated with an unconditional
branch, so this code is unreachable.
---
 llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index f0ddd5ca94c5a..c4c704126b5ce 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1968,12 +1968,6 @@ Instruction *InstCombinerImpl::foldOpIntoPhi(Instruction &I, PHINode *PN,
     NewPhiValues.push_back(nullptr);
     OpsToMoveUseToIncomingBB.push_back(i);
 
-    // If the InVal is an invoke at the end of the pred block, then we can't
-    // insert a computation after it without breaking the edge.
-    if (isa<InvokeInst>(InVal))
-      if (cast<Instruction>(InVal)->getParent() == InBB)
-        return nullptr;
-
     // Do not push the operation across a loop backedge. This could result in
     // an infinite combine loop, and is generally non-profitable (especially
     // if the operation was originally outside the loop).



More information about the llvm-commits mailing list