@@ -272,23 +272,22 @@ static void collectKernelModuleMap(
272
272
}
273
273
}
274
274
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) {
277
277
std::vector<llvm::Function *> Workqueue;
278
278
Workqueue.push_back (Func);
279
279
280
280
while (!Workqueue.empty ()) {
281
- Function *F = &* Workqueue.back (); // To remove &*
281
+ Function *F = Workqueue.back ();
282
282
Workqueue.pop_back ();
283
283
for (auto &I : instructions (F)) {
284
284
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 ())
290
289
Workqueue.push_back (CF);
291
- }
290
+ }
292
291
}
293
292
}
294
293
return false ;
@@ -491,7 +490,7 @@ static string_vector saveDeviceImageProperty(
491
490
std::vector<Function *> SyclKernels;
492
491
for (auto &F : M->functions ()) {
493
492
if (F.getCallingConv () == CallingConv::SPIR_KERNEL) {
494
- if (collectFunctionCallGraphNodes (&F)) {
493
+ if (hasAssertInFunctionCallGraph (&F)) {
495
494
SyclKernels.push_back (&F);
496
495
PropSet[llvm::util::PropertySetRegistry::SYCL_ASSERT_USED].insert (
497
496
{F.getName (), true });
0 commit comments