This repository was archived by the owner on Mar 17, 2026. It is now read-only.
pre-commit: PR173022 - #3538
Closed
zyw-bot wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
Comptime moderunner: ariselab-64c-docker |
|
/close |
Camsyn
added a commit
to llvm/llvm-project
that referenced
this pull request
Mar 12, 2026
When >1 predecessors of BB are identical, try to merge them into ONE. --- Here is a simplified example (`sink` and `bb*`s share the same predecessor `entry`, hindering the existing uncond br folding to optimize such a case): ```diff - entry: - switch to %br1, %br2, %br3, %sink - bb1: - br label %sink - bb2: - br label %sink - bb3: - br label %sink - sink: - %ret = phi i8 [ 0, %bb1 ], [ 0, %bb2 ], [ 0, %bb3 ], [ -1, %entry ] + entry: + switch to %br1, %sink + bb1: + br label %sink + sink: + %ret = phi i8 [ 0, %bb1 ], [ -1, %entry ] ``` Actually, `simplifyDuplicateSwitchArms` did similar things in a very limited scope (only for switch arms), this patch generalizes its logic to handle any BB with >1 identical predecessors. --- This PR lands the [discussion](dtcxzyw/llvm-opt-benchmark#3033 (comment)), i.e., "merge identical predecessor bottom to up", and implements the suggestion of #114262 (comment). - IR diff: dtcxzyw/llvm-opt-benchmark#3537 - CompTime Impact: dtcxzyw/llvm-opt-benchmark#3538
llvm-sync Bot
pushed a commit
to arm/arm-toolchain
that referenced
this pull request
Mar 12, 2026
When >1 predecessors of BB are identical, try to merge them into ONE. --- Here is a simplified example (`sink` and `bb*`s share the same predecessor `entry`, hindering the existing uncond br folding to optimize such a case): ```diff - entry: - switch to %br1, %br2, %br3, %sink - bb1: - br label %sink - bb2: - br label %sink - bb3: - br label %sink - sink: - %ret = phi i8 [ 0, %bb1 ], [ 0, %bb2 ], [ 0, %bb3 ], [ -1, %entry ] + entry: + switch to %br1, %sink + bb1: + br label %sink + sink: + %ret = phi i8 [ 0, %bb1 ], [ -1, %entry ] ``` Actually, `simplifyDuplicateSwitchArms` did similar things in a very limited scope (only for switch arms), this patch generalizes its logic to handle any BB with >1 identical predecessors. --- This PR lands the [discussion](dtcxzyw/llvm-opt-benchmark#3033 (comment)), i.e., "merge identical predecessor bottom to up", and implements the suggestion of llvm/llvm-project#114262 (comment). - IR diff: dtcxzyw/llvm-opt-benchmark#3537 - CompTime Impact: dtcxzyw/llvm-opt-benchmark#3538
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link: /comptime llvm/llvm-project#173022
Requested by: @Camsyn