Skip to content

Commit 7b9d73c

Browse files
authored
[NFC] Remove Type::getInt8PtrTy (#71029)
Replace this with PointerType::getUnqual(). Followup to the opaque pointer transition. Fixes an in-code TODO item.
1 parent 75d6795 commit 7b9d73c

File tree

63 files changed

+229
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+229
-214
lines changed

clang/lib/CodeGen/CGGPUBuiltin.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ using namespace CodeGen;
2323

2424
namespace {
2525
llvm::Function *GetVprintfDeclaration(llvm::Module &M) {
26-
llvm::Type *ArgTypes[] = {llvm::Type::getInt8PtrTy(M.getContext()),
27-
llvm::Type::getInt8PtrTy(M.getContext())};
26+
llvm::Type *ArgTypes[] = {llvm::PointerType::getUnqual(M.getContext()),
27+
llvm::PointerType::getUnqual(M.getContext())};
2828
llvm::FunctionType *VprintfFuncType = llvm::FunctionType::get(
2929
llvm::Type::getInt32Ty(M.getContext()), ArgTypes, false);
3030

@@ -45,8 +45,8 @@ llvm::Function *GetVprintfDeclaration(llvm::Module &M) {
4545
llvm::Function *GetOpenMPVprintfDeclaration(CodeGenModule &CGM) {
4646
const char *Name = "__llvm_omp_vprintf";
4747
llvm::Module &M = CGM.getModule();
48-
llvm::Type *ArgTypes[] = {llvm::Type::getInt8PtrTy(M.getContext()),
49-
llvm::Type::getInt8PtrTy(M.getContext()),
48+
llvm::Type *ArgTypes[] = {llvm::PointerType::getUnqual(M.getContext()),
49+
llvm::PointerType::getUnqual(M.getContext()),
5050
llvm::Type::getInt32Ty(M.getContext())};
5151
llvm::FunctionType *VprintfFuncType = llvm::FunctionType::get(
5252
llvm::Type::getInt32Ty(M.getContext()), ArgTypes, false);
@@ -99,7 +99,8 @@ packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) {
9999
// Construct and fill the args buffer that we'll pass to vprintf.
100100
if (Args.size() <= 1) {
101101
// If there are no args, pass a null pointer and size 0
102-
llvm::Value * BufferPtr = llvm::ConstantPointerNull::get(llvm::Type::getInt8PtrTy(Ctx));
102+
llvm::Value *BufferPtr =
103+
llvm::ConstantPointerNull::get(llvm::PointerType::getUnqual(Ctx));
103104
return {BufferPtr, llvm::TypeSize::Fixed(0)};
104105
} else {
105106
llvm::SmallVector<llvm::Type *, 8> ArgTypes;
@@ -120,7 +121,7 @@ packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) {
120121
Builder.CreateAlignedStore(Arg, P, DL.getPrefTypeAlign(Arg->getType()));
121122
}
122123
llvm::Value *BufferPtr =
123-
Builder.CreatePointerCast(Alloca, llvm::Type::getInt8PtrTy(Ctx));
124+
Builder.CreatePointerCast(Alloca, llvm::PointerType::getUnqual(Ctx));
124125
return {BufferPtr, DL.getTypeAllocSize(AllocaTy)};
125126
}
126127
}

clang/lib/CodeGen/CodeGenTypes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
422422

423423
case BuiltinType::NullPtr:
424424
// Model std::nullptr_t as i8*
425-
ResultType = llvm::Type::getInt8PtrTy(getLLVMContext());
425+
ResultType = llvm::PointerType::getUnqual(getLLVMContext());
426426
break;
427427

428428
case BuiltinType::UInt128:

clang/lib/CodeGen/CoverageMappingGen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ void CoverageMappingModuleGen::emit() {
18201820
CGM.addUsedGlobal(CovData);
18211821
// Create the deferred function records array
18221822
if (!FunctionNames.empty()) {
1823-
auto NamesArrTy = llvm::ArrayType::get(llvm::Type::getInt8PtrTy(Ctx),
1823+
auto NamesArrTy = llvm::ArrayType::get(llvm::PointerType::getUnqual(Ctx),
18241824
FunctionNames.size());
18251825
auto NamesArrVal = llvm::ConstantArray::get(NamesArrTy, FunctionNames);
18261826
// This variable will *NOT* be emitted to the object file. It is used

clang/tools/clang-linker-wrapper/OffloadWrapper.cpp

+27-26
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum OffloadEntryKindFlag : uint32_t {
4040

4141
IntegerType *getSizeTTy(Module &M) {
4242
LLVMContext &C = M.getContext();
43-
switch (M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))) {
43+
switch (M.getDataLayout().getPointerTypeSize(PointerType::getUnqual(C))) {
4444
case 4u:
4545
return Type::getInt32Ty(C);
4646
case 8u:
@@ -60,9 +60,10 @@ StructType *getEntryTy(Module &M) {
6060
LLVMContext &C = M.getContext();
6161
StructType *EntryTy = StructType::getTypeByName(C, "__tgt_offload_entry");
6262
if (!EntryTy)
63-
EntryTy = StructType::create("__tgt_offload_entry", Type::getInt8PtrTy(C),
64-
Type::getInt8PtrTy(C), getSizeTTy(M),
65-
Type::getInt32Ty(C), Type::getInt32Ty(C));
63+
EntryTy =
64+
StructType::create("__tgt_offload_entry", PointerType::getUnqual(C),
65+
PointerType::getUnqual(C), getSizeTTy(M),
66+
Type::getInt32Ty(C), Type::getInt32Ty(C));
6667
return EntryTy;
6768
}
6869

@@ -80,9 +81,9 @@ StructType *getDeviceImageTy(Module &M) {
8081
LLVMContext &C = M.getContext();
8182
StructType *ImageTy = StructType::getTypeByName(C, "__tgt_device_image");
8283
if (!ImageTy)
83-
ImageTy = StructType::create("__tgt_device_image", Type::getInt8PtrTy(C),
84-
Type::getInt8PtrTy(C), getEntryPtrTy(M),
85-
getEntryPtrTy(M));
84+
ImageTy = StructType::create(
85+
"__tgt_device_image", PointerType::getUnqual(C),
86+
PointerType::getUnqual(C), getEntryPtrTy(M), getEntryPtrTy(M));
8687
return ImageTy;
8788
}
8889

@@ -284,17 +285,17 @@ StructType *getFatbinWrapperTy(Module &M) {
284285
LLVMContext &C = M.getContext();
285286
StructType *FatbinTy = StructType::getTypeByName(C, "fatbin_wrapper");
286287
if (!FatbinTy)
287-
FatbinTy = StructType::create("fatbin_wrapper", Type::getInt32Ty(C),
288-
Type::getInt32Ty(C), Type::getInt8PtrTy(C),
289-
Type::getInt8PtrTy(C));
288+
FatbinTy = StructType::create(
289+
"fatbin_wrapper", Type::getInt32Ty(C), Type::getInt32Ty(C),
290+
PointerType::getUnqual(C), PointerType::getUnqual(C));
290291
return FatbinTy;
291292
}
292293

293294
/// Embed the image \p Image into the module \p M so it can be found by the
294295
/// runtime.
295296
GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) {
296297
LLVMContext &C = M.getContext();
297-
llvm::Type *Int8PtrTy = Type::getInt8PtrTy(C);
298+
llvm::Type *Int8PtrTy = PointerType::getUnqual(C);
298299
llvm::Triple Triple = llvm::Triple(M.getTargetTriple());
299300

300301
// Create the global string containing the fatbinary.
@@ -315,7 +316,7 @@ GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) {
315316
ConstantInt::get(Type::getInt32Ty(C), IsHIP ? HIPFatMagic : CudaFatMagic),
316317
ConstantInt::get(Type::getInt32Ty(C), 1),
317318
ConstantExpr::getPointerBitCastOrAddrSpaceCast(Fatbin, Int8PtrTy),
318-
ConstantPointerNull::get(Type::getInt8PtrTy(C))};
319+
ConstantPointerNull::get(PointerType::getUnqual(C))};
319320

320321
Constant *FatbinInitializer =
321322
ConstantStruct::get(getFatbinWrapperTy(M), FatbinWrapper);
@@ -529,21 +530,21 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc,
529530
DtorFunc->setSection(".text.startup");
530531

531532
// Get the __cudaRegisterFatBinary function declaration.
532-
auto *RegFatTy = FunctionType::get(Type::getInt8PtrTy(C)->getPointerTo(),
533-
Type::getInt8PtrTy(C),
533+
auto *RegFatTy = FunctionType::get(PointerType::getUnqual(C)->getPointerTo(),
534+
PointerType::getUnqual(C),
534535
/*isVarArg*/ false);
535536
FunctionCallee RegFatbin = M.getOrInsertFunction(
536537
IsHIP ? "__hipRegisterFatBinary" : "__cudaRegisterFatBinary", RegFatTy);
537538
// Get the __cudaRegisterFatBinaryEnd function declaration.
538-
auto *RegFatEndTy = FunctionType::get(Type::getVoidTy(C),
539-
Type::getInt8PtrTy(C)->getPointerTo(),
540-
/*isVarArg*/ false);
539+
auto *RegFatEndTy = FunctionType::get(
540+
Type::getVoidTy(C), PointerType::getUnqual(C)->getPointerTo(),
541+
/*isVarArg*/ false);
541542
FunctionCallee RegFatbinEnd =
542543
M.getOrInsertFunction("__cudaRegisterFatBinaryEnd", RegFatEndTy);
543544
// Get the __cudaUnregisterFatBinary function declaration.
544-
auto *UnregFatTy = FunctionType::get(Type::getVoidTy(C),
545-
Type::getInt8PtrTy(C)->getPointerTo(),
546-
/*isVarArg*/ false);
545+
auto *UnregFatTy = FunctionType::get(
546+
Type::getVoidTy(C), PointerType::getUnqual(C)->getPointerTo(),
547+
/*isVarArg*/ false);
547548
FunctionCallee UnregFatbin = M.getOrInsertFunction(
548549
IsHIP ? "__hipUnregisterFatBinary" : "__cudaUnregisterFatBinary",
549550
UnregFatTy);
@@ -554,19 +555,19 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc,
554555
FunctionCallee AtExit = M.getOrInsertFunction("atexit", AtExitTy);
555556

556557
auto *BinaryHandleGlobal = new llvm::GlobalVariable(
557-
M, Type::getInt8PtrTy(C)->getPointerTo(), false,
558+
M, PointerType::getUnqual(C)->getPointerTo(), false,
558559
llvm::GlobalValue::InternalLinkage,
559-
llvm::ConstantPointerNull::get(Type::getInt8PtrTy(C)->getPointerTo()),
560+
llvm::ConstantPointerNull::get(PointerType::getUnqual(C)->getPointerTo()),
560561
IsHIP ? ".hip.binary_handle" : ".cuda.binary_handle");
561562

562563
// Create the constructor to register this image with the runtime.
563564
IRBuilder<> CtorBuilder(BasicBlock::Create(C, "entry", CtorFunc));
564565
CallInst *Handle = CtorBuilder.CreateCall(
565566
RegFatbin, ConstantExpr::getPointerBitCastOrAddrSpaceCast(
566-
FatbinDesc, Type::getInt8PtrTy(C)));
567+
FatbinDesc, PointerType::getUnqual(C)));
567568
CtorBuilder.CreateAlignedStore(
568569
Handle, BinaryHandleGlobal,
569-
Align(M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))));
570+
Align(M.getDataLayout().getPointerTypeSize(PointerType::getUnqual(C))));
570571
CtorBuilder.CreateCall(createRegisterGlobalsFunction(M, IsHIP), Handle);
571572
if (!IsHIP)
572573
CtorBuilder.CreateCall(RegFatbinEnd, Handle);
@@ -578,8 +579,8 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc,
578579
// `atexit()` intead.
579580
IRBuilder<> DtorBuilder(BasicBlock::Create(C, "entry", DtorFunc));
580581
LoadInst *BinaryHandle = DtorBuilder.CreateAlignedLoad(
581-
Type::getInt8PtrTy(C)->getPointerTo(), BinaryHandleGlobal,
582-
Align(M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))));
582+
PointerType::getUnqual(C)->getPointerTo(), BinaryHandleGlobal,
583+
Align(M.getDataLayout().getPointerTypeSize(PointerType::getUnqual(C))));
583584
DtorBuilder.CreateCall(UnregFatbin, BinaryHandle);
584585
DtorBuilder.CreateRetVoid();
585586

