The enableObjectCache option was added in
https://reviews.llvm.org/rG06e8101034e, defaulting to false. However,
the init code added there got its logic reversed
(cache(enableObjectCache ? nullptr : new SimpleObjectCache()), which was
fixed in https://reviews.llvm.org/rGd1186fcb04 by setting the default to
true, thereby preserving the existing behavior even if it was
unintentional.
Default now the object cache to false as it was originally intended.
While at it, mention in enableObjectCache's documentation how the
cache can be dumped.
Reviewed-by: mehdi_amini
Differential Revision: https://reviews.llvm.org/D121291
llvm::SectionMemoryManager::MemoryMapper *sectionMemoryMapper = nullptr;
/// If `enableObjectCache` is set, the JIT compiler will create one to store
- /// the object generated for the given module.
- bool enableObjectCache = true;
+ /// the object generated for the given module. The contents of the cache can
+ /// be dumped to a file via the `dumpToObjectfile` method.
+ bool enableObjectCache = false;
/// If enable `enableGDBNotificationListener` is set, the JIT compiler will
/// notify the llvm's global GDB notification listener.
}
void ExecutionEngine::dumpToObjectFile(StringRef filename) {
+ if (cache == nullptr) {
+ llvm::errs() << "cannot dump ExecutionEngine object code to file: "
+ "object cache is disabled\n";
+ return;
+ }
cache->dumpToObjectFile(filename);
}
engineOptions.transformer = config.transformer;
engineOptions.jitCodeGenOptLevel = jitCodeGenOptLevel;
engineOptions.sharedLibPaths = executionEngineLibs;
+ engineOptions.enableObjectCache = true;
auto expectedEngine = mlir::ExecutionEngine::create(module, engineOptions);
if (!expectedEngine)
return expectedEngine.takeError();