@@ -3579,3 +3579,61 @@ bb0(%0 : $Builtin.Int64):
3579
3579
strong_retain %2 : $Builtin.BridgeObject
3580
3580
return %2 : $Builtin.BridgeObject
3581
3581
}
3582
+
3583
+ // CHECK-LABEL: sil @optimize_stringObject_bit_operations
3584
+ // CHECK: bb0:
3585
+ // CHECK-NEXT: %0 = integer_literal $Builtin.Int64, 4611686018427387904
3586
+ // CHECK-NEXT: return %0
3587
+ sil @optimize_stringObject_bit_operations : $@convention(thin) () -> Builtin.Int64 {
3588
+ bb0:
3589
+ %2 = string_literal utf8 "thequickbrownfoxjumpsoverthelazydogusingasmanycharacteraspossible123456789"
3590
+ %5 = builtin "ptrtoint_Word"(%2 : $Builtin.RawPointer) : $Builtin.Word
3591
+ %6 = builtin "zextOrBitCast_Word_Int64"(%5 : $Builtin.Word) : $Builtin.Int64
3592
+ %9 = integer_literal $Builtin.Int64, 13835058055282163712
3593
+ %10 = builtin "stringObjectOr_Int64"(%6 : $Builtin.Int64, %9 : $Builtin.Int64) : $Builtin.Int64
3594
+ %11 = struct $UInt64 (%10 : $Builtin.Int64)
3595
+ %12 = value_to_bridge_object %11 : $UInt64
3596
+ %33 = unchecked_trivial_bit_cast %12 : $Builtin.BridgeObject to $UInt64
3597
+ %34 = integer_literal $Builtin.Int64, 6917529027641081856
3598
+ %35 = struct_extract %33 : $UInt64, #UInt64._value
3599
+ %36 = builtin "and_Int64"(%35 : $Builtin.Int64, %34 : $Builtin.Int64) : $Builtin.Int64
3600
+ return %36 : $Builtin.Int64
3601
+ }
3602
+
3603
+ // CHECK-LABEL: sil @dont_optimize_stringObject_bit_operations1
3604
+ // CHECK: builtin "stringObjectOr_Int64"
3605
+ // CHECK: builtin "and_Int64"
3606
+ sil @dont_optimize_stringObject_bit_operations1 : $@convention(thin) (Builtin.RawPointer) -> Builtin.Int64 {
3607
+ bb0(%2 : $Builtin.RawPointer):
3608
+ %5 = builtin "ptrtoint_Word"(%2 : $Builtin.RawPointer) : $Builtin.Word
3609
+ %6 = builtin "zextOrBitCast_Word_Int64"(%5 : $Builtin.Word) : $Builtin.Int64
3610
+ %9 = integer_literal $Builtin.Int64, -9223372036854775808
3611
+ %10 = builtin "stringObjectOr_Int64"(%6 : $Builtin.Int64, %9 : $Builtin.Int64) : $Builtin.Int64
3612
+ %11 = struct $UInt64 (%10 : $Builtin.Int64)
3613
+ %12 = value_to_bridge_object %11 : $UInt64
3614
+ %33 = unchecked_trivial_bit_cast %12 : $Builtin.BridgeObject to $UInt64
3615
+ %34 = integer_literal $Builtin.Int64, 4611686018427387904
3616
+ %35 = struct_extract %33 : $UInt64, #UInt64._value
3617
+ %36 = builtin "and_Int64"(%35 : $Builtin.Int64, %34 : $Builtin.Int64) : $Builtin.Int64
3618
+ return %36 : $Builtin.Int64
3619
+ }
3620
+
3621
+ // CHECK-LABEL: sil @dont_optimize_stringObject_bit_operations2
3622
+ // CHECK: builtin "stringObjectOr_Int64"
3623
+ // CHECK: builtin "and_Int64"
3624
+ sil @dont_optimize_stringObject_bit_operations2 : $@convention(thin) () -> Builtin.Int64 {
3625
+ bb0:
3626
+ %2 = string_literal utf8 "thequickbrownfoxjumpsoverthelazydogusingasmanycharacteraspossible123456789"
3627
+ %5 = builtin "ptrtoint_Word"(%2 : $Builtin.RawPointer) : $Builtin.Word
3628
+ %6 = builtin "zextOrBitCast_Word_Int64"(%5 : $Builtin.Word) : $Builtin.Int64
3629
+ %9 = integer_literal $Builtin.Int64, 13835058055282163712
3630
+ %10 = builtin "stringObjectOr_Int64"(%6 : $Builtin.Int64, %9 : $Builtin.Int64) : $Builtin.Int64
3631
+ %11 = struct $UInt64 (%10 : $Builtin.Int64)
3632
+ %12 = value_to_bridge_object %11 : $UInt64
3633
+ %33 = unchecked_trivial_bit_cast %12 : $Builtin.BridgeObject to $UInt64
3634
+ %34 = integer_literal $Builtin.Int64, 1152921504606846975
3635
+ %35 = struct_extract %33 : $UInt64, #UInt64._value
3636
+ %36 = builtin "and_Int64"(%35 : $Builtin.Int64, %34 : $Builtin.Int64) : $Builtin.Int64
3637
+ return %36 : $Builtin.Int64
3638
+ }
3639
+
0 commit comments