llvm/examples/BrainF/BrainF.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void BrainF::header(LLVMContext& C) {
6767
//Function prototypes
6868

6969
//declare void @llvm.memset.p0i8.i32(i8 *, i8, i32, i1)
70-
Type *Tys[] = { Type::getInt8PtrTy(C), Type::getInt32Ty(C) };
70+
Type *Tys[] = {PointerType::getUnqual(C), Type::getInt32Ty(C)};
7171
Function *memset_func = Intrinsic::getDeclaration(module, Intrinsic::memset,
7272
Tys);
7373

llvm/include/llvm/IR/Type.h

-5
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,6 @@ class Type {
482482
//===--------------------------------------------------------------------===//
483483
// Convenience methods for getting pointer types.
484484
//
485-
486-
// TODO: After opaque pointer transition this can be replaced by simply
487-
// calling PointerType::get(C, AS).
488-
static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0);
489-
490485
static Type *getWasm_ExternrefTy(LLVMContext &C);
491486
static Type *getWasm_FuncrefTy(LLVMContext &C);
492487

llvm/include/llvm/ProfileData/InstrProfData.inc

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ INSTR_PROF_DATA(const IntPtrT, IntPtrTy, BitmapPtr, RelativeBitmapPtr)
8181
* function name hashes during the conversion from raw to merged profile
8282
* data.
8383
*/
84-
INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer, \
84+
INSTR_PROF_DATA(const IntPtrT, llvm::PointerType::getUnqual(Ctx), FunctionPointer, \
8585
FunctionAddr)
86-
INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \
86+
INSTR_PROF_DATA(IntPtrT, llvm::PointerType::getUnqual(Ctx), Values, \
8787
ValuesPtrExpr)
8888
INSTR_PROF_DATA(const uint32_t, llvm::Type::getInt32Ty(Ctx), NumCounters, \
8989
ConstantInt::get(llvm::Type::getInt32Ty(Ctx), NumCounters))
@@ -116,7 +116,7 @@ INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Value, \
116116
ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0))
117117
INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Count, \
118118
ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0))
119-
INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \
119+
INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::PointerType::getUnqual(Ctx), Next, \
120120
ConstantInt::get(llvm::Type::GetInt8PtrTy(Ctx), 0))
121121
#undef INSTR_PROF_VALUE_NODE
122122
/* INSTR_PROF_VALUE_NODE end. */
@@ -160,7 +160,7 @@ INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
160160
#endif
161161
VALUE_PROF_FUNC_PARAM(uint64_t, TargetValue, Type::getInt64Ty(Ctx)) \
162162
INSTR_PROF_COMMA
163-
VALUE_PROF_FUNC_PARAM(void *, Data, Type::getInt8PtrTy(Ctx)) INSTR_PROF_COMMA
163+
VALUE_PROF_FUNC_PARAM(void *, Data, PointerType::getUnqual(Ctx)) INSTR_PROF_COMMA
164164
VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx))
165165
#undef VALUE_PROF_FUNC_PARAM
166166
#undef INSTR_PROF_COMMA
@@ -213,9 +213,9 @@ VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize, "last")
213213
#define INSTR_PROF_DATA_DEFINED
214214
#endif
215215
#ifdef COVMAP_V1
216-
COVMAP_FUNC_RECORD(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), \
216+
COVMAP_FUNC_RECORD(const IntPtrT, llvm::PointerType::getUnqual(Ctx), \
217217
NamePtr, llvm::ConstantExpr::getBitCast(NamePtr, \
218-
llvm::Type::getInt8PtrTy(Ctx)))
218+
llvm::PointerType::getUnqual(Ctx)))
219219
COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \
220220
llvm::ConstantInt::get(llvm::Type::getInt32Ty(Ctx), \
221221
NameValue.size()))

