[llvm] 6229cd0 - [CodeGen] Drop some references to getInt8PtrTy. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 00:29:03 PST 2023
Author: Fangrui Song
Date: 2023-11-14T00:28:58-08:00
New Revision: 6229cd0272a84bbfaeda171c3d502e864e85e173
URL: https://github.com/llvm/llvm-project/commit/6229cd0272a84bbfaeda171c3d502e864e85e173
DIFF: https://github.com/llvm/llvm-project/commit/6229cd0272a84bbfaeda171c3d502e864e85e173.diff
LOG: [CodeGen] Drop some references to getInt8PtrTy. NFC
Similar to https://reviews.llvm.org/D157550
Added:
Modified:
llvm/lib/CodeGen/SjLjEHPrepare.cpp
llvm/lib/CodeGen/StackProtector.cpp
llvm/lib/CodeGen/WasmEHPrepare.cpp
llvm/lib/Target/X86/X86LowerAMXType.cpp
llvm/lib/Target/X86/X86WinEHState.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp
index 1df1a464a54b0d0..0ee09c83565f57a 100644
--- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp
+++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp
@@ -200,7 +200,7 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F,
Value *ExceptionAddr = Builder.CreateConstGEP2_32(doubleUnderDataTy, FCData,
0, 0, "exception_gep");
Value *ExnVal = Builder.CreateLoad(DataTy, ExceptionAddr, true, "exn_val");
- ExnVal = Builder.CreateIntToPtr(ExnVal, Builder.getInt8PtrTy());
+ ExnVal = Builder.CreateIntToPtr(ExnVal, Builder.getPtrTy());
Value *SelectorAddr = Builder.CreateConstGEP2_32(doubleUnderDataTy, FCData,
0, 1, "exn_selector_gep");
@@ -218,9 +218,8 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F,
Value *PersonalityFn = F.getPersonalityFn();
Value *PersonalityFieldPtr = Builder.CreateConstGEP2_32(
FunctionContextTy, FuncCtx, 0, 3, "pers_fn_gep");
- Builder.CreateStore(
- Builder.CreateBitCast(PersonalityFn, Builder.getInt8PtrTy()),
- PersonalityFieldPtr, /*isVolatile=*/true);
+ Builder.CreateStore(Builder.CreateBitCast(PersonalityFn, Builder.getPtrTy()),
+ PersonalityFieldPtr, /*isVolatile=*/true);
// LSDA address
Value *LSDA = Builder.CreateCall(LSDAAddrFn, {}, "lsda_addr");
@@ -418,7 +417,7 @@ bool SjLjEHPrepare::setupEntryBlockAndCallSites(Function &F) {
// Store a pointer to the function context so that the back-end will know
// where to look for it.
- Value *FuncCtxArg = Builder.CreateBitCast(FuncCtx, Builder.getInt8PtrTy());
+ Value *FuncCtxArg = Builder.CreateBitCast(FuncCtx, Builder.getPtrTy());
Builder.CreateCall(FuncCtxFn, FuncCtxArg);
// At this point, we are all set up, update the invoke instructions to mark
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index 71676843eaf907d..9a4d7ff328e7797 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -418,7 +418,7 @@ static Value *getStackGuard(const TargetLoweringBase *TLI, Module *M,
Value *Guard = TLI->getIRStackGuard(B);
StringRef GuardMode = M->getStackProtectorGuard();
if ((GuardMode == "tls" || GuardMode.empty()) && Guard)
- return B.CreateLoad(B.getInt8PtrTy(), Guard, true, "StackGuard");
+ return B.CreateLoad(B.getPtrTy(), Guard, true, "StackGuard");
// Use SelectionDAG SSP handling, since there isn't an IR guard.
//
@@ -539,7 +539,7 @@ bool StackProtector::InsertStackProtectors() {
// Generate the function-based epilogue instrumentation.
// The target provides a guard check function, generate a call to it.
IRBuilder<> B(CheckLoc);
- LoadInst *Guard = B.CreateLoad(B.getInt8PtrTy(), AI, true, "Guard");
+ LoadInst *Guard = B.CreateLoad(B.getPtrTy(), AI, true, "Guard");
CallInst *Call = B.CreateCall(GuardCheck, {Guard});
Call->setAttributes(GuardCheck->getAttributes());
Call->setCallingConv(GuardCheck->getCallingConv());
@@ -578,7 +578,7 @@ bool StackProtector::InsertStackProtectors() {
IRBuilder<> B(CheckLoc);
Value *Guard = getStackGuard(TLI, M, B);
- LoadInst *LI2 = B.CreateLoad(B.getInt8PtrTy(), AI, true);
+ LoadInst *LI2 = B.CreateLoad(B.getPtrTy(), AI, true);
auto *Cmp = cast<ICmpInst>(B.CreateICmpNE(Guard, LI2));
auto SuccessProb =
BranchProbabilityInfo::getBranchProbStackProtector(true);
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index aa83db275f6466e..d99b10f4207f9e8 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -136,9 +136,9 @@ FunctionPass *llvm::createWasmEHPass() { return new WasmEHPrepare(); }
bool WasmEHPrepare::doInitialization(Module &M) {
IRBuilder<> IRB(M.getContext());
- LPadContextTy = StructType::get(IRB.getInt32Ty(), // lpad_index
- IRB.getInt8PtrTy(), // lsda
- IRB.getInt32Ty() // selector
+ LPadContextTy = StructType::get(IRB.getInt32Ty(), // lpad_index
+ IRB.getPtrTy(), // lsda
+ IRB.getInt32Ty() // selector
);
return false;
}
@@ -249,8 +249,8 @@ bool WasmEHPrepare::prepareEHPads(Function &F) {
CatchF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_catch);
// _Unwind_CallPersonality() wrapper function, which calls the personality
- CallPersonalityF = M.getOrInsertFunction(
- "_Unwind_CallPersonality", IRB.getInt32Ty(), IRB.getInt8PtrTy());
+ CallPersonalityF = M.getOrInsertFunction("_Unwind_CallPersonality",
+ IRB.getInt32Ty(), IRB.getPtrTy());
if (Function *F = dyn_cast<Function>(CallPersonalityF.getCallee()))
F->setDoesNotThrow();
diff --git a/llvm/lib/Target/X86/X86LowerAMXType.cpp b/llvm/lib/Target/X86/X86LowerAMXType.cpp
index cea8b80dd13f22c..a57c0fe15788409 100644
--- a/llvm/lib/Target/X86/X86LowerAMXType.cpp
+++ b/llvm/lib/Target/X86/X86LowerAMXType.cpp
@@ -457,7 +457,7 @@ static Value *getAllocaPos(BasicBlock *BB) {
BasicBlock::iterator Iter = AllocaRes->getIterator();
++Iter;
Builder.SetInsertPoint(&*Iter);
- Value *I8Ptr = Builder.CreateBitCast(AllocaRes, Builder.getInt8PtrTy());
+ Value *I8Ptr = Builder.CreateBitCast(AllocaRes, Builder.getPtrTy());
return I8Ptr;
}
@@ -934,8 +934,7 @@ bool X86LowerAMXCast::combineCastStore(IntrinsicInst *Cast, StoreInst *ST) {
IRBuilder<> Builder(ST);
// Stride should be equal to col(measured by bytes)
Value *Stride = Builder.CreateSExt(Col, Builder.getInt64Ty());
- Value *I8Ptr =
- Builder.CreateBitCast(ST->getOperand(1), Builder.getInt8PtrTy());
+ Value *I8Ptr = Builder.CreateBitCast(ST->getOperand(1), Builder.getPtrTy());
std::array<Value *, 5> Args = {Row, Col, I8Ptr, Stride, Tile};
Builder.CreateIntrinsic(Intrinsic::x86_tilestored64_internal, std::nullopt,
Args);
@@ -975,10 +974,10 @@ bool X86LowerAMXCast::combineLoadCast(IntrinsicInst *Cast, LoadInst *LD) {
Builder.CreateStore(LD, AllocaAddr);
Builder.SetInsertPoint(Cast);
- I8Ptr = Builder.CreateBitCast(AllocaAddr, Builder.getInt8PtrTy());
+ I8Ptr = Builder.CreateBitCast(AllocaAddr, Builder.getPtrTy());
EraseLoad = false;
} else {
- I8Ptr = Builder.CreateBitCast(LD->getOperand(0), Builder.getInt8PtrTy());
+ I8Ptr = Builder.CreateBitCast(LD->getOperand(0), Builder.getPtrTy());
}
std::array<Value *, 4> Args = {Row, Col, I8Ptr, Stride};
@@ -1137,7 +1136,7 @@ bool X86LowerAMXCast::transformAMXCast(IntrinsicInst *AMXCast) {
auto Prepare = [&](Type *MemTy) {
AllocaAddr = createAllocaInstAtEntry(Builder, AMXCast->getParent(), MemTy);
- I8Ptr = Builder.CreateBitCast(AllocaAddr, Builder.getInt8PtrTy());
+ I8Ptr = Builder.CreateBitCast(AllocaAddr, Builder.getPtrTy());
Stride = Builder.getInt64(64);
};
diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index 11d9509c707b33b..e041c121679a83f 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -275,7 +275,7 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
Type *RegNodeTy;
IRBuilder<> Builder(&F->getEntryBlock(), F->getEntryBlock().begin());
- Type *Int8PtrType = Builder.getInt8PtrTy();
+ Type *Int8PtrType = Builder.getPtrTy();
Type *Int32Ty = Builder.getInt32Ty();
Type *VoidTy = Builder.getVoidTy();
@@ -336,7 +336,7 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
Value *FrameAddr = Builder.CreateCall(
Intrinsic::getDeclaration(
TheModule, Intrinsic::frameaddress,
- Builder.getInt8PtrTy(
+ Builder.getPtrTy(
TheModule->getDataLayout().getAllocaAddrSpace())),
Builder.getInt32(0), "frameaddr");
Value *FrameAddrI32 = Builder.CreatePtrToInt(FrameAddr, Int32Ty);
@@ -475,7 +475,7 @@ void WinEHStatePass::rewriteSetJmpCall(IRBuilder<> &Builder, Function &F,
SmallVector<Value *, 5> Args;
Args.push_back(
- Builder.CreateBitCast(Call.getArgOperand(0), Builder.getInt8PtrTy()));
+ Builder.CreateBitCast(Call.getArgOperand(0), Builder.getPtrTy()));
Args.push_back(Builder.getInt32(OptionalArgs.size()));
Args.append(OptionalArgs.begin(), OptionalArgs.end());
@@ -622,7 +622,7 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) {
// Mark the registration node. The backend needs to know which alloca it is so
// that it can recover the original frame pointer.
IRBuilder<> Builder(RegNode->getNextNode());
- Value *RegNodeI8 = Builder.CreateBitCast(RegNode, Builder.getInt8PtrTy());
+ Value *RegNodeI8 = Builder.CreateBitCast(RegNode, Builder.getPtrTy());
Builder.CreateCall(
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_seh_ehregnode),
{RegNodeI8});
@@ -630,7 +630,7 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) {
if (EHGuardNode) {
IRBuilder<> Builder(EHGuardNode->getNextNode());
Value *EHGuardNodeI8 =
- Builder.CreateBitCast(EHGuardNode, Builder.getInt8PtrTy());
+ Builder.CreateBitCast(EHGuardNode, Builder.getPtrTy());
Builder.CreateCall(
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_seh_ehguard),
{EHGuardNodeI8});
More information about the llvm-commits
mailing list