Skip to content

Commit 6dd3525

Browse files
authored
[DevASAN] Remove usage of deprecated getPointerTo from AddressSanitizer (#16273)
llvm/llvm-project#113331 deprecates usage of getPointerTo, llvm::PointerType::get is recommended instead. This updates AddressSanitizer to use the recommended function in place of the deprecated one. Signed-off-by: Demchuk, Tennyson <[email protected]>
1 parent 336b89e commit 6dd3525

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ static void ExtendSpirKernelArgs(Module &M, FunctionAnalysisManager &FAM,
13791379
}
13801380

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

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

@@ -1704,7 +1704,7 @@ void AddressSanitizer::AppendDebugInfoToArgs(Instruction *InsertBefore,
17041704

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

17091709
// File & Line
17101710
if (Loc) {
@@ -1863,9 +1863,9 @@ void AddressSanitizer::instrumentInitAsanLaunchInfo(
18631863
// FIXME: if the initial value of "__AsanLaunchInfo" is zero, we'll not need
18641864
// this step
18651865
initializeCallbacks(TLI);
1866-
IRB.CreateStore(
1867-
ConstantPointerNull::get(IntptrTy->getPointerTo(kSpirOffloadGlobalAS)),
1868-
AsanLaunchInfo);
1866+
IRB.CreateStore(ConstantPointerNull::get(
1867+
llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS)),
1868+
AsanLaunchInfo);
18691869
}
18701870

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

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

35763576
AsanLaunchInfo = M.getOrInsertGlobal(
3577-
"__AsanLaunchInfo", IntptrTy->getPointerTo(kSpirOffloadGlobalAS), [&] {
3577+
"__AsanLaunchInfo",
3578+
llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS), [&] {
35783579
return new GlobalVariable(
3579-
M, IntptrTy->getPointerTo(kSpirOffloadGlobalAS), false,
3580+
M, llvm::PointerType::get(IntptrTy, kSpirOffloadGlobalAS), false,
35803581
GlobalVariable::ExternalLinkage, nullptr, "__AsanLaunchInfo",
35813582
nullptr, GlobalVariable::NotThreadLocal, kSpirOffloadLocalAS);
35823583
});

0 commit comments

Comments
 (0)