aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-04-30 14:14:03 -0700
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-05-13 10:10:46 -0700
commit7c2afd5899df876eaf5ffb485194dc58e92daf89 (patch)
tree1c68ef29f30d9acc465a907ad97a30a3db0dad7c /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent98e4fd0701d0c65229db876ce338c723231d8cb4 (diff)
downloadllvm-7c2afd5899df876eaf5ffb485194dc58e92daf89.zip
llvm-7c2afd5899df876eaf5ffb485194dc58e92daf89.tar.gz
llvm-7c2afd5899df876eaf5ffb485194dc58e92daf89.tar.bz2
Modules: Remove ModuleLoader::OtherUncachedFailure, NFC
5cca622310c10fdf6f921b6cce26f91d9f14c762 refactored CompilerInstance::loadModule, splitting out findOrCompileModuleAndReadAST, but was careful to avoid making any functional changes. It added ModuleLoader::OtherUncachedFailure to facilitate this and left behind FIXMEs asking why certain failures weren't cached. After a closer look, I think we can just remove this and simplify the code. This changes the behaviour of the following (simplified) code from CompilerInstance::loadModule, causing a failure to be cached more often: ``` if (auto MaybeModule = MM.getCachedModuleLoad(*Path[0].first)) return *MaybeModule; if (ModuleName == getLangOpts().CurrentModule) return MM.cacheModuleLoad(PP.lookupModule(...)); ModuleLoadResult Result = findOrCompileModuleAndReadAST(...); if (Result.isNormal()) // This will be 'true' more often. return MM.cacheModuleLoad(..., Module); return Result; ``` `MM` here is a ModuleMap owned by the Preprocessor. Here are the cases where `findOrCompileModuleAndReadAST` starts returning a "normal" failed result: - Emitted `diag::err_module_not_found`, where there's no module map found. - Emitted `diag::err_module_build_disabled`, where implicitly building modules is disabled. - Emitted `diag::err_module_cycle`, which detects module cycles in the implicit modules build system. - Emitted `diag::err_module_not_built`, which avoids building a module in this CompilerInstance if another one tried and failed already. - `compileModuleAndReadAST()` was called and failed to build. The four errors are all fatal, and last item also reports a fatal error, so it this extra caching has no functionality change... but even if it did, it seems fine to cache these failed results within a ModuleMap instance (note that each CompilerInstance has its own Preprocessor and ModuleMap). Differential Revision: https://reviews.llvm.org/D101667
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
0 files changed, 0 insertions, 0 deletions