Use it in loop rotation.
The pattern to update analysis information is:
// The AnalysisInfo was preserved for this function.
if (Changed) {
// Preserve the analyis for this function by decoupling it from the analysis
// cache.
auto PreservedAnalysis = Analysis.preserveAnalysis(Function);
// Invalidate analysis for this function.
PM.invalidateAnalysis(Function, InvalidationKind::CFG);
// Update the preserved analysis for this function.
Analysis.updateAnalysis(F, std::move(PreservedAnalysis));
}
Swift SVN r19918
Since we don't have guaranteed preheader insertion (yet). We can have the
situation where the new header (after rotation) is also a header of a nested
loop. In such a case we must bail.
Try harder to created preheader for nested loops though.
Swift SVN r19881