Skip to content

Commit

Permalink
[llvm][PGOCtxProfLowering] Avoid Type::getPointerTo() (NFC) (#111857)
Browse files Browse the repository at this point in the history
`Type::getPointerTo()` is to be deprecated & removed soon.
  • Loading branch information
JOE1994 authored Oct 10, 2024
1 parent d5e1de6 commit f0ed31c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,28 @@ 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*/
I32Ty}, /*NumCallsites*/
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.
Expand Down Expand Up @@ -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(),
Expand All @@ -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;
}
Expand Down

0 comments on commit f0ed31c

Please sign in to comment.