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