Skip to content

Commit 04ba6c6

Browse files
committed
[sil-combine] Enable select_enum canonicalization in OSSA.
1 parent 68b4671 commit 04ba6c6

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,9 +1887,6 @@ SILInstruction *SILCombiner::visitCondBranchInst(CondBranchInst *CBI) {
18871887
}
18881888

18891889
SILInstruction *SILCombiner::visitSelectEnumInst(SelectEnumInst *SEI) {
1890-
if (SEI->getFunction()->hasOwnership())
1891-
return nullptr;
1892-
18931890
// Canonicalize a select_enum: if the default refers to exactly one case, then
18941891
// replace the default with that case.
18951892
if (SEI->hasDefault()) {

test/SILOptimizer/sil_combine_enums_ossa.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ enum E {
106106
}
107107

108108
// CHECK-LABEL: sil [ossa] @canonicalize_select_enum
109-
// XHECK: select_enum {{.*}} case #E.E2!enumelt:
110-
// XHECK: return
111-
109+
// CHECK: select_enum {{.*}} case #E.E2!enumelt:
110+
// CHECK: return
111+
// CHECK: } // end sil function 'canonicalize_select_enum'
112112
sil [ossa] @canonicalize_select_enum : $@convention(thin) (E) -> Int32 {
113113
bb0(%0 : $E):
114114
%1 = integer_literal $Builtin.Int32, 0

0 commit comments

Comments
 (0)