https://github.com/pmatos created https://github.com/llvm/llvm-project/pull/71029
Replace this with PointerType::get(). Also adds AS = 0 as an optional argument to get() methods. >From 28745bc7877747f998f658ee2f661f8312c54814 Mon Sep 17 00:00:00 2001 From: Paulo Matos <pma...@igalia.com> Date: Thu, 2 Nov 2023 08:11:25 +0100 Subject: [PATCH] [NFC] Remove Type::getInt8PtrTy Replace this with PointerType::get(). Also adds AS = 0 as an optional argument to get() methods. --- clang/lib/CodeGen/CGGPUBuiltin.cpp | 12 ++--- clang/lib/CodeGen/CodeGenPGO.cpp | 2 +- clang/lib/CodeGen/CodeGenTypes.cpp | 2 +- clang/lib/CodeGen/CoverageMappingGen.cpp | 2 +- .../clang-linker-wrapper/OffloadWrapper.cpp | 38 +++++++-------- llvm/examples/BrainF/BrainF.cpp | 2 +- llvm/include/llvm/IR/DerivedTypes.h | 8 ++-- llvm/include/llvm/IR/Type.h | 4 -- .../llvm/ProfileData/InstrProfData.inc | 12 ++--- llvm/lib/Analysis/StackSafetyAnalysis.cpp | 4 +- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +- llvm/lib/CodeGen/DwarfEHPrepare.cpp | 4 +- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 8 ++-- llvm/lib/CodeGen/SafeStack.cpp | 2 +- llvm/lib/CodeGen/ShadowStackGCLowering.cpp | 2 +- llvm/lib/CodeGen/SjLjEHPrepare.cpp | 2 +- llvm/lib/CodeGen/StackProtector.cpp | 4 +- llvm/lib/CodeGen/TargetLoweringBase.cpp | 8 ++-- llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 2 +- llvm/lib/Frontend/Offloading/Utility.cpp | 4 +- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 14 +++--- llvm/lib/IR/Type.cpp | 4 -- .../Target/AArch64/AArch64ISelLowering.cpp | 4 +- .../AMDGPU/AMDGPULowerModuleLDSPass.cpp | 2 +- .../AMDGPUOpenCLEnqueuedBlockLowering.cpp | 2 +- llvm/lib/Target/ARM/ARMISelLowering.cpp | 4 +- .../Target/BPF/BPFAbstractMemberAccess.cpp | 2 +- llvm/lib/Target/DirectX/DXILOpBuilder.cpp | 2 +- llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 2 +- llvm/lib/Target/X86/X86ISelLowering.cpp | 4 +- llvm/lib/Target/X86/X86ISelLoweringCall.cpp | 4 +- llvm/lib/Target/X86/X86WinEHState.cpp | 12 ++--- llvm/lib/Target/XCore/XCoreISelLowering.cpp | 2 +- llvm/lib/Transforms/CFGuard/CFGuard.cpp | 2 +- llvm/lib/Transforms/Coroutines/CoroElide.cpp | 2 +- llvm/lib/Transforms/Coroutines/CoroInstr.h | 4 +- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 8 ++-- .../Instrumentation/AddressSanitizer.cpp | 4 +- .../Instrumentation/DataFlowSanitizer.cpp | 8 ++-- .../Instrumentation/GCOVProfiling.cpp | 2 +- .../Instrumentation/InstrProfiling.cpp | 10 ++-- .../Instrumentation/PGOInstrumentation.cpp | 2 +- .../Transforms/Scalar/LoopDataPrefetch.cpp | 2 +- .../Scalar/RewriteStatepointsForGC.cpp | 2 +- .../Scalar/StraightLineStrengthReduce.cpp | 2 +- llvm/lib/Transforms/Utils/CodeExtractor.cpp | 2 +- .../Utils/EntryExitInstrumenter.cpp | 4 +- .../lib/Transforms/Utils/EscapeEnumerator.cpp | 2 +- llvm/lib/Transforms/Utils/InlineFunction.cpp | 2 +- .../lib/Transforms/Utils/LowerGlobalDtors.cpp | 2 +- llvm/lib/Transforms/Utils/ModuleUtils.cpp | 2 +- llvm/lib/Transforms/Utils/SanitizerStats.cpp | 6 +-- llvm/tools/bugpoint/Miscompilation.cpp | 4 +- .../Analysis/CGSCCPassManagerTest.cpp | 16 +++---- llvm/unittests/Analysis/LazyCallGraphTest.cpp | 48 +++++++++---------- .../unittests/Analysis/MemoryBuiltinsTest.cpp | 2 +- .../Analysis/ScalarEvolutionTest.cpp | 2 +- .../Frontend/OpenMPIRBuilderTest.cpp | 4 +- llvm/unittests/FuzzMutate/OperationsTest.cpp | 4 +- llvm/unittests/Linker/LinkModulesTest.cpp | 14 +++--- 61 files changed, 169 insertions(+), 177 deletions(-) diff --git a/clang/lib/CodeGen/CGGPUBuiltin.cpp b/clang/lib/CodeGen/CGGPUBuiltin.cpp index 75fb06de938425d..db6d80f7e0d87e6 100644 --- a/clang/lib/CodeGen/CGGPUBuiltin.cpp +++ b/clang/lib/CodeGen/CGGPUBuiltin.cpp @@ -23,8 +23,8 @@ using namespace CodeGen; namespace { llvm::Function *GetVprintfDeclaration(llvm::Module &M) { - llvm::Type *ArgTypes[] = {llvm::Type::getInt8PtrTy(M.getContext()), - llvm::Type::getInt8PtrTy(M.getContext())}; + llvm::Type *ArgTypes[] = {llvm::PointerType::get(M.getContext()), + llvm::PointerType::get(M.getContext())}; llvm::FunctionType *VprintfFuncType = llvm::FunctionType::get( llvm::Type::getInt32Ty(M.getContext()), ArgTypes, false); @@ -45,8 +45,8 @@ llvm::Function *GetVprintfDeclaration(llvm::Module &M) { llvm::Function *GetOpenMPVprintfDeclaration(CodeGenModule &CGM) { const char *Name = "__llvm_omp_vprintf"; llvm::Module &M = CGM.getModule(); - llvm::Type *ArgTypes[] = {llvm::Type::getInt8PtrTy(M.getContext()), - llvm::Type::getInt8PtrTy(M.getContext()), + llvm::Type *ArgTypes[] = {llvm::PointerType::get(M.getContext()), + llvm::PointerType::get(M.getContext()), llvm::Type::getInt32Ty(M.getContext())}; llvm::FunctionType *VprintfFuncType = llvm::FunctionType::get( llvm::Type::getInt32Ty(M.getContext()), ArgTypes, false); @@ -99,7 +99,7 @@ packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) { // Construct and fill the args buffer that we'll pass to vprintf. if (Args.size() <= 1) { // If there are no args, pass a null pointer and size 0 - llvm::Value * BufferPtr = llvm::ConstantPointerNull::get(llvm::Type::getInt8PtrTy(Ctx)); + llvm::Value * BufferPtr = llvm::ConstantPointerNull::get(llvm::PointerType::get(Ctx)); return {BufferPtr, llvm::TypeSize::Fixed(0)}; } else { llvm::SmallVector<llvm::Type *, 8> ArgTypes; @@ -120,7 +120,7 @@ packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) { Builder.CreateAlignedStore(Arg, P, DL.getPrefTypeAlign(Arg->getType())); } llvm::Value *BufferPtr = - Builder.CreatePointerCast(Alloca, llvm::Type::getInt8PtrTy(Ctx)); + Builder.CreatePointerCast(Alloca, llvm::PointerType::get(Ctx)); return {BufferPtr, DL.getTypeAllocSize(AllocaTy)}; } } diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 63cdd0a047bcd84..7dc618d9c422fbd 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -960,7 +960,7 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S, return; unsigned Counter = (*RegionCounterMap)[S]; - auto *I8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()); + auto *I8PtrTy = llvm::PointerType::get(CGM.getLLVMContext()); llvm::Value *Args[] = {llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy), Builder.getInt64(FunctionHash), diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 29f4f51dc08b5ec..1aceccbc64762bb 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -422,7 +422,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { case BuiltinType::NullPtr: // Model std::nullptr_t as i8* - ResultType = llvm::Type::getInt8PtrTy(getLLVMContext()); + ResultType = llvm::PointerType::get(getLLVMContext()); break; case BuiltinType::UInt128: diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index d77aa4dd78a06b3..50364964259f0c5 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -1820,7 +1820,7 @@ void CoverageMappingModuleGen::emit() { CGM.addUsedGlobal(CovData); // Create the deferred function records array if (!FunctionNames.empty()) { - auto NamesArrTy = llvm::ArrayType::get(llvm::Type::getInt8PtrTy(Ctx), + auto NamesArrTy = llvm::ArrayType::get(llvm::PointerType::get(Ctx), FunctionNames.size()); auto NamesArrVal = llvm::ConstantArray::get(NamesArrTy, FunctionNames); // This variable will *NOT* be emitted to the object file. It is used diff --git a/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp b/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp index e562c20432e37c6..6b8d8c0e565ce31 100644 --- a/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp @@ -40,7 +40,7 @@ enum OffloadEntryKindFlag : uint32_t { IntegerType *getSizeTTy(Module &M) { LLVMContext &C = M.getContext(); - switch (M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))) { + switch (M.getDataLayout().getPointerTypeSize(PointerType::get(C))) { case 4u: return Type::getInt32Ty(C); case 8u: @@ -60,8 +60,8 @@ StructType *getEntryTy(Module &M) { LLVMContext &C = M.getContext(); StructType *EntryTy = StructType::getTypeByName(C, "__tgt_offload_entry"); if (!EntryTy) - EntryTy = StructType::create("__tgt_offload_entry", Type::getInt8PtrTy(C), - Type::getInt8PtrTy(C), getSizeTTy(M), + EntryTy = StructType::create("__tgt_offload_entry", PointerType::get(C), + PointerType::get(C), getSizeTTy(M), Type::getInt32Ty(C), Type::getInt32Ty(C)); return EntryTy; } @@ -80,8 +80,8 @@ StructType *getDeviceImageTy(Module &M) { LLVMContext &C = M.getContext(); StructType *ImageTy = StructType::getTypeByName(C, "__tgt_device_image"); if (!ImageTy) - ImageTy = StructType::create("__tgt_device_image", Type::getInt8PtrTy(C), - Type::getInt8PtrTy(C), getEntryPtrTy(M), + ImageTy = StructType::create("__tgt_device_image", PointerType::get(C), + PointerType::get(C), getEntryPtrTy(M), getEntryPtrTy(M)); return ImageTy; } @@ -285,8 +285,8 @@ StructType *getFatbinWrapperTy(Module &M) { StructType *FatbinTy = StructType::getTypeByName(C, "fatbin_wrapper"); if (!FatbinTy) FatbinTy = StructType::create("fatbin_wrapper", Type::getInt32Ty(C), - Type::getInt32Ty(C), Type::getInt8PtrTy(C), - Type::getInt8PtrTy(C)); + Type::getInt32Ty(C), PointerType::get(C), + PointerType::get(C)); return FatbinTy; } @@ -294,7 +294,7 @@ StructType *getFatbinWrapperTy(Module &M) { /// runtime. GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) { LLVMContext &C = M.getContext(); - llvm::Type *Int8PtrTy = Type::getInt8PtrTy(C); + llvm::Type *Int8PtrTy = PointerType::get(C); llvm::Triple Triple = llvm::Triple(M.getTargetTriple()); // Create the global string containing the fatbinary. @@ -315,7 +315,7 @@ GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) { ConstantInt::get(Type::getInt32Ty(C), IsHIP ? HIPFatMagic : CudaFatMagic), ConstantInt::get(Type::getInt32Ty(C), 1), ConstantExpr::getPointerBitCastOrAddrSpaceCast(Fatbin, Int8PtrTy), - ConstantPointerNull::get(Type::getInt8PtrTy(C))}; + ConstantPointerNull::get(PointerType::get(C))}; Constant *FatbinInitializer = ConstantStruct::get(getFatbinWrapperTy(M), FatbinWrapper); @@ -529,20 +529,20 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc, DtorFunc->setSection(".text.startup"); // Get the __cudaRegisterFatBinary function declaration. - auto *RegFatTy = FunctionType::get(Type::getInt8PtrTy(C)->getPointerTo(), - Type::getInt8PtrTy(C), + auto *RegFatTy = FunctionType::get(PointerType::get(C)->getPointerTo(), + PointerType::get(C), /*isVarArg*/ false); FunctionCallee RegFatbin = M.getOrInsertFunction( IsHIP ? "__hipRegisterFatBinary" : "__cudaRegisterFatBinary", RegFatTy); // Get the __cudaRegisterFatBinaryEnd function declaration. auto *RegFatEndTy = FunctionType::get(Type::getVoidTy(C), - Type::getInt8PtrTy(C)->getPointerTo(), + PointerType::get(C)->getPointerTo(), /*isVarArg*/ false); FunctionCallee RegFatbinEnd = M.getOrInsertFunction("__cudaRegisterFatBinaryEnd", RegFatEndTy); // Get the __cudaUnregisterFatBinary function declaration. auto *UnregFatTy = FunctionType::get(Type::getVoidTy(C), - Type::getInt8PtrTy(C)->getPointerTo(), + PointerType::get(C)->getPointerTo(), /*isVarArg*/ false); FunctionCallee UnregFatbin = M.getOrInsertFunction( IsHIP ? "__hipUnregisterFatBinary" : "__cudaUnregisterFatBinary", @@ -554,19 +554,19 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc, FunctionCallee AtExit = M.getOrInsertFunction("atexit", AtExitTy); auto *BinaryHandleGlobal = new llvm::GlobalVariable( - M, Type::getInt8PtrTy(C)->getPointerTo(), false, + M, PointerType::get(C)->getPointerTo(), false, llvm::GlobalValue::InternalLinkage, - llvm::ConstantPointerNull::get(Type::getInt8PtrTy(C)->getPointerTo()), + llvm::ConstantPointerNull::get(PointerType::get(C)->getPointerTo()), IsHIP ? ".hip.binary_handle" : ".cuda.binary_handle"); // Create the constructor to register this image with the runtime. IRBuilder<> CtorBuilder(BasicBlock::Create(C, "entry", CtorFunc)); CallInst *Handle = CtorBuilder.CreateCall( RegFatbin, ConstantExpr::getPointerBitCastOrAddrSpaceCast( - FatbinDesc, Type::getInt8PtrTy(C))); + FatbinDesc, PointerType::get(C))); CtorBuilder.CreateAlignedStore( Handle, BinaryHandleGlobal, - Align(M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C)))); + Align(M.getDataLayout().getPointerTypeSize(PointerType::get(C)))); CtorBuilder.CreateCall(createRegisterGlobalsFunction(M, IsHIP), Handle); if (!IsHIP) CtorBuilder.CreateCall(RegFatbinEnd, Handle); @@ -578,8 +578,8 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc, // `atexit()` intead. IRBuilder<> DtorBuilder(BasicBlock::Create(C, "entry", DtorFunc)); LoadInst *BinaryHandle = DtorBuilder.CreateAlignedLoad( - Type::getInt8PtrTy(C)->getPointerTo(), BinaryHandleGlobal, - Align(M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C)))); + PointerType::get(C)->getPointerTo(), BinaryHandleGlobal, + Align(M.getDataLayout().getPointerTypeSize(PointerType::get(C)))); DtorBuilder.CreateCall(UnregFatbin, BinaryHandle); DtorBuilder.CreateRetVoid(); diff --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp index 849e5c7675307ec..a731bd7ce0d63d9 100644 --- a/llvm/examples/BrainF/BrainF.cpp +++ b/llvm/examples/BrainF/BrainF.cpp @@ -67,7 +67,7 @@ void BrainF::header(LLVMContext& C) { //Function prototypes //declare void @llvm.memset.p0i8.i32(i8 *, i8, i32, i1) - Type *Tys[] = { Type::getInt8PtrTy(C), Type::getInt32Ty(C) }; + Type *Tys[] = { PointerType::get(C), Type::getInt32Ty(C) }; Function *memset_func = Intrinsic::getDeclaration(module, Intrinsic::memset, Tys); diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h index f7a09fda8ccb7ba..0a5f83d1ad45772 100644 --- a/llvm/include/llvm/IR/DerivedTypes.h +++ b/llvm/include/llvm/IR/DerivedTypes.h @@ -652,21 +652,21 @@ class PointerType : public Type { /// This constructs a pointer to an object of the specified type in a numbered /// address space. - static PointerType *get(Type *ElementType, unsigned AddressSpace); + static PointerType *get(Type *ElementType, unsigned AddressSpace = 0); /// This constructs an opaque pointer to an object in a numbered address /// space. - static PointerType *get(LLVMContext &C, unsigned AddressSpace); + static PointerType *get(LLVMContext &C, unsigned AddressSpace = 0); /// This constructs a pointer to an object of the specified type in the /// default address space (address space zero). static PointerType *getUnqual(Type *ElementType) { - return PointerType::get(ElementType, 0); + return PointerType::get(ElementType); } /// This constructs an opaque pointer to an object in the /// default address space (address space zero). static PointerType *getUnqual(LLVMContext &C) { - return PointerType::get(C, 0); + return PointerType::get(C); } /// This constructs a pointer type with the same pointee type as input diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h index c38078cc6087ef7..c22f291b299472d 100644 --- a/llvm/include/llvm/IR/Type.h +++ b/llvm/include/llvm/IR/Type.h @@ -483,10 +483,6 @@ class Type { // Convenience methods for getting pointer types. // - // TODO: After opaque pointer transition this can be replaced by simply - // calling PointerType::get(C, AS). - static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0); - static Type *getWasm_ExternrefTy(LLVMContext &C); static Type *getWasm_FuncrefTy(LLVMContext &C); diff --git a/llvm/include/llvm/ProfileData/InstrProfData.inc b/llvm/include/llvm/ProfileData/InstrProfData.inc index fa17ac370f6964f..64760094c3ff020 100644 --- a/llvm/include/llvm/ProfileData/InstrProfData.inc +++ b/llvm/include/llvm/ProfileData/InstrProfData.inc @@ -81,9 +81,9 @@ INSTR_PROF_DATA(const IntPtrT, IntPtrTy, BitmapPtr, RelativeBitmapPtr) * function name hashes during the conversion from raw to merged profile * data. */ -INSTR_PROF_DATA(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), FunctionPointer, \ +INSTR_PROF_DATA(const IntPtrT, llvm::PointerType::get(Ctx), FunctionPointer, \ FunctionAddr) -INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \ +INSTR_PROF_DATA(IntPtrT, llvm::PointerType::get(Ctx), Values, \ ValuesPtrExpr) INSTR_PROF_DATA(const uint32_t, llvm::Type::getInt32Ty(Ctx), NumCounters, \ ConstantInt::get(llvm::Type::getInt32Ty(Ctx), NumCounters)) @@ -116,7 +116,7 @@ INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Value, \ ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0)) INSTR_PROF_VALUE_NODE(uint64_t, llvm::Type::getInt64Ty(Ctx), Count, \ ConstantInt::get(llvm::Type::GetInt64Ty(Ctx), 0)) -INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \ +INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::PointerType::get(Ctx), Next, \ ConstantInt::get(llvm::Type::GetInt8PtrTy(Ctx), 0)) #undef INSTR_PROF_VALUE_NODE /* INSTR_PROF_VALUE_NODE end. */ @@ -160,7 +160,7 @@ INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last) #endif VALUE_PROF_FUNC_PARAM(uint64_t, TargetValue, Type::getInt64Ty(Ctx)) \ INSTR_PROF_COMMA -VALUE_PROF_FUNC_PARAM(void *, Data, Type::getInt8PtrTy(Ctx)) INSTR_PROF_COMMA +VALUE_PROF_FUNC_PARAM(void *, Data, PointerType::get(Ctx)) INSTR_PROF_COMMA VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx)) #undef VALUE_PROF_FUNC_PARAM #undef INSTR_PROF_COMMA @@ -213,9 +213,9 @@ VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize, "last") #define INSTR_PROF_DATA_DEFINED #endif #ifdef COVMAP_V1 -COVMAP_FUNC_RECORD(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), \ +COVMAP_FUNC_RECORD(const IntPtrT, llvm::PointerType::get(Ctx), \ NamePtr, llvm::ConstantExpr::getBitCast(NamePtr, \ - llvm::Type::getInt8PtrTy(Ctx))) + llvm::PointerType::get(Ctx))) COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \ llvm::ConstantInt::get(llvm::Type::getInt32Ty(Ctx), \ NameValue.size())) diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp index d7cfec7b19b17b0..9aec9c43dcba780 100644 --- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -272,7 +272,7 @@ ConstantRange StackSafetyLocalAnalysis::offsetFrom(Value *Addr, Value *Base) { if (!SE.isSCEVable(Addr->getType()) || !SE.isSCEVable(Base->getType())) return UnknownRange; - auto *PtrTy = IntegerType::getInt8PtrTy(SE.getContext()); + auto *PtrTy = PointerType::get(SE.getContext()); const SCEV *AddrExp = SE.getTruncateOrZeroExtend(SE.getSCEV(Addr), PtrTy); const SCEV *BaseExp = SE.getTruncateOrZeroExtend(SE.getSCEV(Base), PtrTy); const SCEV *Diff = SE.getMinusSCEV(AddrExp, BaseExp); @@ -363,7 +363,7 @@ bool StackSafetyLocalAnalysis::isSafeAccess(const Use &U, AllocaInst *AI, const auto *I = cast<Instruction>(U.getUser()); auto ToCharPtr = [&](const SCEV *V) { - auto *PtrTy = IntegerType::getInt8PtrTy(SE.getContext()); + auto *PtrTy = PointerType::get(SE.getContext()); return SE.getTruncateOrZeroExtend(V, PtrTy); }; diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index d7ebc76d9bfb0ea..f3eede9b0a5e749 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -5176,7 +5176,7 @@ void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf, // Save llvm.compiler.used and remove it. SmallVector<Constant *, 2> UsedArray; SmallVector<GlobalValue *, 4> UsedGlobals; - Type *UsedElementType = Type::getInt8PtrTy(M.getContext()); + Type *UsedElementType = PointerType::get(M.getContext()); GlobalVariable *Used = collectUsedGlobalVariables(M, UsedGlobals, true); for (auto *GV : UsedGlobals) { if (GV->getName() != "llvm.embedded.module" && diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index fd440718fd37837..5ff194b674265e8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2322,7 +2322,7 @@ bool AsmPrinter::doFinalization(Module &M) { auto SymbolName = "swift_async_extendedFramePointerFlags"; auto Global = M.getGlobalVariable(SymbolName); if (!Global) { - auto Int8PtrTy = Type::getInt8PtrTy(M.getContext()); + auto Int8PtrTy = PointerType::get(M.getContext()); Global = new GlobalVariable(M, Int8PtrTy, false, GlobalValue::ExternalWeakLinkage, nullptr, SymbolName); diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp index 1d02f53e51e566e..c02125f97e6f59c 100644 --- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp +++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp @@ -228,7 +228,7 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() { } else { RewindName = TLI.getLibcallName(RTLIB::UNWIND_RESUME); FTy = - FunctionType::get(Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), false); + FunctionType::get(Type::getVoidTy(Ctx), PointerType::get(Ctx), false); RewindFunctionCallingConv = TLI.getLibcallCallingConv(RTLIB::UNWIND_RESUME); DoesRewindFunctionNeedExceptionObject = true; } @@ -269,7 +269,7 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() { llvm::SmallVector<Value *, 1> RewindFunctionArgs; BasicBlock *UnwindBB = BasicBlock::Create(Ctx, "unwind_resume", &F); - PHINode *PN = PHINode::Create(Type::getInt8PtrTy(Ctx), ResumesLeft, "exn.obj", + PHINode *PN = PHINode::Create(PointerType::get(Ctx), ResumesLeft, "exn.obj", UnwindBB); // Extract the exception object from the ResumeInst and add it to the PHI node diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index d8f9e30b2599779..706a73911449a1a 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -767,7 +767,7 @@ void IRTranslator::emitJumpTable(SwitchCG::JumpTable &JT, MIB.setMBB(*MBB); MIB.setDebugLoc(CurBuilder->getDebugLoc()); - Type *PtrIRTy = Type::getInt8PtrTy(MF->getFunction().getContext()); + Type *PtrIRTy = PointerType::get(MF->getFunction().getContext()); const LLT PtrTy = getLLTForType(*PtrIRTy, *DL); auto Table = MIB.buildJumpTable(PtrTy, JT.JTI); @@ -1015,7 +1015,7 @@ void IRTranslator::emitBitTestHeader(SwitchCG::BitTestBlock &B, Register MinValReg = MIB.buildConstant(SwitchOpTy, B.First).getReg(0); auto RangeSub = MIB.buildSub(SwitchOpTy, SwitchOpReg, MinValReg); - Type *PtrIRTy = Type::getInt8PtrTy(MF->getFunction().getContext()); + Type *PtrIRTy = PointerType::get(MF->getFunction().getContext()); const LLT PtrTy = getLLTForType(*PtrIRTy, *DL); LLT MaskTy = SwitchOpTy; @@ -3341,7 +3341,7 @@ bool IRTranslator::emitSPDescriptorParent(StackProtectorDescriptor &SPD, CurBuilder->setInsertPt(*ParentBB, ParentBB->end()); // First create the loads to the guard/stack slot for the comparison. const TargetLowering &TLI = *MF->getSubtarget().getTargetLowering(); - Type *PtrIRTy = Type::getInt8PtrTy(MF->getFunction().getContext()); + Type *PtrIRTy = PointerType::get(MF->getFunction().getContext()); const LLT PtrTy = getLLTForType(*PtrIRTy, *DL); LLT PtrMemTy = getLLTForMVT(TLI.getPointerMemTy(*DL)); @@ -3351,7 +3351,7 @@ bool IRTranslator::emitSPDescriptorParent(StackProtectorDescriptor &SPD, Register Guard; Register StackSlotPtr = CurBuilder->buildFrameIndex(PtrTy, FI).getReg(0); const Module &M = *ParentBB->getParent()->getFunction().getParent(); - Align Align = DL->getPrefTypeAlign(Type::getInt8PtrTy(M.getContext())); + Align Align = DL->getPrefTypeAlign(PointerType::get(M.getContext())); // Generate code to load the content of the guard slot. Register GuardVal = diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp index bcad7a3f24dabe8..8a798f7322b88a9 100644 --- a/llvm/lib/CodeGen/SafeStack.cpp +++ b/llvm/lib/CodeGen/SafeStack.cpp @@ -192,7 +192,7 @@ class SafeStack { SafeStack(Function &F, const TargetLoweringBase &TL, const DataLayout &DL, DomTreeUpdater *DTU, ScalarEvolution &SE) : F(F), TL(TL), DL(DL), DTU(DTU), SE(SE), - StackPtrTy(Type::getInt8PtrTy(F.getContext())), + StackPtrTy(PointerType::get(F.getContext())), IntPtrTy(DL.getIntPtrType(F.getContext())), Int32Ty(Type::getInt32Ty(F.getContext())), Int8Ty(Type::getInt8Ty(F.getContext())) {} diff --git a/llvm/lib/CodeGen/ShadowStackGCLowering.cpp b/llvm/lib/CodeGen/ShadowStackGCLowering.cpp index 153fe77b8b4ae4a..e4577e1ebcba2b4 100644 --- a/llvm/lib/CodeGen/ShadowStackGCLowering.cpp +++ b/llvm/lib/CodeGen/ShadowStackGCLowering.cpp @@ -106,7 +106,7 @@ ShadowStackGCLowering::ShadowStackGCLowering() : FunctionPass(ID) { Constant *ShadowStackGCLowering::GetFrameMap(Function &F) { // doInitialization creates the abstract type of this value. - Type *VoidPtr = Type::getInt8PtrTy(F.getContext()); + Type *VoidPtr = PointerType::get(F.getContext()); // Truncate the ShadowStackDescriptor if some metadata is null. unsigned NumMeta = 0; diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index 7994821ae7c0a14..d350663c385e340 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -90,7 +90,7 @@ FunctionPass *llvm::createSjLjEHPreparePass(const TargetMachine *TM) { bool SjLjEHPrepare::doInitialization(Module &M) { // Build the function context structure. // builtin_setjmp uses a five word jbuf - Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext()); + Type *VoidPtrTy = PointerType::get(M.getContext()); unsigned DataBits = TM ? TM->getSjLjDataSize() : TargetMachine::DefaultSjLjDataSize; DataTy = Type::getIntNTy(M.getContext(), DataBits); diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 3ba85bc125a0190..ec404c91e34a0f6 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -451,7 +451,7 @@ static bool CreatePrologue(Function *F, Module *M, Instruction *CheckLoc, const TargetLoweringBase *TLI, AllocaInst *&AI) { bool SupportsSelectionDAGSP = false; IRBuilder<> B(&F->getEntryBlock().front()); - PointerType *PtrTy = Type::getInt8PtrTy(CheckLoc->getContext()); + PointerType *PtrTy = PointerType::get(CheckLoc->getContext()); AI = B.CreateAlloca(PtrTy, nullptr, "StackGuardSlot"); Value *GuardSlot = getStackGuard(TLI, M, B, &SupportsSelectionDAGSP); @@ -622,7 +622,7 @@ BasicBlock *StackProtector::CreateFailBB() { if (Trip.isOSOpenBSD()) { StackChkFail = M->getOrInsertFunction("__stack_smash_handler", Type::getVoidTy(Context), - Type::getInt8PtrTy(Context)); + PointerType::get(Context)); Args.push_back(B.CreateGlobalStringPtr(F->getName(), "SSH")); } else { StackChkFail = diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 722cefb1eddb3c5..0deb8888c8ce724 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -1911,7 +1911,7 @@ TargetLoweringBase::getDefaultSafeStackPointerLocation(IRBuilderBase &IRB, auto UnsafeStackPtr = dyn_cast_or_null<GlobalVariable>(M->getNamedValue(UnsafeStackPtrVar)); - Type *StackPtrTy = Type::getInt8PtrTy(M->getContext()); + Type *StackPtrTy = PointerType::get(M->getContext()); if (!UnsafeStackPtr) { auto TLSModel = UseTLS ? @@ -1942,7 +1942,7 @@ TargetLoweringBase::getSafeStackPointerLocation(IRBuilderBase &IRB) const { // Android provides a libc function to retrieve the address of the current // thread's unsafe stack pointer. Module *M = IRB.GetInsertBlock()->getParent()->getParent(); - Type *StackPtrTy = Type::getInt8PtrTy(M->getContext()); + Type *StackPtrTy = PointerType::get(M->getContext()); FunctionCallee Fn = M->getOrInsertFunction("__safestack_pointer_address", StackPtrTy->getPointerTo(0)); return IRB.CreateCall(Fn); @@ -1998,7 +1998,7 @@ bool TargetLoweringBase::isLegalAddressingMode(const DataLayout &DL, Value *TargetLoweringBase::getIRStackGuard(IRBuilderBase &IRB) const { if (getTargetMachine().getTargetTriple().isOSOpenBSD()) { Module &M = *IRB.GetInsertBlock()->getParent()->getParent(); - PointerType *PtrTy = Type::getInt8PtrTy(M.getContext()); + PointerType *PtrTy = PointerType::get(M.getContext()); Constant *C = M.getOrInsertGlobal("__guard_local", PtrTy); if (GlobalVariable *G = dyn_cast_or_null<GlobalVariable>(C)) G->setVisibility(GlobalValue::HiddenVisibility); @@ -2011,7 +2011,7 @@ Value *TargetLoweringBase::getIRStackGuard(IRBuilderBase &IRB) const { // TODO: add LOAD_STACK_GUARD support. void TargetLoweringBase::insertSSPDeclarations(Module &M) const { if (!M.getNamedValue("__stack_chk_guard")) { - auto *GV = new GlobalVariable(M, Type::getInt8PtrTy(M.getContext()), false, + auto *GV = new GlobalVariable(M, PointerType::get(M.getContext()), false, GlobalVariable::ExternalLinkage, nullptr, "__stack_chk_guard"); diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 0d4f9835f0fcd4d..fe3381a48f059d9 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -340,7 +340,7 @@ void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE, Array = std::make_unique<char[]>((InputArgv.size()+1)*PtrSize); LLVM_DEBUG(dbgs() << "JIT: ARGV = " << (void *)Array.get() << "\n"); - Type *SBytePtr = Type::getInt8PtrTy(C); + Type *SBytePtr = PointerType::get(C); for (unsigned i = 0; i != InputArgv.size(); ++i) { unsigned Size = InputArgv[i].size()+1; diff --git a/llvm/lib/Frontend/Offloading/Utility.cpp b/llvm/lib/Frontend/Offloading/Utility.cpp index 48f0015bac4e345..741ce604c39b09b 100644 --- a/llvm/lib/Frontend/Offloading/Utility.cpp +++ b/llvm/lib/Frontend/Offloading/Utility.cpp @@ -22,7 +22,7 @@ static StructType *getEntryTy(Module &M) { StructType::getTypeByName(C, "struct.__tgt_offload_entry"); if (!EntryTy) EntryTy = StructType::create("struct.__tgt_offload_entry", - Type::getInt8PtrTy(C), Type::getInt8PtrTy(C), + PointerType::get(C), PointerType::get(C), M.getDataLayout().getIntPtrType(C), Type::getInt32Ty(C), Type::getInt32Ty(C)); return EntryTy; @@ -32,7 +32,7 @@ static StructType *getEntryTy(Module &M) { void offloading::emitOffloadingEntry(Module &M, Constant *Addr, StringRef Name, uint64_t Size, int32_t Flags, StringRef SectionName) { - Type *Int8PtrTy = Type::getInt8PtrTy(M.getContext()); + Type *Int8PtrTy = PointerType::get(M.getContext()); Type *Int32Ty = Type::getInt32Ty(M.getContext()); Type *SizeTy = M.getDataLayout().getIntPtrType(M.getContext()); diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index 46db9c209a6a412..0cdc5b1caeff1c9 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -1278,7 +1278,7 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel( // __kmpc_fork_call_if always expects a void ptr as the last argument // If there are no arguments, pass a null pointer. - auto PtrTy = Type::getInt8PtrTy(M.getContext()); + auto PtrTy = PointerType::get(M.getContext()); if (IfCondition && NumCapturedVars == 0) { llvm::Value *Void = ConstantPointerNull::get(PtrTy); RealArgs.push_back(Void); @@ -1715,7 +1715,7 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc, TaskFn, {Ident, ThreadID, TaskData, Builder.getInt32(Dependencies.size()), DepArrayPtr, ConstantInt::get(Builder.getInt32Ty(), 0), - ConstantPointerNull::get(Type::getInt8PtrTy(M.getContext()))}); + ConstantPointerNull::get(PointerType::get(M.getContext()))}); } else { // Emit the @__kmpc_omp_task runtime call to spawn the task @@ -1906,7 +1906,7 @@ OpenMPIRBuilder::createSection(const LocationDescription &Loc, /// the given module and return it. Function *getFreshReductionFunc(Module &M) { Type *VoidTy = Type::getVoidTy(M.getContext()); - Type *Int8PtrTy = Type::getInt8PtrTy(M.getContext()); + Type *Int8PtrTy = PointerType::get(M.getContext()); auto *FuncTy = FunctionType::get(VoidTy, {Int8PtrTy, Int8PtrTy}, /* IsVarArg */ false); return Function::Create(FuncTy, GlobalVariable::InternalLinkage, @@ -3987,7 +3987,7 @@ CallInst *OpenMPIRBuilder::createOMPInteropInit( Constant *InteropTypeVal = ConstantInt::get(Int32, (int)InteropType); if (NumDependences == nullptr) { NumDependences = ConstantInt::get(Int32, 0); - PointerType *PointerTypeVar = Type::getInt8PtrTy(M.getContext()); + PointerType *PointerTypeVar = PointerType::get(M.getContext()); DependenceAddress = ConstantPointerNull::get(PointerTypeVar); } Value *HaveNowaitClauseVal = ConstantInt::get(Int32, HaveNowaitClause); @@ -4014,7 +4014,7 @@ CallInst *OpenMPIRBuilder::createOMPInteropDestroy( Device = ConstantInt::get(Int32, -1); if (NumDependences == nullptr) { NumDependences = ConstantInt::get(Int32, 0); - PointerType *PointerTypeVar = Type::getInt8PtrTy(M.getContext()); + PointerType *PointerTypeVar = PointerType::get(M.getContext()); DependenceAddress = ConstantPointerNull::get(PointerTypeVar); } Value *HaveNowaitClauseVal = ConstantInt::get(Int32, HaveNowaitClause); @@ -4042,7 +4042,7 @@ CallInst *OpenMPIRBuilder::createOMPInteropUse(const LocationDescription &Loc, Device = ConstantInt::get(Int32, -1); if (NumDependences == nullptr) { NumDependences = ConstantInt::get(Int32, 0); - PointerType *PointerTypeVar = Type::getInt8PtrTy(M.getContext()); + PointerType *PointerTypeVar = PointerType::get(M.getContext()); DependenceAddress = ConstantPointerNull::get(PointerTypeVar); } Value *HaveNowaitClauseVal = ConstantInt::get(Int32, HaveNowaitClause); @@ -4609,7 +4609,7 @@ static Function *createOutlinedFunction( if (OMPBuilder.Config.isTargetDevice()) { // Add the "implicit" runtime argument we use to provide launch specific // information for target devices. - auto *Int8PtrTy = Type::getInt8PtrTy(Builder.getContext()); + auto *Int8PtrTy = PointerType::get(Builder.getContext()); ParameterTypes.push_back(Int8PtrTy); // All parameters to target devices are passed as pointers diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index 006278d16484c1c..8a1bf9654fdc6eb 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -256,10 +256,6 @@ IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) { return IntegerType::get(C, N); } -PointerType *Type::getInt8PtrTy(LLVMContext &C, unsigned AS) { - return PointerType::get(C, AS); -} - Type *Type::getWasm_ExternrefTy(LLVMContext &C) { // opaque pointer in addrspace(10) static PointerType *Ty = PointerType::get(C, 10); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index d00db82c9e49ac2..e388a8d327f786b 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -24836,12 +24836,12 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const { if (Subtarget->getTargetTriple().isWindowsMSVCEnvironment()) { // MSVC CRT has a global variable holding security cookie. M.getOrInsertGlobal("__security_cookie", - Type::getInt8PtrTy(M.getContext())); + PointerType::get(M.getContext())); // MSVC CRT has a function to validate security cookie. FunctionCallee SecurityCheckCookie = M.getOrInsertFunction( Subtarget->getSecurityCheckCookieName(), - Type::getVoidTy(M.getContext()), Type::getInt8PtrTy(M.getContext())); + Type::getVoidTy(M.getContext()), PointerType::get(M.getContext())); if (Function *F = dyn_cast<Function>(SecurityCheckCookie.getCallee())) { F->setCallingConv(CallingConv::Win64); F->addParamAttr(0, Attribute::AttrKind::InReg); diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp index efe40e52065426d..a64e4c0c04ee0f7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp @@ -854,7 +854,7 @@ class AMDGPULowerModuleLDS { appendToCompilerUsed(M, {static_cast<GlobalValue *>( ConstantExpr::getPointerBitCastOrAddrSpaceCast( cast<Constant>(ModuleScopeReplacement.SGV), - Type::getInt8PtrTy(Ctx)))}); + PointerType::get(Ctx)))}); // module.lds will be allocated at zero in any kernel that allocates it recordLDSAbsoluteAddress(&M, ModuleScopeReplacement.SGV, 0); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp index 67624b325fb0c63..a7acef5c168da58 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp @@ -93,7 +93,7 @@ bool AMDGPUOpenCLEnqueuedBlockLowering::runOnModule(Module &M) { if (!HandleTy) { Type *Int32 = Type::getInt32Ty(C); HandleTy = StructType::create( - C, {Type::getInt8PtrTy(C), Int32, Int32}, + C, {PointerType::get(C), Int32, Int32}, "block.runtime.handle.t"); } diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 9fe5dd55a810c4b..90aac66dc211d04 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -21371,12 +21371,12 @@ void ARMTargetLowering::insertSSPDeclarations(Module &M) const { // MSVC CRT has a global variable holding security cookie. M.getOrInsertGlobal("__security_cookie", - Type::getInt8PtrTy(M.getContext())); + PointerType::get(M.getContext())); // MSVC CRT has a function to validate security cookie. FunctionCallee SecurityCheckCookie = M.getOrInsertFunction( "__security_check_cookie", Type::getVoidTy(M.getContext()), - Type::getInt8PtrTy(M.getContext())); + PointerType::get(M.getContext())); if (Function *F = dyn_cast<Function>(SecurityCheckCookie.getCallee())) F->addParamAttr(0, Attribute::AttrKind::InReg); } diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp index a878eaabe00ff5e..5a9b6cbe961554d 100644 --- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp +++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp @@ -1108,7 +1108,7 @@ bool BPFAbstractMemberAccess::transformGEPChain(CallInst *Call, auto *LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV, "", Call); // Generate a BitCast - auto *BCInst = new BitCastInst(Base, Type::getInt8PtrTy(BB->getContext())); + auto *BCInst = new BitCastInst(Base, PointerType::get(BB->getContext())); BCInst->insertBefore(Call); // Generate a GetElementPtr diff --git a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp index 905756469902569..460f1f7192ab04a 100644 --- a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp +++ b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp @@ -183,7 +183,7 @@ static StructType *getResRetType(Type *OverloadTy, LLVMContext &Ctx) { } static StructType *getHandleType(LLVMContext &Ctx) { - return getOrCreateStructType("dx.types.Handle", Type::getInt8PtrTy(Ctx), Ctx); + return getOrCreateStructType("dx.types.Handle", PointerType::get(Ctx), Ctx); } static Type *getTypeFromParameterKind(ParameterKind Kind, Type *OverloadTy) { diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 5e0c2d62f5a9cb5..907c6680b622d17 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -17501,7 +17501,7 @@ bool PPCTargetLowering::useLoadStackGuardNode() const { void PPCTargetLowering::insertSSPDeclarations(Module &M) const { if (Subtarget.isAIXABI()) { M.getOrInsertGlobal(AIXSSPCanaryWordName, - Type::getInt8PtrTy(M.getContext())); + PointerType::get(M.getContext())); return; } if (!Subtarget.isTargetLinux()) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 18f6a695e4502e9..3e7a6933e3cda49 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -30310,7 +30310,7 @@ void X86TargetLowering::emitBitTestAtomicRMWIntrinsic(AtomicRMWInst *AI) const { Instruction *I = AI->user_back(); LLVMContext &Ctx = AI->getContext(); Value *Addr = Builder.CreatePointerCast(AI->getPointerOperand(), - Type::getInt8PtrTy(Ctx)); + PointerType::get(Ctx)); Function *BitTest = nullptr; Value *Result = nullptr; auto BitTested = FindSingleBitChange(AI->getValOperand()); @@ -30479,7 +30479,7 @@ void X86TargetLowering::emitCmpArithAtomicRMWIntrinsic( Function *CmpArith = Intrinsic::getDeclaration(AI->getModule(), IID, AI->getType()); Value *Addr = Builder.CreatePointerCast(AI->getPointerOperand(), - Type::getInt8PtrTy(Ctx)); + PointerType::get(Ctx)); Value *Call = Builder.CreateCall( CmpArith, {Addr, AI->getValOperand(), Builder.getInt32((unsigned)CC)}); Value *Result = Builder.CreateTrunc(Call, Type::getInt1Ty(Ctx)); diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp index 2fe145f9267de87..e2b0dab2ed4c48e 100644 --- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp +++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp @@ -622,12 +622,12 @@ void X86TargetLowering::insertSSPDeclarations(Module &M) const { Subtarget.getTargetTriple().isWindowsItaniumEnvironment()) { // MSVC CRT has a global variable holding security cookie. M.getOrInsertGlobal("__security_cookie", - Type::getInt8PtrTy(M.getContext())); + PointerType::get(M.getContext())); // MSVC CRT has a function to validate security cookie. FunctionCallee SecurityCheckCookie = M.getOrInsertFunction( "__security_check_cookie", Type::getVoidTy(M.getContext()), - Type::getInt8PtrTy(M.getContext())); + PointerType::get(M.getContext())); if (Function *F = dyn_cast<Function>(SecurityCheckCookie.getCallee())) { F->setCallingConv(CallingConv::X86_FastCall); F->addParamAttr(0, Attribute::AttrKind::InReg); diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp index 15ad2d60e889f6f..7da75cc1a750477 100644 --- a/llvm/lib/Target/X86/X86WinEHState.cpp +++ b/llvm/lib/Target/X86/X86WinEHState.cpp @@ -172,7 +172,7 @@ bool WinEHStatePass::runOnFunction(Function &F) { if (!HasPads) return false; - Type *Int8PtrType = Type::getInt8PtrTy(TheModule->getContext()); + Type *Int8PtrType = PointerType::get(TheModule->getContext()); SetJmp3 = TheModule->getOrInsertFunction( "_setjmp3", FunctionType::get( Type::getInt32Ty(TheModule->getContext()), @@ -214,7 +214,7 @@ Type *WinEHStatePass::getEHLinkRegistrationType() { Type *FieldTys[] = { PointerType::getUnqual( EHLinkRegistrationTy->getContext()), // EHRegistrationNode *Next - Type::getInt8PtrTy(Context) // EXCEPTION_DISPOSITION (*Handler)(...) + PointerType::get(Context) // EXCEPTION_DISPOSITION (*Handler)(...) }; EHLinkRegistrationTy->setBody(FieldTys, false); return EHLinkRegistrationTy; @@ -231,7 +231,7 @@ Type *WinEHStatePass::getCXXEHRegistrationType() { return CXXEHRegistrationTy; LLVMContext &Context = TheModule->getContext(); Type *FieldTys[] = { - Type::getInt8PtrTy(Context), // void *SavedESP + PointerType::get(Context), // void *SavedESP getEHLinkRegistrationType(), // EHRegistrationNode SubRecord Type::getInt32Ty(Context) // int32_t TryLevel }; @@ -253,8 +253,8 @@ Type *WinEHStatePass::getSEHRegistrationType() { return SEHRegistrationTy; LLVMContext &Context = TheModule->getContext(); Type *FieldTys[] = { - Type::getInt8PtrTy(Context), // void *SavedESP - Type::getInt8PtrTy(Context), // void *ExceptionPointers + PointerType::get(Context), // void *SavedESP + PointerType::get(Context), // void *ExceptionPointers getEHLinkRegistrationType(), // EHRegistrationNode SubRecord Type::getInt32Ty(Context), // int32_t EncodedScopeTable Type::getInt32Ty(Context) // int32_t TryLevel @@ -383,7 +383,7 @@ Value *WinEHStatePass::emitEHLSDA(IRBuilder<> &Builder, Function *F) { Function *WinEHStatePass::generateLSDAInEAXThunk(Function *ParentFunc) { LLVMContext &Context = ParentFunc->getContext(); Type *Int32Ty = Type::getInt32Ty(Context); - Type *Int8PtrType = Type::getInt8PtrTy(Context); + Type *Int8PtrType = PointerType::get(Context); Type *ArgTys[5] = {Int8PtrType, Int8PtrType, Int8PtrType, Int8PtrType, Int8PtrType}; FunctionType *TrampolineTy = diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp index 4604bcc14ee20df..2f582b8cca0c132 100644 --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -292,7 +292,7 @@ LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const return GA; } else { // Ideally we would not fold in offset with an index <= 11. - Type *Ty = Type::getInt8PtrTy(*DAG.getContext()); + Type *Ty = PointerType::get(*DAG.getContext()); Constant *GA = ConstantExpr::getBitCast(const_cast<GlobalValue*>(GV), Ty); Ty = Type::getInt32Ty(*DAG.getContext()); Constant *Idx = ConstantInt::get(Ty, Offset); diff --git a/llvm/lib/Transforms/CFGuard/CFGuard.cpp b/llvm/lib/Transforms/CFGuard/CFGuard.cpp index 3eca0e4b5947327..55717fa8a70637a 100644 --- a/llvm/lib/Transforms/CFGuard/CFGuard.cpp +++ b/llvm/lib/Transforms/CFGuard/CFGuard.cpp @@ -236,7 +236,7 @@ bool CFGuard::doInitialization(Module &M) { // Set up prototypes for the guard check and dispatch functions. GuardFnType = FunctionType::get(Type::getVoidTy(M.getContext()), - {Type::getInt8PtrTy(M.getContext())}, false); + {PointerType::get(M.getContext())}, false); GuardFnPtrType = PointerType::get(GuardFnType, 0); // Get or insert the guard check or dispatch global symbols. diff --git a/llvm/lib/Transforms/Coroutines/CoroElide.cpp b/llvm/lib/Transforms/Coroutines/CoroElide.cpp index 3310a0a7657f750..a4083adced9d709 100644 --- a/llvm/lib/Transforms/Coroutines/CoroElide.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroElide.cpp @@ -165,7 +165,7 @@ void Lowerer::elideHeapAllocations(Function *F, uint64_t FrameSize, auto *Frame = new AllocaInst(FrameTy, DL.getAllocaAddrSpace(), "", InsertPt); Frame->setAlignment(FrameAlign); auto *FrameVoidPtr = - new BitCastInst(Frame, Type::getInt8PtrTy(C), "vFrame", InsertPt); + new BitCastInst(Frame, PointerType::get(C), "vFrame", InsertPt); for (auto *CB : CoroBegins) { CB->replaceAllUsesWith(FrameVoidPtr); diff --git a/llvm/lib/Transforms/Coroutines/CoroInstr.h b/llvm/lib/Transforms/Coroutines/CoroInstr.h index 2e7d9b2ce028a3e..a6c7bd3c8f400f2 100644 --- a/llvm/lib/Transforms/Coroutines/CoroInstr.h +++ b/llvm/lib/Transforms/Coroutines/CoroInstr.h @@ -124,7 +124,7 @@ class LLVM_LIBRARY_VISIBILITY CoroIdInst : public AnyCoroIdInst { void clearPromise() { Value *Arg = getArgOperand(PromiseArg); setArgOperand(PromiseArg, - ConstantPointerNull::get(Type::getInt8PtrTy(getContext()))); + ConstantPointerNull::get(PointerType::get(getContext()))); if (isa<AllocaInst>(Arg)) return; assert((isa<BitCastInst>(Arg) || isa<GetElementPtrInst>(Arg)) && @@ -185,7 +185,7 @@ class LLVM_LIBRARY_VISIBILITY CoroIdInst : public AnyCoroIdInst { void setCoroutineSelf() { assert(isa<ConstantPointerNull>(getArgOperand(CoroutineArg)) && "Coroutine argument is already assigned"); - auto *const Int8PtrTy = Type::getInt8PtrTy(getContext()); + auto *const Int8PtrTy = PointerType::get(getContext()); setArgOperand(CoroutineArg, ConstantExpr::getBitCast(getFunction(), Int8PtrTy)); } diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index e3eb8c4d8f1dc11..ff4ea599911b3bc 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -1096,7 +1096,7 @@ void CoroCloner::create() { // Remap vFrame pointer. auto *NewVFrame = Builder.CreateBitCast( - NewFramePtr, Type::getInt8PtrTy(Builder.getContext()), "vFrame"); + NewFramePtr, PointerType::get(Builder.getContext()), "vFrame"); Value *OldVFrame = cast<Value>(VMap[Shape.CoroBegin]); if (OldVFrame != NewVFrame) OldVFrame->replaceAllUsesWith(NewVFrame); @@ -1227,7 +1227,7 @@ static void setCoroInfo(Function &F, coro::Shape &Shape, // Update coro.begin instruction to refer to this constant. LLVMContext &C = F.getContext(); - auto *BC = ConstantExpr::getPointerCast(GV, Type::getInt8PtrTy(C)); + auto *BC = ConstantExpr::getPointerCast(GV, PointerType::get(C)); Shape.getSwitchCoroId()->setInfo(BC); } @@ -1707,7 +1707,7 @@ static void replaceAsyncResumeFunction(CoroSuspendAsyncInst *Suspend, Value *Continuation) { auto *ResumeIntrinsic = Suspend->getResumeFunction(); auto &Context = Suspend->getParent()->getParent()->getContext(); - auto *Int8PtrTy = Type::getInt8PtrTy(Context); + auto *Int8PtrTy = PointerType::get(Context); IRBuilder<> Builder(ResumeIntrinsic); auto *Val = Builder.CreateBitOrPointerCast(Continuation, Int8PtrTy); @@ -1760,7 +1760,7 @@ static void splitAsyncCoroutine(Function &F, coro::Shape &Shape, F.removeRetAttr(Attribute::NonNull); auto &Context = F.getContext(); - auto *Int8PtrTy = Type::getInt8PtrTy(Context); + auto *Int8PtrTy = PointerType::get(Context); auto *Id = cast<CoroIdAsyncInst>(Shape.CoroBegin->getId()); IRBuilder<> Builder(Id); diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 1277f88111d1117..98ef9dbca92e8fb 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -660,7 +660,7 @@ struct AddressSanitizer { DL = &M.getDataLayout(); LongSize = M.getDataLayout().getPointerSizeInBits(); IntptrTy = Type::getIntNTy(*C, LongSize); - Int8PtrTy = Type::getInt8PtrTy(*C); + Int8PtrTy = PointerType::get(*C); Int32Ty = Type::getInt32Ty(*C); TargetTriple = Triple(M.getTargetTriple()); @@ -1571,7 +1571,7 @@ void AddressSanitizer::instrumentMaskedLoadOrStore( InstrumentedAddress = IRB.CreateExtractElement(Addr, Index); } else if (Stride) { Index = IRB.CreateMul(Index, Stride); - Addr = IRB.CreateBitCast(Addr, Type::getInt8PtrTy(*C)); + Addr = IRB.CreateBitCast(Addr, PointerType::get(*C)); InstrumentedAddress = IRB.CreateGEP(Type::getInt8Ty(*C), Addr, {Index}); } else { InstrumentedAddress = IRB.CreateGEP(VTy, Addr, {Zero, Index}); diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index adc0beed4d9a13a..34446da94a37db9 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -1145,7 +1145,7 @@ bool DataFlowSanitizer::initializeModule(Module &M) { Mod = &M; Ctx = &M.getContext(); - Int8Ptr = Type::getInt8PtrTy(*Ctx); + Int8Ptr = PointerType::get(*Ctx); OriginTy = IntegerType::get(*Ctx, OriginWidthBits); OriginPtrTy = PointerType::getUnqual(OriginTy); PrimitiveShadowTy = IntegerType::get(*Ctx, ShadowWidthBits); @@ -1162,19 +1162,19 @@ bool DataFlowSanitizer::initializeModule(Module &M) { FunctionType::get(IntegerType::get(*Ctx, 64), DFSanLoadLabelAndOriginArgs, /*isVarArg=*/false); DFSanUnimplementedFnTy = FunctionType::get( - Type::getVoidTy(*Ctx), Type::getInt8PtrTy(*Ctx), /*isVarArg=*/false); + Type::getVoidTy(*Ctx), PointerType::get(*Ctx), /*isVarArg=*/false); Type *DFSanWrapperExternWeakNullArgs[2] = {Int8Ptr, Int8Ptr}; DFSanWrapperExternWeakNullFnTy = FunctionType::get(Type::getVoidTy(*Ctx), DFSanWrapperExternWeakNullArgs, /*isVarArg=*/false); Type *DFSanSetLabelArgs[4] = {PrimitiveShadowTy, OriginTy, - Type::getInt8PtrTy(*Ctx), IntptrTy}; + PointerType::get(*Ctx), IntptrTy}; DFSanSetLabelFnTy = FunctionType::get(Type::getVoidTy(*Ctx), DFSanSetLabelArgs, /*isVarArg=*/false); DFSanNonzeroLabelFnTy = FunctionType::get(Type::getVoidTy(*Ctx), std::nullopt, /*isVarArg=*/false); DFSanVarargWrapperFnTy = FunctionType::get( - Type::getVoidTy(*Ctx), Type::getInt8PtrTy(*Ctx), /*isVarArg=*/false); + Type::getVoidTy(*Ctx), PointerType::get(*Ctx), /*isVarArg=*/false); DFSanConditionalCallbackFnTy = FunctionType::get(Type::getVoidTy(*Ctx), PrimitiveShadowTy, /*isVarArg=*/false); diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 5d66895d0e207e2..a21f11bfefc1b0b 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -1031,7 +1031,7 @@ void GCOVProfiler::emitGlobalConstructor( FunctionCallee GCOVProfiler::getStartFileFunc(const TargetLibraryInfo *TLI) { Type *Args[] = { - Type::getInt8PtrTy(*Ctx), // const char *orig_filename + PointerType::get(*Ctx), // const char *orig_filename Type::getInt32Ty(*Ctx), // uint32_t version Type::getInt32Ty(*Ctx), // uint32_t checksum }; diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index 55eef2b76e9be28..37ff1065836f56f 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -817,7 +817,7 @@ void InstrProfiling::lowerMCDCTestVectorBitmapUpdate( InstrProfMCDCTVBitmapUpdate *Update) { IRBuilder<> Builder(Update); auto *Int8Ty = Type::getInt8Ty(M->getContext()); - auto *Int8PtrTy = Type::getInt8PtrTy(M->getContext()); + auto *Int8PtrTy = PointerType::get(M->getContext()); auto *Int32Ty = Type::getInt32Ty(M->getContext()); auto *Int64Ty = Type::getInt64Ty(M->getContext()); auto *MCDCCondBitmapAddr = Update->getMCDCCondBitmapAddr(); @@ -1002,7 +1002,7 @@ static inline bool shouldUsePublicSymbol(Function *Fn) { } static inline Constant *getFuncAddrForProfData(Function *Fn) { - auto *Int8PtrTy = Type::getInt8PtrTy(Fn->getContext()); + auto *Int8PtrTy = PointerType::get(Fn->getContext()); // Store a nullptr in __llvm_profd, if we shouldn't use a real address if (!shouldRecordFunctionAddr(Fn)) return ConstantPointerNull::get(Int8PtrTy); @@ -1277,7 +1277,7 @@ void InstrProfiling::createDataVariable(InstrProfCntrInstBase *Inc, std::string DataVarName = getVarName(Inc, getInstrProfDataVarPrefix(), Renamed); - auto *Int8PtrTy = Type::getInt8PtrTy(Ctx); + auto *Int8PtrTy = PointerType::get(Ctx); // Allocate statically the array of pointers to value profile nodes for // the current function. Constant *ValuesPtrExpr = ConstantPointerNull::get(Int8PtrTy); @@ -1296,7 +1296,7 @@ void InstrProfiling::createDataVariable(InstrProfCntrInstBase *Inc, ValuesVar->setAlignment(Align(8)); maybeSetComdat(ValuesVar, Fn, CntsVarName); ValuesPtrExpr = - ConstantExpr::getBitCast(ValuesVar, Type::getInt8PtrTy(Ctx)); + ConstantExpr::getBitCast(ValuesVar, PointerType::get(Ctx)); } uint64_t NumCounters = Inc->getNumCounters()->getZExtValue(); @@ -1469,7 +1469,7 @@ void InstrProfiling::emitRegistration() { // Construct the function. auto *VoidTy = Type::getVoidTy(M->getContext()); - auto *VoidPtrTy = Type::getInt8PtrTy(M->getContext()); + auto *VoidPtrTy = PointerType::get(M->getContext()); auto *Int64Ty = Type::getInt64Ty(M->getContext()); auto *RegisterFTy = FunctionType::get(VoidTy, false); auto *RegisterF = Function::Create(RegisterFTy, GlobalValue::InternalLinkage, diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 7ad1c9bc54f3780..310203b5ce6a089 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -875,7 +875,7 @@ static void instrumentOneFunc( F, TLI, ComdatMembers, true, BPI, BFI, IsCS, PGOInstrumentEntry, PGOBlockCoverage); - Type *I8PtrTy = Type::getInt8PtrTy(M->getContext()); + Type *I8PtrTy = PointerType::get(M->getContext()); auto Name = ConstantExpr::getBitCast(FuncInfo.FuncNameVar, I8PtrTy); auto CFGHash = ConstantInt::get(Type::getInt64Ty(M->getContext()), FuncInfo.FunctionHash); diff --git a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp index 7c2770979a900fa..cc1f56014eee984 100644 --- a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp @@ -399,7 +399,7 @@ bool LoopDataPrefetch::runOnLoop(Loop *L) { continue; unsigned PtrAddrSpace = NextLSCEV->getType()->getPointerAddressSpace(); - Type *I8Ptr = Type::getInt8PtrTy(BB->getContext(), PtrAddrSpace); + Type *I8Ptr = PointerType::get(BB->getContext(), PtrAddrSpace); Value *PrefPtrValue = SCEVE.expandCodeFor(NextLSCEV, I8Ptr, P.InsertPt); IRBuilder<> Builder(P.InsertPt); diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 06c81f53de706cf..f9daae7b8d55672 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1495,7 +1495,7 @@ static void CreateGCRelocates(ArrayRef<Value *> LiveVariables, auto getGCRelocateDecl = [&](Type *Ty) { assert(isHandledGCPointerType(Ty, GC)); auto AS = Ty->getScalarType()->getPointerAddressSpace(); - Type *NewTy = Type::getInt8PtrTy(M->getContext(), AS); + Type *NewTy = PointerType::get(M->getContext(), AS); if (auto *VT = dyn_cast<VectorType>(Ty)) NewTy = FixedVectorType::get(NewTy, cast<FixedVectorType>(VT)->getNumElements()); diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp index fdb41cb415df8ea..543469d62fe732b 100644 --- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp @@ -680,7 +680,7 @@ void StraightLineStrengthReduce::rewriteCandidateWithBasis( if (BumpWithUglyGEP) { // C = (char *)Basis + Bump unsigned AS = Basis.Ins->getType()->getPointerAddressSpace(); - Type *CharTy = Type::getInt8PtrTy(Basis.Ins->getContext(), AS); + Type *CharTy = PointerType::get(Basis.Ins->getContext(), AS); Reduced = Builder.CreateBitCast(Basis.Ins, CharTy); Reduced = Builder.CreateGEP(Builder.getInt8Ty(), Reduced, Bump, "", InBounds); diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index b251a85cf85f92a..acc48746789c118 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -568,7 +568,7 @@ void CodeExtractor::findAllocas(const CodeExtractorAnalysisCache &CEAC, for (Instruction *I : LifetimeBitcastUsers) { Module *M = AIFunc->getParent(); LLVMContext &Ctx = M->getContext(); - auto *Int8PtrTy = Type::getInt8PtrTy(Ctx); + auto *Int8PtrTy = PointerType::get(Ctx); CastInst *CastI = CastInst::CreatePointerCast(AI, Int8PtrTy, "lt.cast", I); I->replaceUsesOfWith(I->getOperand(1), CastI); diff --git a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp index d2dbfcfd89d1626..132a8156679c84e 100644 --- a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp +++ b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp @@ -54,7 +54,7 @@ static void insertCall(Function &CurFn, StringRef Func, } if (Func == "__cyg_profile_func_enter" || Func == "__cyg_profile_func_exit") { - Type *ArgTypes[] = {Type::getInt8PtrTy(C), Type::getInt8PtrTy(C)}; + Type *ArgTypes[] = {PointerType::get(C), PointerType::get(C)}; FunctionCallee Fn = M.getOrInsertFunction( Func, FunctionType::get(Type::getVoidTy(C), ArgTypes, false)); @@ -65,7 +65,7 @@ static void insertCall(Function &CurFn, StringRef Func, InsertionPt); RetAddr->setDebugLoc(DL); - Value *Args[] = {ConstantExpr::getBitCast(&CurFn, Type::getInt8PtrTy(C)), + Value *Args[] = {ConstantExpr::getBitCast(&CurFn, PointerType::get(C)), RetAddr}; CallInst *Call = diff --git a/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp b/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp index 88c838685bca186..4c42278b2e67126 100644 --- a/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp +++ b/llvm/lib/Transforms/Utils/EscapeEnumerator.cpp @@ -70,7 +70,7 @@ IRBuilder<> *EscapeEnumerator::Next() { // Create a cleanup block. LLVMContext &C = F.getContext(); BasicBlock *CleanupBB = BasicBlock::Create(C, CleanupBBName, &F); - Type *ExnTy = StructType::get(Type::getInt8PtrTy(C), Type::getInt32Ty(C)); + Type *ExnTy = StructType::get(PointerType::get(C), Type::getInt32Ty(C)); if (!F.hasPersonalityFn()) { FunctionCallee PersFn = getDefaultPersonalityFn(F.getParent()); F.setPersonalityFn(cast<Constant>(PersFn.getCallee())); diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 7ea51aab7dc1fc0..574304a181a9345 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1608,7 +1608,7 @@ static bool isUsedByLifetimeMarker(Value *V) { // lifetime.start or lifetime.end intrinsics. static bool hasLifetimeMarkers(AllocaInst *AI) { Type *Ty = AI->getType(); - Type *Int8PtrTy = Type::getInt8PtrTy(Ty->getContext(), + Type *Int8PtrTy = PointerType::get(Ty->getContext(), Ty->getPointerAddressSpace()); if (Ty == Int8PtrTy) return isUsedByLifetimeMarker(AI); diff --git a/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp b/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp index f67a1eb53b8976a..6104a04bc757e67 100644 --- a/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp +++ b/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp @@ -128,7 +128,7 @@ static bool runImpl(Module &M) { // extern "C" int __cxa_atexit(void (*f)(void *), void *p, void *d); LLVMContext &C = M.getContext(); - PointerType *VoidStar = Type::getInt8PtrTy(C); + PointerType *VoidStar = PointerType::get(C); Type *AtExitFuncArgs[] = {VoidStar}; FunctionType *AtExitFuncTy = FunctionType::get(Type::getVoidTy(C), AtExitFuncArgs, diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index 1e243ef74df7fd6..0ba78553840af63 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -96,7 +96,7 @@ static void appendToUsedList(Module &M, StringRef Name, ArrayRef<GlobalValue *> if (GV) GV->eraseFromParent(); - Type *ArrayEltTy = llvm::Type::getInt8PtrTy(M.getContext()); + Type *ArrayEltTy = llvm::PointerType::get(M.getContext()); for (auto *V : Values) Init.insert(ConstantExpr::getPointerBitCastOrAddrSpaceCast(V, ArrayEltTy)); diff --git a/llvm/lib/Transforms/Utils/SanitizerStats.cpp b/llvm/lib/Transforms/Utils/SanitizerStats.cpp index fd21ee4cc408fb3..a48da6e774d7843 100644 --- a/llvm/lib/Transforms/Utils/SanitizerStats.cpp +++ b/llvm/lib/Transforms/Utils/SanitizerStats.cpp @@ -21,7 +21,7 @@ using namespace llvm; SanitizerStatReport::SanitizerStatReport(Module *M) : M(M) { - StatTy = ArrayType::get(Type::getInt8PtrTy(M->getContext()), 2); + StatTy = ArrayType::get(PointerType::get(M->getContext()), 2); EmptyModuleStatsTy = makeModuleStatsTy(); ModuleStatsGV = new GlobalVariable(*M, EmptyModuleStatsTy, false, @@ -33,7 +33,7 @@ ArrayType *SanitizerStatReport::makeModuleStatsArrayTy() { } StructType *SanitizerStatReport::makeModuleStatsTy() { - return StructType::get(M->getContext(), {Type::getInt8PtrTy(M->getContext()), + return StructType::get(M->getContext(), {PointerType::get(M->getContext()), Type::getInt32Ty(M->getContext()), makeModuleStatsArrayTy()}); } @@ -73,7 +73,7 @@ void SanitizerStatReport::finish() { return; } - PointerType *Int8PtrTy = Type::getInt8PtrTy(M->getContext()); + PointerType *Int8PtrTy = PointerType::get(M->getContext()); IntegerType *Int32Ty = Type::getInt32Ty(M->getContext()); Type *VoidTy = Type::getVoidTy(M->getContext()); diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp index 38821949d0ff034..fdbc754b59b4445 100644 --- a/llvm/tools/bugpoint/Miscompilation.cpp +++ b/llvm/tools/bugpoint/Miscompilation.cpp @@ -830,8 +830,8 @@ CleanupAndPrepareModules(BugDriver &BD, std::unique_ptr<Module> Test, // Add the resolver to the Safe module. // Prototype: void *getPointerToNamedFunction(const char* Name) FunctionCallee resolverFunc = Safe->getOrInsertFunction( - "getPointerToNamedFunction", Type::getInt8PtrTy(Safe->getContext()), - Type::getInt8PtrTy(Safe->getContext())); + "getPointerToNamedFunction", PointerType::get(Safe->getContext()), + PointerType::get(Safe->getContext())); // Use the function we just added to get addresses of functions we need. for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { diff --git a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp index d0bca9d1004d994..79fc53cef6d2e3d 100644 --- a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp +++ b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp @@ -1203,7 +1203,7 @@ TEST_F(CGSCCPassManagerTest, TestAnalysisInvalidationCGSCCUpdate) { H2F.begin()->begin()->eraseFromParent(); // Insert a bitcast of `h3` so that we retain a ref edge to it. (void)CastInst::CreatePointerCast(&H3F, - Type::getInt8PtrTy(H2F.getContext()), + PointerType::get(H2F.getContext()), "dummy", &*H2F.begin()->begin()); // Now update the call graph. @@ -1633,7 +1633,7 @@ TEST_F(CGSCCPassManagerTest, TestUpdateCGAndAnalysisManagerForPasses8) { // Create an unsused constant that is referencing the old (=replaced) // function. - ConstantExpr::getBitCast(FnF, Type::getInt8PtrTy(FnF->getContext())); + ConstantExpr::getBitCast(FnF, PointerType::get(FnF->getContext())); // Use the CallGraphUpdater to update the call graph. CallGraphUpdater CGU; @@ -1763,11 +1763,11 @@ TEST_F(CGSCCPassManagerTest, TestInsertionOfNewFunctions1) { F.getEntryBlock().front().eraseFromParent(); // 2. Insert a ref edge from 'f' to 'f'. (void)CastInst::CreatePointerCast( - &F, Type::getInt8PtrTy(F.getContext()), "f.ref", + &F, PointerType::get(F.getContext()), "f.ref", &F.getEntryBlock().front()); // 3. Insert a ref edge from 'f' to 'g'. (void)CastInst::CreatePointerCast( - G, Type::getInt8PtrTy(F.getContext()), "g.ref", + G, PointerType::get(F.getContext()), "g.ref", &F.getEntryBlock().front()); CG.addSplitFunction(F, *G); @@ -1844,18 +1844,18 @@ TEST_F(CGSCCPassManagerTest, TestInsertionOfNewFunctions2) { BasicBlock::Create(F.getParent()->getContext(), "entry", H1); BasicBlock *H2BB = BasicBlock::Create(F.getParent()->getContext(), "entry", H2); - (void)CastInst::CreatePointerCast(H2, Type::getInt8PtrTy(F.getContext()), + (void)CastInst::CreatePointerCast(H2, PointerType::get(F.getContext()), "h2.ref", H1BB); (void)ReturnInst::Create(H1->getContext(), H1BB); - (void)CastInst::CreatePointerCast(H1, Type::getInt8PtrTy(F.getContext()), + (void)CastInst::CreatePointerCast(H1, PointerType::get(F.getContext()), "h1.ref", H2BB); (void)ReturnInst::Create(H2->getContext(), H2BB); // Add 'f -> h1' ref edge. - (void)CastInst::CreatePointerCast(H1, Type::getInt8PtrTy(F.getContext()), + (void)CastInst::CreatePointerCast(H1, PointerType::get(F.getContext()), "h1.ref", &F.getEntryBlock().front()); // Add 'f -> h2' ref edge. - (void)CastInst::CreatePointerCast(H2, Type::getInt8PtrTy(F.getContext()), + (void)CastInst::CreatePointerCast(H2, PointerType::get(F.getContext()), "h2.ref", &F.getEntryBlock().front()); CG.addSplitRefRecursiveFunctions(F, SmallVector<Function *, 2>({H1, H2})); diff --git a/llvm/unittests/Analysis/LazyCallGraphTest.cpp b/llvm/unittests/Analysis/LazyCallGraphTest.cpp index 7eb6932ffb1f199..84adee4f02f4971 100644 --- a/llvm/unittests/Analysis/LazyCallGraphTest.cpp +++ b/llvm/unittests/Analysis/LazyCallGraphTest.cpp @@ -2392,7 +2392,7 @@ TEST(LazyCallGraphTest, AddSplitFunction2) { (void)ReturnInst::Create(Context, GBB); // Create f -ref-> g. - (void)CastInst::CreatePointerCast(G, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2431,7 +2431,7 @@ TEST(LazyCallGraphTest, AddSplitFunction3) { F.getAddressSpace(), "g", F.getParent()); BasicBlock *GBB = BasicBlock::Create(Context, "", G); // Create g -ref-> f. - (void)CastInst::CreatePointerCast(&F, Type::getInt8PtrTy(Context), "", GBB); + (void)CastInst::CreatePointerCast(&F, PointerType::get(Context), "", GBB); (void)ReturnInst::Create(Context, GBB); // Create f -call-> g. @@ -2475,11 +2475,11 @@ TEST(LazyCallGraphTest, AddSplitFunction4) { F.getAddressSpace(), "g", F.getParent()); BasicBlock *GBB = BasicBlock::Create(Context, "", G); // Create g -ref-> f. - (void)CastInst::CreatePointerCast(&F, Type::getInt8PtrTy(Context), "", GBB); + (void)CastInst::CreatePointerCast(&F, PointerType::get(Context), "", GBB); (void)ReturnInst::Create(Context, GBB); // Create f -ref-> g. - (void)CastInst::CreatePointerCast(G, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2525,7 +2525,7 @@ TEST(LazyCallGraphTest, AddSplitFunction5) { (void)ReturnInst::Create(Context, GBB); // Create f -ref-> g. - (void)CastInst::CreatePointerCast(G, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2673,7 +2673,7 @@ TEST(LazyCallGraphTest, AddSplitFunction8) { (void)ReturnInst::Create(Context, GBB); // Create f -ref-> g. - (void)CastInst::CreatePointerCast(G, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2722,7 +2722,7 @@ TEST(LazyCallGraphTest, AddSplitFunction9) { F.getAddressSpace(), "g", F.getParent()); BasicBlock *GBB = BasicBlock::Create(Context, "", G); // Create g -ref-> f2. - (void)CastInst::CreatePointerCast(&F2, Type::getInt8PtrTy(Context), "", GBB); + (void)CastInst::CreatePointerCast(&F2, PointerType::get(Context), "", GBB); (void)ReturnInst::Create(Context, GBB); // Create f -call-> g. @@ -2769,7 +2769,7 @@ TEST(LazyCallGraphTest, AddSplitFunctions1) { (void)ReturnInst::Create(Context, GBB); // Create f -ref-> g. - (void)CastInst::CreatePointerCast(G, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2808,11 +2808,11 @@ TEST(LazyCallGraphTest, AddSplitFunctions2) { F.getAddressSpace(), "g", F.getParent()); BasicBlock *GBB = BasicBlock::Create(Context, "", G); // Create g -ref-> f. - (void)CastInst::CreatePointerCast(&F, Type::getInt8PtrTy(Context), "", GBB); + (void)CastInst::CreatePointerCast(&F, PointerType::get(Context), "", GBB); (void)ReturnInst::Create(Context, GBB); // Create f -ref-> g. - (void)CastInst::CreatePointerCast(G, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2857,15 +2857,15 @@ TEST(LazyCallGraphTest, AddSplitFunctions3) { BasicBlock *G1BB = BasicBlock::Create(Context, "", G1); BasicBlock *G2BB = BasicBlock::Create(Context, "", G2); // Create g1 -ref-> g2 and g2 -ref-> g1. - (void)CastInst::CreatePointerCast(G2, Type::getInt8PtrTy(Context), "", G1BB); - (void)CastInst::CreatePointerCast(G1, Type::getInt8PtrTy(Context), "", G2BB); + (void)CastInst::CreatePointerCast(G2, PointerType::get(Context), "", G1BB); + (void)CastInst::CreatePointerCast(G1, PointerType::get(Context), "", G2BB); (void)ReturnInst::Create(Context, G1BB); (void)ReturnInst::Create(Context, G2BB); // Create f -ref-> g1 and f -ref-> g2. - (void)CastInst::CreatePointerCast(G1, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G1, PointerType::get(Context), "", &*F.getEntryBlock().begin()); - (void)CastInst::CreatePointerCast(G2, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G2, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2911,17 +2911,17 @@ TEST(LazyCallGraphTest, AddSplitFunctions4) { BasicBlock *G1BB = BasicBlock::Create(Context, "", G1); BasicBlock *G2BB = BasicBlock::Create(Context, "", G2); // Create g1 -ref-> g2 and g2 -ref-> g1. - (void)CastInst::CreatePointerCast(G2, Type::getInt8PtrTy(Context), "", G1BB); - (void)CastInst::CreatePointerCast(G1, Type::getInt8PtrTy(Context), "", G2BB); + (void)CastInst::CreatePointerCast(G2, PointerType::get(Context), "", G1BB); + (void)CastInst::CreatePointerCast(G1, PointerType::get(Context), "", G2BB); // Create g2 -ref-> f. - (void)CastInst::CreatePointerCast(&F, Type::getInt8PtrTy(Context), "", G2BB); + (void)CastInst::CreatePointerCast(&F, PointerType::get(Context), "", G2BB); (void)ReturnInst::Create(Context, G1BB); (void)ReturnInst::Create(Context, G2BB); // Create f -ref-> g1 and f -ref-> g2. - (void)CastInst::CreatePointerCast(G1, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G1, PointerType::get(Context), "", &*F.getEntryBlock().begin()); - (void)CastInst::CreatePointerCast(G2, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G2, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -2978,17 +2978,17 @@ TEST(LazyCallGraphTest, AddSplitFunctions5) { BasicBlock *G1BB = BasicBlock::Create(Context, "", G1); BasicBlock *G2BB = BasicBlock::Create(Context, "", G2); // Create g1 -ref-> g2 and g2 -ref-> g1. - (void)CastInst::CreatePointerCast(G2, Type::getInt8PtrTy(Context), "", G1BB); - (void)CastInst::CreatePointerCast(G1, Type::getInt8PtrTy(Context), "", G2BB); + (void)CastInst::CreatePointerCast(G2, PointerType::get(Context), "", G1BB); + (void)CastInst::CreatePointerCast(G1, PointerType::get(Context), "", G2BB); // Create g2 -ref-> f2. - (void)CastInst::CreatePointerCast(&F2, Type::getInt8PtrTy(Context), "", G2BB); + (void)CastInst::CreatePointerCast(&F2, PointerType::get(Context), "", G2BB); (void)ReturnInst::Create(Context, G1BB); (void)ReturnInst::Create(Context, G2BB); // Create f -ref-> g1 and f -ref-> g2. - (void)CastInst::CreatePointerCast(G1, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G1, PointerType::get(Context), "", &*F.getEntryBlock().begin()); - (void)CastInst::CreatePointerCast(G2, Type::getInt8PtrTy(Context), "", + (void)CastInst::CreatePointerCast(G2, PointerType::get(Context), "", &*F.getEntryBlock().begin()); EXPECT_FALSE(verifyModule(*M, &errs())); diff --git a/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp b/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp index 7fa54a6ce23e12c..b75438b4ee222a7 100644 --- a/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp +++ b/llvm/unittests/Analysis/MemoryBuiltinsTest.cpp @@ -26,7 +26,7 @@ TEST(AllocSize, AllocationBuiltinsTest) { IntegerType *ArgTy = Type::getInt32Ty(Context); Function *AllocSizeFn = Function::Create( - FunctionType::get(Type::getInt8PtrTy(Context), {ArgTy}, false), + FunctionType::get(PointerType::get(Context), {ArgTy}, false), GlobalValue::ExternalLinkage, "F", &M); AllocSizeFn->addFnAttr( diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp index e883b4291695488..53cf8e794f64206 100644 --- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp +++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp @@ -677,7 +677,7 @@ TEST_F(ScalarEvolutionsTest, SCEVZeroExtendExpr) { Type *I64Ty = Type::getInt64Ty(Context); Type *I8Ty = Type::getInt8Ty(Context); - Type *I8PtrTy = Type::getInt8PtrTy(Context); + Type *I8PtrTy = PointerType::get(Context); Value *Accum = Constant::getNullValue(I8PtrTy); int Iters = 20; for (int i = 0; i < Iters; i++) { diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp index b9e9655b89108d2..ba5b795773e4e13 100644 --- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp +++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp @@ -5273,7 +5273,7 @@ TEST_F(OpenMPIRBuilderTest, EmitMapperCall) { GlobalVariable *Mapnames = OMPBuilder.createOffloadMapnames(Names, ".offload_mapnames"); Value *MapnamesArg = Builder.CreateConstInBoundsGEP2_32( - ArrayType::get(Type::getInt8PtrTy(Ctx), TotalNbOperand), Mapnames, + ArrayType::get(PointerType::get(Ctx), TotalNbOperand), Mapnames, /*Idx0=*/0, /*Idx1=*/0); OMPBuilder.emitMapperCall(Builder.saveIP(), BeginMapperFunc, SrcLocInfo, @@ -6049,7 +6049,7 @@ TEST_F(OpenMPIRBuilderTest, CreateTaskDepend) { ASSERT_NE(NumDepsNoAlias, nullptr); EXPECT_EQ(NumDepsNoAlias->getZExtValue(), 0U); EXPECT_EQ(TaskAllocCall->getOperand(6), - ConstantPointerNull::get(Type::getInt8PtrTy(M->getContext()))); + ConstantPointerNull::get(PointerType::get(M->getContext()))); EXPECT_FALSE(verifyModule(*M, &errs())); } diff --git a/llvm/unittests/FuzzMutate/OperationsTest.cpp b/llvm/unittests/FuzzMutate/OperationsTest.cpp index e8c84d8cd26798b..239fe09dfd57568 100644 --- a/llvm/unittests/FuzzMutate/OperationsTest.cpp +++ b/llvm/unittests/FuzzMutate/OperationsTest.cpp @@ -357,7 +357,7 @@ TEST(OperationsTest, SplitBlockWithPhis) { TEST(OperationsTest, GEP) { LLVMContext Ctx; - Type *Int8PtrTy = Type::getInt8PtrTy(Ctx); + Type *Int8PtrTy = PointerType::get(Ctx); Type *Int32Ty = Type::getInt32Ty(Ctx); Module M("M", Ctx); @@ -405,7 +405,7 @@ TEST(OperationsTest, GEPPointerOperand) { TEST(OperationsTest, ExtractAndInsertValue) { LLVMContext Ctx; - Type *Int8PtrTy = Type::getInt8PtrTy(Ctx); + Type *Int8PtrTy = PointerType::get(Ctx); Type *Int32Ty = Type::getInt32Ty(Ctx); Type *Int64Ty = Type::getInt64Ty(Ctx); diff --git a/llvm/unittests/Linker/LinkModulesTest.cpp b/llvm/unittests/Linker/LinkModulesTest.cpp index b301e5a9c70290e..cbd5dba0ffe8680 100644 --- a/llvm/unittests/Linker/LinkModulesTest.cpp +++ b/llvm/unittests/Linker/LinkModulesTest.cpp @@ -28,7 +28,7 @@ class LinkModuleTest : public testing::Test { void SetUp() override { M.reset(new Module("MyModule", Ctx)); FunctionType *FTy = FunctionType::get( - Type::getInt8PtrTy(Ctx), Type::getInt32Ty(Ctx), false /*=isVarArg*/); + PointerType::get(Ctx), Type::getInt32Ty(Ctx), false /*=isVarArg*/); F = Function::Create(FTy, Function::ExternalLinkage, "ba_func", M.get()); F->setCallingConv(CallingConv::C); @@ -37,7 +37,7 @@ class LinkModuleTest : public testing::Test { SwitchCase2BB = BasicBlock::Create(Ctx, "switch.case.2", F); ExitBB = BasicBlock::Create(Ctx, "exit", F); - AT = ArrayType::get(Type::getInt8PtrTy(Ctx), 3); + AT = ArrayType::get(PointerType::get(Ctx), 3); GV = new GlobalVariable(*M.get(), AT, false /*=isConstant*/, GlobalValue::InternalLinkage, nullptr,"switch.bas"); @@ -51,7 +51,7 @@ class LinkModuleTest : public testing::Test { Init.push_back(SwitchCase2BA); ConstantInt *One = ConstantInt::get(Type::getInt32Ty(Ctx), 1); - Constant *OnePtr = ConstantExpr::getIntToPtr(One, Type::getInt8PtrTy(Ctx)); + Constant *OnePtr = ConstantExpr::getIntToPtr(One, PointerType::get(Ctx)); Init.push_back(OnePtr); GV->setInitializer(ConstantArray::get(AT, Init)); @@ -93,7 +93,7 @@ TEST_F(LinkModuleTest, BlockAddress) { Builder.CreateBr(ExitBB); Builder.SetInsertPoint(ExitBB); - Builder.CreateRet(ConstantPointerNull::get(Type::getInt8PtrTy(Ctx))); + Builder.CreateRet(ConstantPointerNull::get(PointerType::get(Ctx))); Module *LinkedModule = new Module("MyModuleLinked", Ctx); Ctx.setDiagnosticHandlerCallBack(expectNoDiags); @@ -108,7 +108,7 @@ TEST_F(LinkModuleTest, BlockAddress) { // i8* blockaddress(@ba_func, %switch.case.2), // i8* inttoptr (i32 1 to i8*)] - ArrayType *AT = ArrayType::get(Type::getInt8PtrTy(Ctx), 3); + ArrayType *AT = ArrayType::get(PointerType::get(Ctx), 3); EXPECT_EQ(AT, Init->getType()); Value *Elem = Init->getOperand(0); @@ -132,7 +132,7 @@ static Module *getExternal(LLVMContext &Ctx, StringRef FuncName) { // Create a module with an empty externally-linked function Module *M = new Module("ExternalModule", Ctx); FunctionType *FTy = FunctionType::get( - Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), false /*=isVarArgs*/); + Type::getVoidTy(Ctx), PointerType::get(Ctx), false /*=isVarArgs*/); Function *F = Function::Create(FTy, Function::ExternalLinkage, FuncName, M); @@ -147,7 +147,7 @@ static Module *getExternal(LLVMContext &Ctx, StringRef FuncName) { static Module *getInternal(LLVMContext &Ctx) { Module *InternalM = new Module("InternalModule", Ctx); FunctionType *FTy = FunctionType::get( - Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), false /*=isVarArgs*/); + Type::getVoidTy(Ctx), PointerType::get(Ctx), false /*=isVarArgs*/); Function *F = Function::Create(FTy, Function::InternalLinkage, "bar", InternalM); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits