Otherwise, if we move in a formal access cleanup value into switch emission
using a cleanup cloner, we will improperly have a formal access cleanup that
will be invalidated by a normal Scope which violates SILGen invariants. Also in
a certain sense the bindings performed by SILGenPattern that do this type of
forwarding are arguments in a certain sense so it seems reasonable to do this.
<rdar://problem/70736924>
This comes down to popping the formal evaluation scope and then performing a
popPreservingValue through the resulting normal Scope.
As a cleanup, I changed ArgumentScope.popPreservingValue(ManagedValue) to just
Scope::popPreservingValue instead of reimplementing said functionality.
rdar://31521023
This partially reverts commit 41f425a503.
The key thing is that now it is behind the semantic sil flag. I have an
additional patch that turns this back on in front of the flag, but it requires a
little bit of mandatory pass work that Erik is going to hit this week.
rdar://31145255