Open
Description
Description
The retain/release pair around the execute
call should be eliminated.
Discussion: https://forums.swift.org/t/why-does-swift-decide-to-insert-a-retain-release-pair-here
Reproduction
public class Object { var count = 0 }
@inline(never)
func execute<T>(closure: () -> T) -> T {
closure()
}
func compare(reference: Object, count: Int) -> Bool {
// retain Object
execute { reference.count == count }
// release Object
}
Expected behavior
no ARC traffic in this function
Environment
reproducible with top of main
Additional information
No response