[all-commits] [llvm/llvm-project] 89d39f: [SimplifyCFG] Bail out on trivial cases in `mergeN...
Yingwei Zheng via All-commits
all-commits at lists.llvm.org
Tue Jul 28 06:18:32 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 89d39f69cb18f21d92b261cc0ca2a2314453b1fe
https://github.com/llvm/llvm-project/commit/89d39f69cb18f21d92b261cc0ca2a2314453b1fe
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2026-07-28 (Tue, 28 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/test/Transforms/SimplifyCFG/branch-nested.ll
Log Message:
-----------
[SimplifyCFG] Bail out on trivial cases in `mergeNestedCondBranch` (#212309)
Closes https://github.com/llvm/llvm-project/issues/212300.
When BB3 is identical to BB4, it is no longer profitable to perform this
fold, since it creates an unused xor instruction. The DomTree update
issue is also easy to fix. But I think this solution is better.
The following IR was dumped just before this function:
```
define void @func(i1 %cond1, i1 %cond2, i1 %cond3) {
entry:
br i1 %cond1, label %bb2, label %else
else: ; preds = %entry
br i1 %cond2, label %bb0, label %common.ret
bb0: ; preds = %else
br i1 %cond1, label %bb1, label %bb2
bb2: ; preds = %bb0, %entry
br i1 %cond3, label %common.ret, label %common.ret
bb1: ; preds = %bb0
br i1 %cond3, label %common.ret, label %common.ret
common.ret: ; preds = %bb2, %bb1, %bb2, %bb1, %else
ret void
}
```
The previous functions will simplify it. So the reproducer cannot be
further reduced.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list