[PATCH] D84006: [InstCombine][Test] Test for fix of replacing select with Phis when branch has the same labels
Kirill via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 01:42:05 PDT 2020
kpolushin created this revision.
kpolushin added reviewers: mkazantsev, nikic, hfinkel, efriedma, lebedev.ri, spatel, xbolva00.
kpolushin added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84006
Files:
llvm/test/Transforms/InstCombine/select.ll
Index: llvm/test/Transforms/InstCombine/select.ll
===================================================================
--- llvm/test/Transforms/InstCombine/select.ll
+++ llvm/test/Transforms/InstCombine/select.ll
@@ -2000,6 +2000,21 @@
ret i32 %s
}
+define i32 @select_dominating_cond_same_labels(i1 %cond) {
+; CHECK-LABEL: @select_dominating_cond_same_labels(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 false, label [[EXIT:%.*]], label [[EXIT]]
+; CHECK: exit:
+; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[COND:%.*]], i32 123, i32 456
+; CHECK-NEXT: ret i32 [[RESULT]]
+;
+entry:
+ %result = select i1 %cond, i32 123, i32 456
+ br i1 %cond, label %exit, label %exit
+exit:
+ ret i32 %result
+}
+
define i32 @select_phi_same_condition(i1 %cond, i32 %x, i32 %y, i32 %z) {
; CHECK-LABEL: @select_phi_same_condition(
; CHECK-NEXT: entry:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84006.278675.patch
Type: text/x-patch
Size: 863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200717/ddbb6f24/attachment.bin>
More information about the llvm-commits
mailing list