@@ -2020,6 +2020,47 @@ void ThinLTOCodeGenerator::run() {
2020
2020
}
2021
2021
});
2022
2022
}
2023
+
2024
+ WrittenObjects.wait (AllModules);
2025
+
2026
+ {
2027
+ if (CacheLogging)
2028
+ CacheLogOS.applyLocked ([&](raw_ostream &OS) {
2029
+ OS << " Waiting for outstanding cache requests...\n " ;
2030
+ });
2031
+ ScopedDurationTimer T ([&](double Seconds) {
2032
+ if (CacheLogging)
2033
+ CacheLogOS.applyLocked ([&](raw_ostream &OS) {
2034
+ OS << " Handled outstanding cache requests in "
2035
+ << llvm::format (" %.6fs" , Seconds) << " \n " ;
2036
+ });
2037
+ });
2038
+ auto Start = std::chrono::steady_clock::now ();
2039
+ auto CacheTimeout = DeterministicCheck
2040
+ ? std::chrono::milliseconds::max ()
2041
+ : std::chrono::milliseconds (5000 );
2042
+
2043
+ if (!HandledCacheReads.waitFor (CacheTimeout, AllModules)) {
2044
+ // If we were unable to finish all cache reads in time, just request
2045
+ // their cancellation (we already have all objects written) and don't
2046
+ // bother writing to the cache (that would probably be even slower
2047
+ // than reading form it).
2048
+ GetCancelTok->requestCancellation ();
2049
+ } else {
2050
+ auto Now = std::chrono::steady_clock::now ();
2051
+ auto RemainingCacheTimeout = CacheTimeout - (Now - Start);
2052
+ // If we finished all cache reads in time, request writes.
2053
+ if (!HandledCacheWrites.waitFor (RemainingCacheTimeout, AllModules)) {
2054
+ // If we were unable to finish all cache writes in time, request
2055
+ // their cancellation. We don't want to hold up the link any longer.
2056
+ PutCancelTok->requestCancellation ();
2057
+ }
2058
+ }
2059
+
2060
+ if (DeterministicCheck)
2061
+ for (int count : ModulesOrdering)
2062
+ (void )Infos[count].Entry ->areLoadedAndWrittenResultsIdentical ();
2063
+ }
2023
2064
}
2024
2065
2025
2066
pruneCache (CacheOptions.Path , CacheOptions.Policy , ProducedBinaries);
0 commit comments