File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: a3c6d875e9d645809756565f5ca581299f322e5f
2
+ refs/heads/master: 2b00251b89380db07de4b86a242962e64cba87a6
3
3
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
4
4
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
5
5
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
Original file line number Diff line number Diff line change @@ -1879,11 +1879,15 @@ namespace {
1879
1879
// more no-payload case than extra inhabitants in the payload. This could
1880
1880
// be slightly generalized to cases where there's multiple tag bits and
1881
1881
// exactly one no-payload case in the highest used tag value.
1882
+ unsigned extraInhabitantCount = getFixedExtraInhabitantCount (IGF.IGM );
1882
1883
if (!tagBits ||
1883
- ElementsWithNoPayload.size () != getFixedExtraInhabitantCount (IGF.IGM )+1 )
1884
- payloadResult = payload.emitCompare (IGF,
1885
- ti.getFixedExtraInhabitantMask (IGF.IGM ),
1886
- payloadTag);
1884
+ ElementsWithNoPayload.size () != extraInhabitantCount + 1 ) {
1885
+ payloadResult = payload.emitCompare (
1886
+ IGF,
1887
+ extraInhabitantCount == 0 ? APInt::getAllOnesValue (PayloadBitCount)
1888
+ : ti.getFixedExtraInhabitantMask (IGF.IGM ),
1889
+ payloadTag);
1890
+ }
1887
1891
1888
1892
// If any tag bits are present, they must match.
1889
1893
llvm::Value *tagResult = nullptr ;
Original file line number Diff line number Diff line change @@ -474,6 +474,24 @@ enum SinglePayloadNoXI2 {
474
474
case u
475
475
}
476
476
477
+ // CHECK-32: define{{( dllexport)?}}{{( protected)?}} swiftcc i1 @select_enum([[WORD:i32]], i8)
478
+ // CHECK-64: define{{( dllexport)?}}{{( protected)?}} swiftcc i1 @select_enum([[WORD:i64]], i8)
479
+ // CHECK: entry:
480
+ // CHECK: [[TAG:%.*]] = trunc i8 %1 to i1
481
+ // CHECK: [[PAYLOAD:%.*]] = icmp eq [[WORD]] %0, 1
482
+ // CHECK: [[MATCHES:%.*]] = and i1 [[TAG]], [[PAYLOAD]]
483
+ // CHECK: [[RES:%.*]] = select i1 [[MATCHES]], i1 false, i1 true
484
+ // CHECK: ret i1 [[RES]]
485
+ // CHECK: }
486
+
487
+ sil @select_enum : $@convention(method) (SinglePayloadNoXI2) -> Builtin.Int1 {
488
+ bb0(%0 : $SinglePayloadNoXI2):
489
+ %2 = integer_literal $Builtin.Int1, 0
490
+ %3 = integer_literal $Builtin.Int1, -1
491
+ %4 = select_enum %0 : $SinglePayloadNoXI2, case #SinglePayloadNoXI2.z!enumelt: %2, default %3 : $Builtin.Int1
492
+ return %4 : $Builtin.Int1
493
+ }
494
+
477
495
// CHECK-64: define{{( dllexport)?}}{{( protected)?}} swiftcc void @single_payload_no_xi_switch([[WORD:i64]], i8) {{.*}} {
478
496
// CHECK-32: define{{( dllexport)?}}{{( protected)?}} swiftcc void @single_payload_no_xi_switch([[WORD:i32]], i8) {{.*}} {
479
497
sil @single_payload_no_xi_switch : $@convention(thin) (SinglePayloadNoXI2) -> () {
You can’t perform that action at this time.
0 commit comments