Reapply r23982, which moves mandatory inlining after DI and inout deshadowing.

This fixes some serious DI problems where it would be broken with transparent
functions like ++.

Previously, this had to be reverted because we were relying on mandatory inlining
to inline closure-taking stdlib functions (like &&/||) before inout deshadowing
happened.  With mandatory inlining moved after inout deshadowing, we were getting
a lot of inout shadow temporaries around, which notably defeated important COW
optimizations by increasing refcounts in unpredictable ways.  

The new @__noescape attribute handles this for us now, because @__noescape closures
(like the autoclosure arguments to ||/&&) no longer block inout deshadowing.



Swift SVN r24142
This commit is contained in:
Chris Lattner
2014-12-24 01:42:46 +00:00
parent a86c7902ae
commit ce8b218aba
3 changed files with 29 additions and 1 deletions

View File

@@ -75,8 +75,8 @@ bool swift::runSILDiagnosticPasses(SILModule &Module) {
// If we are asked do debug serialization, instead of running all diagnostic
// passes, just run mandatory inlining with dead transparent function cleanup
// disabled.
PM.add(createMandatoryInlining());
if (Module.getOptions().DebugSerialization) {
PM.add(createMandatoryInlining());
PM.run();
return Ctx.hadError();
}
@@ -87,6 +87,8 @@ bool swift::runSILDiagnosticPasses(SILModule &Module) {
PM.add(createInOutDeshadowing());
PM.add(createNoReturnFolding());
PM.add(createDefiniteInitialization());
PM.add(createMandatoryInlining());
PM.add(createPredictableMemoryOptimizations());
PM.add(createDiagnosticConstantPropagation());
PM.add(createDiagnoseUnreachable());