diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 41b5e9735b584..5dcb7d5f16e04 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1409,7 +1409,7 @@ PreservedAnalyses AddressSanitizerPass::run(Module &M, const StackSafetyGlobalInfo *const SSGI = ClUseStackSafety ? &MAM.getResult(M) : nullptr; - if (Triple(M.getTargetTriple()).isSPIR()) { + if (Triple(M.getTargetTriple()).isSPIROrSPIRV()) { bool HasESIMDKernel = false; // ESIMD kernel doesn't support noinline functions, so we can't @@ -1565,7 +1565,7 @@ void AddressSanitizer::AppendDebugInfoToArgs(Instruction *InsertBefore, Value *AddressSanitizer::memToShadow(Value *Shadow, IRBuilder<> &IRB, uint32_t AddressSpace) { - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { return IRB.CreateCall( AsanMemToShadow, {Shadow, ConstantInt::get(IRB.getInt32Ty(), AddressSpace)}, @@ -1718,7 +1718,7 @@ bool AddressSanitizer::isInterestingAlloca(const AllocaInst &AI) { bool AddressSanitizer::ignoreAccess(Instruction *Inst, Value *Ptr) { // SPIR has its own rules to filter the instrument accesses - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { if (isUnsupportedSPIRAccess(Ptr, Inst->getFunction())) return true; } else { @@ -2212,7 +2212,7 @@ void AddressSanitizer::instrumentAddress(Instruction *OrigIns, Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy); if (UseCalls) { if (Exp == 0) { - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { SmallVector Args; Args.push_back(AddrLong); AppendDebugInfoToArgs(InsertBefore, Addr, Args); @@ -2294,7 +2294,7 @@ void AddressSanitizer::instrumentUnusualSizeOrAlignment( Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy); if (UseCalls) { if (Exp == 0) { - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { SmallVector Args; Args.push_back(AddrLong); Args.push_back(Size); @@ -3126,7 +3126,7 @@ bool ModuleAddressSanitizer::instrumentModule(Module &M) { } } - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { // Add module metadata "device.sanitizer" for sycl-post-link LLVMContext &Ctx = M.getContext(); auto *MD = M.getOrInsertNamedMetadata("device.sanitizer"); @@ -3189,7 +3189,7 @@ void AddressSanitizer::initializeCallbacks(Module &M, const TargetLibraryInfo *T // unsigned int line, // char* func // ) - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { auto *Int8PtrTy = Type::getInt8Ty(*C)->getPointerTo(kSpirOffloadConstantAS); @@ -3250,7 +3250,7 @@ void AddressSanitizer::initializeCallbacks(Module &M, const TargetLibraryInfo *T AsanShadowGlobal = M.getOrInsertGlobal("__asan_shadow", ArrayType::get(IRB.getInt8Ty(), 0)); - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { // __asan_set_shadow_static_local( // uptr ptr, // size_t size, @@ -3375,7 +3375,7 @@ bool AddressSanitizer::instrumentFunction(Function &F, if (!ClDebugFunc.empty() && ClDebugFunc == F.getName()) return false; if (F.getName().starts_with("__asan_")) return false; - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { if (F.getName().contains("__sycl_service_kernel__")) return false; // Skip referenced-indirectly function as we insert access to shared local @@ -3471,7 +3471,7 @@ bool AddressSanitizer::instrumentFunction(Function &F, NoReturnCalls.push_back(CB); } if (CallInst *CI = dyn_cast(&Inst)) { - if (TargetTriple.isSPIR() && CI->getCalledFunction() && + if (TargetTriple.isSPIROrSPIRV() && CI->getCalledFunction() && CI->getCalledFunction()->getCallingConv() == llvm::CallingConv::SPIR_FUNC && CI->getCalledFunction()->getName() == @@ -3501,7 +3501,7 @@ bool AddressSanitizer::instrumentFunction(Function &F, F.getParent()->getDataLayout(), RTCI); FunctionModified = true; } - if (TargetTriple.isSPIR()) { + if (TargetTriple.isSPIROrSPIRV()) { for (auto *CI : SyclAllocateLocalMemoryCalls) { instrumentSyclStaticLocalMemory(CI); FunctionModified = true; @@ -4027,7 +4027,7 @@ void FunctionStackPoisoner::processStaticAllocas() { // The left-most redzone has enough space for at least 4 pointers. Value *BasePlus0 = IRB.CreateIntToPtr(LocalStackBase, IntptrPtrTy); // SPIRV doesn't use the following metadata - if (!TargetTriple.isSPIR()) { + if (!TargetTriple.isSPIROrSPIRV()) { // Write the Magic value to redzone[0]. IRB.CreateStore(ConstantInt::get(IntptrTy, kCurrentStackFrameMagic), BasePlus0);