@@ -1332,15 +1332,15 @@ static void ExtendSpirKernelArgs(Module &M, FunctionAnalysisManager &FAM) {
13321332 if (F.getCallingConv () != CallingConv::SPIR_KERNEL)
13331333 continue ;
13341334
1335- auto KernelName = F.getName ();
1336- auto *KernelNameGV = GetOrCreateGlobalString (M, " __asan_kernel" , KernelName,
1337- kSpirOffloadGlobalAS );
1338-
13391335 if (!F.hasFnAttribute (Attribute::SanitizeAddress) ||
13401336 F.hasFnAttribute (Attribute::DisableSanitizerInstrumentation))
13411337 continue ;
13421338
13431339 SpirFixupKernels.emplace_back (&F);
1340+
1341+ auto KernelName = F.getName ();
1342+ auto *KernelNameGV = GetOrCreateGlobalString (M, " __asan_kernel" , KernelName,
1343+ kSpirOffloadGlobalAS );
13441344 SpirKernelsMetadata.emplace_back (ConstantStruct::get (
13451345 StructTy, ConstantExpr::getPointerCast (KernelNameGV, IntptrTy),
13461346 ConstantInt::get (IntptrTy, KernelName.size ())));
@@ -1528,10 +1528,8 @@ PreservedAnalyses AddressSanitizerPass::run(Module &M,
15281528 Options.UseAfterScope , Options.UseAfterReturn );
15291529 const TargetLibraryInfo &TLI = FAM.getResult <TargetLibraryAnalysis>(F);
15301530 Modified |= FunctionSanitizer.instrumentFunction (F, &TLI);
1531- if (F.getCallingConv () == CallingConv::SPIR_KERNEL) {
1531+ if (F.getCallingConv () == CallingConv::SPIR_KERNEL)
15321532 FunctionSanitizer.instrumentInitAsanLaunchInfo (F, &TLI);
1533- Modified = true ;
1534- }
15351533 }
15361534 Modified |= ModuleSanitizer.instrumentModule ();
15371535 if (!Modified)
@@ -1829,6 +1827,8 @@ void AddressSanitizer::instrumentInitAsanLaunchInfo(
18291827 return ;
18301828 }
18311829 }
1830+ // FIXME: if the initial value of "__AsanLaunchInfo" is zero, we'll not need
1831+ // this step
18321832 initializeCallbacks (TLI);
18331833 IRB.CreateStore (
18341834 ConstantPointerNull::get (IntptrTy->getPointerTo (kSpirOffloadGlobalAS )),
0 commit comments