llvm/lib/Analysis/StackSafetyAnalysis.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ ConstantRange StackSafetyLocalAnalysis::offsetFrom(Value *Addr, Value *Base) {
272272
if (!SE.isSCEVable(Addr->getType()) || !SE.isSCEVable(Base->getType()))
273273
return UnknownRange;
274274

275-
auto *PtrTy = IntegerType::getInt8PtrTy(SE.getContext());
275+
auto *PtrTy = PointerType::getUnqual(SE.getContext());
276276
const SCEV *AddrExp = SE.getTruncateOrZeroExtend(SE.getSCEV(Addr), PtrTy);
277277
const SCEV *BaseExp = SE.getTruncateOrZeroExtend(SE.getSCEV(Base), PtrTy);
278278
const SCEV *Diff = SE.getMinusSCEV(AddrExp, BaseExp);
@@ -363,7 +363,7 @@ bool StackSafetyLocalAnalysis::isSafeAccess(const Use &U, AllocaInst *AI,
363363
const auto *I = cast<Instruction>(U.getUser());
364364

365365
auto ToCharPtr = [&](const SCEV *V) {
366-
auto *PtrTy = IntegerType::getInt8PtrTy(SE.getContext());
366+
auto *PtrTy = PointerType::getUnqual(SE.getContext());
367367
return SE.getTruncateOrZeroExtend(V, PtrTy);
368368
};
369369

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5178,7 +5178,7 @@ void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
51785178
// Save llvm.compiler.used and remove it.
51795179
SmallVector<Constant *, 2> UsedArray;
51805180
SmallVector<GlobalValue *, 4> UsedGlobals;
5181-
Type *UsedElementType = Type::getInt8PtrTy(M.getContext());
5181+
Type *UsedElementType = PointerType::getUnqual(M.getContext());
51825182
GlobalVariable *Used = collectUsedGlobalVariables(M, UsedGlobals, true);
51835183
for (auto *GV : UsedGlobals) {
51845184
if (GV->getName() != "llvm.embedded.module" &&

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,7 @@ bool AsmPrinter::doFinalization(Module &M) {
23222322
auto SymbolName = "swift_async_extendedFramePointerFlags";
23232323
auto Global = M.getGlobalVariable(SymbolName);
23242324
if (!Global) {
2325-
auto Int8PtrTy = Type::getInt8PtrTy(M.getContext());
2325+
auto Int8PtrTy = PointerType::getUnqual(M.getContext());
23262326
Global = new GlobalVariable(M, Int8PtrTy, false,
23272327
GlobalValue::ExternalWeakLinkage, nullptr,
23282328
SymbolName);

llvm/lib/CodeGen/DwarfEHPrepare.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() {
227227
DoesRewindFunctionNeedExceptionObject = false;
228228
} else {
229229
RewindName = TLI.getLibcallName(RTLIB::UNWIND_RESUME);
230-
FTy =
231-
FunctionType::get(Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), false);
230+
FTy = FunctionType::get(Type::getVoidTy(Ctx), PointerType::getUnqual(Ctx),
231+
false);
232232
RewindFunctionCallingConv = TLI.getLibcallCallingConv(RTLIB::UNWIND_RESUME);
233233
DoesRewindFunctionNeedExceptionObject = true;
234234
}
@@ -269,8 +269,8 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() {
269269
llvm::SmallVector<Value *, 1> RewindFunctionArgs;
270270

271271
BasicBlock *UnwindBB = BasicBlock::Create(Ctx, "unwind_resume", &F);
272-
PHINode *PN = PHINode::Create(Type::getInt8PtrTy(Ctx), ResumesLeft, "exn.obj",
273-
UnwindBB);
272+
PHINode *PN = PHINode::Create(PointerType::getUnqual(Ctx), ResumesLeft,
273+
"exn.obj", UnwindBB);
274274

275275
// Extract the exception object from the ResumeInst and add it to the PHI node
276276
// that feeds the _Unwind_Resume call.

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ void IRTranslator::emitJumpTable(SwitchCG::JumpTable &JT,
768768
MIB.setMBB(*MBB);
769769
MIB.setDebugLoc(CurBuilder->getDebugLoc());
770770

771-
Type *PtrIRTy = Type::getInt8PtrTy(MF->getFunction().getContext());
771+
Type *PtrIRTy = PointerType::getUnqual(MF->getFunction().getContext());
772772
const LLT PtrTy = getLLTForType(*PtrIRTy, *DL);
773773

774774
auto Table = MIB.buildJumpTable(PtrTy, JT.JTI);
@@ -1016,7 +1016,7 @@ void IRTranslator::emitBitTestHeader(SwitchCG::BitTestBlock &B,
10161016
Register MinValReg = MIB.buildConstant(SwitchOpTy, B.First).getReg(0);
10171017
auto RangeSub = MIB.buildSub(SwitchOpTy, SwitchOpReg, MinValReg);
10181018

1019-
Type *PtrIRTy = Type::getInt8PtrTy(MF->getFunction().getContext());
1019+
Type *PtrIRTy = PointerType::getUnqual(MF->getFunction().getContext());
10201020
const LLT PtrTy = getLLTForType(*PtrIRTy, *DL);
10211021

10221022
LLT MaskTy = SwitchOpTy;
@@ -3347,7 +3347,7 @@ bool IRTranslator::emitSPDescriptorParent(StackProtectorDescriptor &SPD,
33473347
CurBuilder->setInsertPt(*ParentBB, ParentBB->end());
33483348
// First create the loads to the guard/stack slot for the comparison.
33493349
const TargetLowering &TLI = *MF->getSubtarget().getTargetLowering();
3350-
Type *PtrIRTy = Type::getInt8PtrTy(MF->getFunction().getContext());
3350+
Type *PtrIRTy = PointerType::getUnqual(MF->getFunction().getContext());
33513351
const LLT PtrTy = getLLTForType(*PtrIRTy, *DL);
33523352
LLT PtrMemTy = getLLTForMVT(TLI.getPointerMemTy(*DL));
33533353

@@ -3357,7 +3357,7 @@ bool IRTranslator::emitSPDescriptorParent(StackProtectorDescriptor &SPD,
33573357
Register Guard;
33583358
Register StackSlotPtr = CurBuilder->buildFrameIndex(PtrTy, FI).getReg(0);
33593359
const Module &M = *ParentBB->getParent()->getFunction().getParent();
3360-
Align Align = DL->getPrefTypeAlign(Type::getInt8PtrTy(M.getContext()));
3360+
Align Align = DL->getPrefTypeAlign(PointerType::getUnqual(M.getContext()));
33613361

33623362
// Generate code to load the content of the guard slot.
33633363
Register GuardVal =

llvm/lib/CodeGen/SafeStack.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class SafeStack {
192192
SafeStack(Function &F, const TargetLoweringBase &TL, const DataLayout &DL,
193193
DomTreeUpdater *DTU, ScalarEvolution &SE)
194194
: F(F), TL(TL), DL(DL), DTU(DTU), SE(SE),
195-
StackPtrTy(Type::getInt8PtrTy(F.getContext())),
195+
StackPtrTy(PointerType::getUnqual(F.getContext())),
196196
IntPtrTy(DL.getIntPtrType(F.getContext())),
197197
Int32Ty(Type::getInt32Ty(F.getContext())),
198198
Int8Ty(Type::getInt8Ty(F.getContext())) {}

llvm/lib/CodeGen/ShadowStackGCLowering.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ShadowStackGCLowering::ShadowStackGCLowering() : FunctionPass(ID) {
106106

107107
Constant *ShadowStackGCLowering::GetFrameMap(Function &F) {
108108
// doInitialization creates the abstract type of this value.
109-
Type *VoidPtr = Type::getInt8PtrTy(F.getContext());
109+
Type *VoidPtr = PointerType::getUnqual(F.getContext());
110110

111111
// Truncate the ShadowStackDescriptor if some metadata is null.
112112
unsigned NumMeta = 0;

llvm/lib/CodeGen/SjLjEHPrepare.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ FunctionPass *llvm::createSjLjEHPreparePass(const TargetMachine *TM) {
9090
bool SjLjEHPrepare::doInitialization(Module &M) {
9191
// Build the function context structure.
9292
// builtin_setjmp uses a five word jbuf
93-
Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext());
93+
Type *VoidPtrTy = PointerType::getUnqual(M.getContext());
9494
unsigned DataBits =
9595
TM ? TM->getSjLjDataSize() : TargetMachine::DefaultSjLjDataSize;
9696
DataTy = Type::getIntNTy(M.getContext(), DataBits);

0 commit comments

Comments
 (0)