Avatar
とりあえず -O で同等の SIL が出力されることは確認しました。理由分からず。
🤔 1
6:30 AM
あ、うそ SIL 違いました
6:33 AM
= String() // default argument 0 of DEFAULT_CONST(x:) sil non_abi @$S4test13DEFAULT_CONST1xySSyXK_tFfA_ : $@convention(thin) () -> @owned @callee_guaranteed () -> @owned String { bb0: // function_ref implicit closure #1 in default argument 0 of DEFAULT_CONST(x:) %0 = function_ref @$S4test13DEFAULT_CONST1xySSyXK_tFfA_SSyXAfu_ : $@convention(thin) () -> @owned String // user: %1 %1 = thin_to_thick_function %0 : $@convention(thin) () -> @owned String to $@callee_guaranteed () -> @owned String // user: %2 return %1 : $@callee_guaranteed () -> @owned String // id: %2 } // end sil function '$S4test13DEFAULT_CONST1xySSyXK_tFfA_' // implicit closure #1 in default argument 0 of DEFAULT_CONST(x:) sil shared [transparent] [thunk] [always_inline] @$S4test13DEFAULT_CONST1xySSyXK_tFfA_SSyXAfu_ : $@convention(thin) () -> @owned String { bb0: %0 = integer_literal $Builtin.Int64, -2305843009213693952 // user: %1 %1 = struct $UInt (%0 : $Builtin.Int64) // user: %2 %2 = value_to_bridge_object %1 : $UInt // users: %8, %3 %3 = struct $_StringObject (%2 : $Builtin.BridgeObject) // user: %6 %4 = integer_literal $Builtin.Int64, 0 // user: %5 %5 = struct $UInt (%4 : $Builtin.Int64) // user: %6 %6 = struct $_StringGuts (%3 : $_StringObject, %5 : $UInt) // user: %7 %7 = struct $String (%6 : $_StringGuts) // user: %9 strong_retain %2 : $Builtin.BridgeObject // id: %8 return %7 : $String // id: %9 } // end sil function '$S4test13DEFAULT_CONST1xySSyXK_tFfA_SSyXAfu_'
6:33 AM
= "" // default argument 0 of EMPTY_LITERAL(x:) sil non_abi @$S4test13EMPTY_LITERAL1xySSyXK_tFfA_ : $@convention(thin) () -> @owned @callee_guaranteed () -> @owned String { bb0: // function_ref implicit closure #1 in default argument 0 of EMPTY_LITERAL(x:) %0 = function_ref @$S4test13EMPTY_LITERAL1xySSyXK_tFfA_SSyXAfu_ : $@convention(thin) () -> @owned String // user: %1 %1 = thin_to_thick_function %0 : $@convention(thin) () -> @owned String to $@callee_guaranteed () -> @owned String // user: %2 return %1 : $@callee_guaranteed () -> @owned String // id: %2 } // end sil function '$S4test13EMPTY_LITERAL1xySSyXK_tFfA_' // implicit closure #1 in default argument 0 of EMPTY_LITERAL(x:) sil shared [transparent] @$S4test13EMPTY_LITERAL1xySSyXK_tFfA_SSyXAfu_ : $@convention(thin) () -> @owned String { bb0: %0 = string_literal utf8 "" // user: %4 %1 = integer_literal $Builtin.Word, 0 // user: %4 %2 = integer_literal $Builtin.Int1, -1 // user: %4 // function_ref specialized String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) %3 = function_ref @$SSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfCTf4nnnd_n : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1) -> @owned String // user: %4 %4 = apply %3(%0, %1, %2) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1) -> @owned String // user: %5 return %4 : $String // id: %5 } // end sil function '$S4test13EMPTY_LITERAL1xySSyXK_tFfA_SSyXAfu_'