Commits

Chris Lattner committed 87fbce6a1ad
Progress on <rdar://problem/15867140> [string perf] member_ref_expr on an rvalue producing unnecessary retains/releases - Remove my previous local hack. - Add a new flag to SGFContext indicating that clients are ok with +0 rvalues. - Teach emitRValueForPropertyLoad and emitRValueForDecl how to work with +0 rvalues. This allows us to avoid retaining bases in arbitrarily nested struct rvalue member_ref_expr's. For example, this: class SomeClass {} struct AnotherStruct { var x : Int var c : SomeClass } struct StructMemberTest { var c1 : SomeClass, c2 : SomeClass var s : AnotherStruct func testRecursiveStruct() -> Int { return s.x } } used to compile to: sil @_TFV1t16StructMemberTest19testRecursiveStructfS0_FT_Si : $@cc(method) @thin (@owned StructMemberTest) -> Int64 { bb0(%0 : $StructMemberTest): debug_value %0 : $StructMemberTest // let self // id: %1 %2 = struct_extract %0 : $StructMemberTest, #s // user: %3 %3 = copy_value %2 : $AnotherStruct // users: %5, %4 %4 = struct_extract %3 : $AnotherStruct, #x // user: %7 destroy_value %3 : $AnotherStruct // id: %5 destroy_value %0 : $StructMemberTest // id: %6 return %4 : $Int64 // id: %7 } and now it compiles to: sil @_TFV1t16StructMemberTest19testRecursiveStructfS0_FT_Si : $@cc(method) @thin (@owned StructMemberTest) -> Int64 { bb0(%0 : $StructMemberTest): debug_value %0 : $StructMemberTest // let self // id: %1 %2 = struct_extract %0 : $StructMemberTest, #s // user: %3 %3 = struct_extract %2 : $AnotherStruct, #x // user: %5 destroy_value %0 : $StructMemberTest // id: %4 return %3 : $Int64 // id: %5 } There is more that can come from this, but it is a start. This cuts out 50 retain/release pairs from the stdlib. Swift SVN r12857