Skip to content

[DevASAN] Remove usage of deprecated getPointerTo from AddressSanitizer #16273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ static void ExtendSpirKernelArgs(Module &M, FunctionAnalysisManager &FAM,
}

// New argument: uintptr_t as(1)*, which is allocated in shared USM buffer
Types.push_back(IntptrTy->getPointerTo(kSpirOffloadGlobalAS));
Types.push_back(llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS));

FunctionType *NewFTy = FunctionType::get(F->getReturnType(), Types, false);

Expand Down Expand Up @@ -1704,7 +1704,7 @@ void AddressSanitizer::AppendDebugInfoToArgs(Instruction *InsertBefore,

// SPIR constant address space
PointerType *ConstASPtrTy =
Type::getInt8Ty(C)->getPointerTo(kSpirOffloadConstantAS);
llvm::PointerType::get(Type::getInt8Ty(C), kSpirOffloadConstantAS);

// File & Line
if (Loc) {
Expand Down Expand Up @@ -1863,9 +1863,9 @@ void AddressSanitizer::instrumentInitAsanLaunchInfo(
// FIXME: if the initial value of "__AsanLaunchInfo" is zero, we'll not need
// this step
initializeCallbacks(TLI);
IRB.CreateStore(
ConstantPointerNull::get(IntptrTy->getPointerTo(kSpirOffloadGlobalAS)),
AsanLaunchInfo);
IRB.CreateStore(ConstantPointerNull::get(
llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS)),
AsanLaunchInfo);
}

// Instrument memset/memmove/memcpy
Expand Down Expand Up @@ -3457,7 +3457,7 @@ void AddressSanitizer::initializeCallbacks(const TargetLibraryInfo *TLI) {
// )
if (TargetTriple.isSPIROrSPIRV()) {
auto *Int8PtrTy =
Type::getInt8Ty(*C)->getPointerTo(kSpirOffloadConstantAS);
llvm::PointerType::get(Type::getInt8Ty(*C), kSpirOffloadConstantAS);

Args1.push_back(Int8PtrTy); // file
Args1.push_back(Type::getInt32Ty(*C)); // line
Expand Down Expand Up @@ -3574,9 +3574,10 @@ void AddressSanitizer::initializeCallbacks(const TargetLibraryInfo *TLI) {
IRB.getVoidTy(), IntptrTy, Int32Ty);

AsanLaunchInfo = M.getOrInsertGlobal(
"__AsanLaunchInfo", IntptrTy->getPointerTo(kSpirOffloadGlobalAS), [&] {
"__AsanLaunchInfo",
llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS), [&] {
return new GlobalVariable(
M, IntptrTy->getPointerTo(kSpirOffloadGlobalAS), false,
M, llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS), false,
GlobalVariable::ExternalLinkage, nullptr, "__AsanLaunchInfo",
nullptr, GlobalVariable::NotThreadLocal, kSpirOffloadLocalAS);
});
Expand Down
Loading