Skip to content

Commit bda11f6

Browse files
committed
Apply suggestions
1 parent e0251be commit bda11f6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

llvm/tools/sycl-post-link/sycl-post-link.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,23 +272,22 @@ static void collectKernelModuleMap(
272272
}
273273
}
274274

275-
// Collect all the dependencies for the function.
276-
static bool collectFunctionCallGraphNodes(llvm::Function *Func) {
275+
// Go through function call graph searching for assert call.
276+
static bool hasAssertInFunctionCallGraph(llvm::Function *Func) {
277277
std::vector<llvm::Function *> Workqueue;
278278
Workqueue.push_back(Func);
279279

280280
while (!Workqueue.empty()) {
281-
Function *F = &*Workqueue.back(); // To remove &*
281+
Function *F = Workqueue.back();
282282
Workqueue.pop_back();
283283
for (auto &I : instructions(F)) {
284284
if (CallBase *CB = dyn_cast<CallBase>(&I))
285-
if (Function *CF = CB->getCalledFunction())
286-
if (!CF->isDeclaration()) {
287-
if (CF->getName().startswith("__devicelib_assert_fail")) {
288-
return true;
289-
}
285+
if (Function *CF = CB->getCalledFunction()) {
286+
if (CF->getName().startswith("__devicelib_assert_fail"))
287+
return true;
288+
if (!CF->isDeclaration())
290289
Workqueue.push_back(CF);
291-
}
290+
}
292291
}
293292
}
294293
return false;
@@ -491,7 +490,7 @@ static string_vector saveDeviceImageProperty(
491490
std::vector<Function *> SyclKernels;
492491
for (auto &F : M->functions()) {
493492
if (F.getCallingConv() == CallingConv::SPIR_KERNEL) {
494-
if (collectFunctionCallGraphNodes(&F)) {
493+
if (hasAssertInFunctionCallGraph(&F)) {
495494
SyclKernels.push_back(&F);
496495
PropSet[llvm::util::PropertySetRegistry::SYCL_ASSERT_USED].insert(
497496
{F.getName(), true});

0 commit comments

Comments
 (0)