Skip to content

Conversation

c-rhodes
Copy link
Collaborator

@c-rhodes c-rhodes commented Oct 3, 2025

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

There's a check above the pred block is terminated with an unconditional
branch, so this code is unreachable.
@c-rhodes c-rhodes requested a review from dtcxzyw October 3, 2025 16:20
@c-rhodes c-rhodes requested a review from nikic as a code owner October 3, 2025 16:20
@llvmbot llvmbot added llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms labels Oct 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 3, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Cullen Rhodes (c-rhodes)

Changes

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

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@c-rhodes c-rhodes merged commit 100db53 into llvm:main Oct 8, 2025
12 checks passed
svkeerthy pushed a commit that referenced this pull request Oct 9, 2025
…61871)

There's a check above the pred block is terminated with an unconditional
branch, so this code is unreachable.
clingfei pushed a commit to clingfei/llvm-project that referenced this pull request Oct 10, 2025
…vm#161871)

There's a check above the pred block is terminated with an unconditional
branch, so this code is unreachable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants