Commits

Roman Levenstein committed 9448a781f37
[sil-combine] Fix a potential correctness problem in the apply{partial_apply(x,y)}(z) -> apply(z,x,y) peephole The existing code was trying to find the lifetime of the closure using LifetimeTracker with a predicate, which would ignore releases. But this could go wrong in certain cases. A test case would be a partial apply that is not applied on all paths. On the path where it is not applied, we still need to add releases for the temporary variables. The existing code was written to optimize the lifetime of the newly created temporaries, but we would need a control flow analysis to do it correctly. Doing this control-flow analysis during sil-combine does not seem to be an important optimization. Therefore, this patch makes of of a more pessimistic , but more correct approach. It uses LifetimeTracker without a predicate to find proper places to insert releases for temporary variables. Thanks Andy for reviewing my original patch and finding this issue! rdar://20868728 Swift SVN r28722