Skip to content

Commit a30a4ad

Browse files
committed
PassManager: fix a small bug with performance measurments
The check for invalidation was wrong, leading to not restore from the snapshot, which can result in wrong measurements.
1 parent 6a889c8 commit a30a4ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/SILOptimizer/PassManager/PassManager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,15 @@ void SILPassManager::runPassOnFunction(unsigned TransIdx, SILFunction *F) {
553553
// Run it!
554554
SFT->run();
555555

556-
if (changeNotifications != SILAnalysis::InvalidationKind::Nothing) {
556+
if (CurrentPassHasInvalidated ||
557+
changeNotifications != SILAnalysis::InvalidationKind::Nothing) {
557558
// Pause time measurement while invalidating analysis and restoring the snapshot.
558559
duration += (std::chrono::system_clock::now() - startTime);
559560

560561
if (runIdx < numRepeats - 1) {
561562
invalidateAnalysis(F, SILAnalysis::InvalidationKind::Everything);
562563
F->restoreFromSnapshot(SnapshotID);
563-
} else {
564+
} else if (changeNotifications != SILAnalysis::InvalidationKind::Nothing) {
564565
invalidateAnalysis(F, changeNotifications);
565566
}
566567
changeNotifications = SILAnalysis::InvalidationKind::Nothing;

0 commit comments

Comments
 (0)