Commits
Chris Lattner committed d89fded653b
Implement a micro-optimization to the let-else SILGen for enum matches:
don't run the cleanup for the enum if the failure path can only contain
trivial enum element matches. For example, on:
class Base {}
func test_is(a : Base?) {
let x? = a else { abort() }
}
we previously emitted:
switch_enum %0 : $Optional<Base>, case #Optional.Some!enumelt.1: bb2, default bb1 // id: %3
bb1: // Preds: bb0
release_value %0 : $Optional<Base> // id: %4
br bb3 // id: %5
which is silly because the release_value is always dynamically a no-op (the
.None element of an enum is always trivial).
Swift SVN r27460