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

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 09:21:17 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Cullen Rhodes (c-rhodes)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/161871.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/InstCombine/InstructionCombining.cpp (-6) 


``````````diff
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).

``````````

</details>


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


More information about the llvm-commits mailing list