@@ -1333,13 +1333,27 @@ static void ExtendSpirKernelArgs(Module &M, FunctionAnalysisManager &FAM,
13331333
13341334 if (!HasESIMD)
13351335 for (Function &F : M) {
1336- if (F.getCallingConv () != CallingConv::SPIR_KERNEL)
1337- continue ;
1338-
13391336 if (!F.hasFnAttribute (Attribute::SanitizeAddress) ||
13401337 F.hasFnAttribute (Attribute::DisableSanitizerInstrumentation))
13411338 continue ;
13421339
1340+ if (F.getName ().contains (" __sycl_service_kernel__" )) {
1341+ F.addFnAttr (Attribute::DisableSanitizerInstrumentation);
1342+ continue ;
1343+ }
1344+
1345+ // Skip referenced-indirectly function as we insert access to shared
1346+ // local memory (SLM) __AsanLaunchInfo and access to SLM in
1347+ // referenced-indirectly function isn't supported yet in
1348+ // intel-graphics-compiler.
1349+ if (F.hasFnAttribute (" referenced-indirectly" )) {
1350+ F.addFnAttr (Attribute::DisableSanitizerInstrumentation);
1351+ continue ;
1352+ }
1353+
1354+ if (F.getCallingConv () != CallingConv::SPIR_KERNEL)
1355+ continue ;
1356+
13431357 SpirFixupKernels.emplace_back (&F);
13441358
13451359 auto KernelName = F.getName ();
@@ -3683,16 +3697,6 @@ bool AddressSanitizer::instrumentFunction(Function &F,
36833697 if (F.isPresplitCoroutine ())
36843698 return false ;
36853699
3686- if (TargetTriple.isSPIROrSPIRV ()) {
3687- if (F.getName ().contains (" __sycl_service_kernel__" ))
3688- return false ;
3689- // Skip referenced-indirectly function as we insert access to shared local
3690- // memory (SLM) __AsanLaunchInfo and access to SLM in referenced-indirectly
3691- // function isn't supported yet in intel-graphics-compiler.
3692- if (F.hasFnAttribute (" referenced-indirectly" ))
3693- return false ;
3694- }
3695-
36963700 bool FunctionModified = false ;
36973701
36983702 // Do not apply any instrumentation for naked functions.
0 commit comments