[llvm] [llvm][PGOCtxProfLowering] Avoid Type::getPointerTo() (NFC) (PR #111857)
Youngsuk Kim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 08:25:34 PDT 2024
https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/111857
`Type::getPointerTo()` is to be deprecated & removed soon.
>From cb8006a14c118f80ac58c6c71e87f68ada3d4919 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim <youngsuk.kim at hpe.com>
Date: Wed, 9 Oct 2024 06:18:41 -0500
Subject: [PATCH] [llvm][PGOCtxProfLowering] Avoid Type::getPointerTo() (NFC)
`Type::getPointerTo()` is to be deprecated & removed soon.
---
.../Instrumentation/PGOCtxProfLowering.cpp | 23 +++++++++----------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
index b620306628729b..e7b7c26c493e50 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
@@ -154,15 +154,15 @@ CtxInstrumentationLowerer::CtxInstrumentationLowerer(Module &M,
StartCtx = cast<Function>(
M.getOrInsertFunction(
CompilerRtAPINames::StartCtx,
- FunctionType::get(ContextNodeTy->getPointerTo(),
- {ContextRootTy->getPointerTo(), /*ContextRoot*/
+ FunctionType::get(PointerTy,
+ {PointerTy, /*ContextRoot*/
I64Ty, /*Guid*/ I32Ty,
/*NumCounters*/ I32Ty /*NumCallsites*/},
false))
.getCallee());
GetCtx = cast<Function>(
M.getOrInsertFunction(CompilerRtAPINames::GetCtx,
- FunctionType::get(ContextNodeTy->getPointerTo(),
+ FunctionType::get(PointerTy,
{PointerTy, /*Callee*/
I64Ty, /*Guid*/
I32Ty, /*NumCounters*/
@@ -170,13 +170,12 @@ CtxInstrumentationLowerer::CtxInstrumentationLowerer(Module &M,
false))
.getCallee());
ReleaseCtx = cast<Function>(
- M.getOrInsertFunction(
- CompilerRtAPINames::ReleaseCtx,
- FunctionType::get(Type::getVoidTy(M.getContext()),
- {
- ContextRootTy->getPointerTo(), /*ContextRoot*/
- },
- false))
+ M.getOrInsertFunction(CompilerRtAPINames::ReleaseCtx,
+ FunctionType::get(Type::getVoidTy(M.getContext()),
+ {
+ PointerTy, /*ContextRoot*/
+ },
+ false))
.getCallee());
// Declare the TLSes we will need to use.
@@ -264,7 +263,7 @@ bool CtxInstrumentationLowerer::lowerFunction(Function &F) {
auto *Index = Builder.CreateAnd(CtxAsInt, Builder.getInt64(1));
// The GEPs corresponding to that index, in the respective TLS.
ExpectedCalleeTLSAddr = Builder.CreateGEP(
- Builder.getInt8Ty()->getPointerTo(),
+ PointerType::getUnqual(F.getContext()),
Builder.CreateThreadLocalAddress(ExpectedCalleeTLS), {Index});
CallsiteInfoTLSAddr = Builder.CreateGEP(
Builder.getInt32Ty(),
@@ -277,7 +276,7 @@ bool CtxInstrumentationLowerer::lowerFunction(Function &F) {
// with counters) stays the same.
RealContext = Builder.CreateIntToPtr(
Builder.CreateAnd(CtxAsInt, Builder.getInt64(-2)),
- ThisContextType->getPointerTo());
+ PointerType::getUnqual(F.getContext()));
I.eraseFromParent();
break;
}
More information about the llvm-commits
mailing list