Skip to content

Commit df6e185

Browse files
committed
[InstCombine][Test] Test for fix of replacing select with Phis when branch has the same labels
An additional test that allows to check the correctness of handling the case of the same branch labels in the dominator when trying to replace select with phi-node. Patch By: Kirill Polushin Differential Revision: https://reviews.llvm.org/D84006 Reviewed By: mkazantsev
1 parent bb160e7 commit df6e185

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/select.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,6 +2000,21 @@ merge:
20002000
ret i32 %s
20012001
}
20022002

2003+
define i32 @select_dominating_cond_same_labels(i1 %cond) {
2004+
; CHECK-LABEL: @select_dominating_cond_same_labels(
2005+
; CHECK-NEXT: entry:
2006+
; CHECK-NEXT: br i1 false, label [[EXIT:%.*]], label [[EXIT]]
2007+
; CHECK: exit:
2008+
; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[COND:%.*]], i32 123, i32 456
2009+
; CHECK-NEXT: ret i32 [[RESULT]]
2010+
;
2011+
entry:
2012+
%result = select i1 %cond, i32 123, i32 456
2013+
br i1 %cond, label %exit, label %exit
2014+
exit:
2015+
ret i32 %result
2016+
}
2017+
20032018
define i32 @select_phi_same_condition(i1 %cond, i32 %x, i32 %y, i32 %z) {
20042019
; CHECK-LABEL: @select_phi_same_condition(
20052020
; CHECK-NEXT: entry:

0 commit comments

Comments
 (0)