Skip to content

Commit 122425c

Browse files
committed
Resolve recent CR nits
1 parent c054d0f commit 122425c

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

llvm/lib/Transforms/Utils/SYCLSplitModule.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ModuleDesc {
106106
ModuleDesc(std::unique_ptr<Module> M,
107107
EntryPointGroup EntryPoints = EntryPointGroup())
108108
: M(std::move(M)), EntryPoints(std::move(EntryPoints)) {
109-
assert(this->M && "Module should be non-empty");
109+
assert(this->M && "Module should be non-null");
110110
}
111111

112112
const EntryPointSet &entries() const { return EntryPoints.Functions; }
@@ -344,13 +344,6 @@ class ModuleSplitter {
344344

345345
} // namespace
346346

347-
/// Gets attached attribute value if it is present. Otherwise returns empty
348-
/// stirng.
349-
static StringRef computeFunctionCategoryFromStringMetadata(const Function &F,
350-
StringRef AttrName) {
351-
return F.getFnAttribute(AttrName).getValueAsString();
352-
}
353-
354347
static EntryPointGroupVec selectEntryPointGroups(const Module &M,
355348
IRSplitMode Mode) {
356349
// std::map is used here to ensure stable ordering of entry point groups,
@@ -368,7 +361,7 @@ static EntryPointGroupVec selectEntryPointGroups(const Module &M,
368361
Key = F.getName();
369362
break;
370363
case IRSplitMode::IRSM_PER_TU:
371-
Key = computeFunctionCategoryFromStringMetadata(F, ATTR_SYCL_MODULE_ID);
364+
Key = F.getFnAttribute(ATTR_SYCL_MODULE_ID).getValueAsString();
372365
break;
373366
case IRSplitMode::IRSM_NONE:
374367
llvm_unreachable("");

llvm/tools/llvm-split/llvm-split.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,19 @@ static cl::opt<std::string>
7676
MCPU("mcpu", cl::desc("Target CPU, ignored if --mtriple is not used"),
7777
cl::value_desc("cpu"), cl::cat(SplitCategory));
7878

79-
cl::opt<IRSplitMode> SYCLSplitMode(
80-
"sycl-split", cl::desc("module split mode"), cl::Optional,
81-
cl::init(IRSplitMode::IRSM_NONE),
79+
static cl::opt<IRSplitMode> SYCLSplitMode(
80+
"sycl-split",
81+
cl::desc("SYCL Split Mode. If present, SYCL splitting algorithm is used "
82+
"with the specified mode."),
83+
cl::Optional, cl::init(IRSplitMode::IRSM_NONE),
8284
cl::values(clEnumValN(IRSplitMode::IRSM_PER_TU, "source",
8385
"1 ouptput module per translation unit"),
8486
clEnumValN(IRSplitMode::IRSM_PER_KERNEL, "kernel",
8587
"1 output module per kernel")),
8688
cl::cat(SplitCategory));
8789

88-
cl::opt<bool> OutputAssembly{"S", cl::desc("Write output as LLVM assembly"),
89-
cl::cat(SplitCategory)};
90+
static cl::opt<bool> OutputAssembly{
91+
"S", cl::desc("Write output as LLVM assembly"), cl::cat(SplitCategory)};
9092

9193
void writeStringToFile(std::string_view Content, StringRef Path) {
9294
std::error_code EC;

0 commit comments

Comments
 (0)