================
@@ -560,17 +595,38 @@ splitDeviceCode(std::unique_ptr<Module> M, StringRef
LinkedBitcodeFile,
WriteBitcodeToFile(*Part, OS);
SplitModules.push_back(
- {SmallString<256>(*BitcodeFileOrErr), collectSymbols(*Part)});
+ {SmallString<256>(*BitcodeFileOrErr),
+ collectSymbols(*Part, EmitOnlyKernelsAsEntryPoints)});
return Error::success();
};
if (Error Err = splitModuleTransitiveFromEntryPoints(
- std::move(M), EntryPointCategorizer, SplitCallback))
+ std::move(M), Categorizer, SplitCallback))
return Err;
+ if (Verbose || DryRun) {
+ SmallVector<StringRef> SplitFiles;
+ for (const SplitModule &SI : SplitModules)
+ SplitFiles.push_back(SI.ModuleFilePath);
+ errs() << formatv("sycl-module-split: input: {0}, output: {1}, mode:
{2}\n",
+ LinkedBitcodeFile, llvm::join(SplitFiles, ", "),
+ splitModeToString(Mode));
+ }
+
return SplitModules;
}
+/// Returns true if module splitting can be skipped: either \p Mode is
+/// SPLIT_NONE, or \p M contains no entry points (nothing to split from).
+static bool checkModuleSplitCanBeSkipped(IRSplitMode Mode, const Module &M,
+ bool EmitOnlyKernelsAsEntryPoints) {
+ if (Mode == IRSplitMode::SPLIT_NONE)
+ return true;
+ return !llvm::any_of(M.functions(), [&](const Function &F) {
----------------
bader wrote:
```suggestion
return llvm::none_of(M.functions(), [&](const Function &F) {
```
https://github.com/llvm/llvm-project/pull/196435
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits