[clang] [llvm] [NFC] Remove Type::getInt8PtrTy (PR #71029)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 00:12:54 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-clang

Author: Paulo Matos (pmatos)

<details>
<summary>Changes</summary>

Replace this with PointerType::get().
Also adds AS = 0 as an optional argument to get() methods.

---

Patch is 81.99 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/71029.diff


61 Files Affected:

- (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+6-6) 
- (modified) clang/lib/CodeGen/CodeGenPGO.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+1-1) 
- (modified) clang/lib/CodeGen/CoverageMappingGen.cpp (+1-1) 
- (modified) clang/tools/clang-linker-wrapper/OffloadWrapper.cpp (+19-19) 
- (modified) llvm/examples/BrainF/BrainF.cpp (+1-1) 
- (modified) llvm/include/llvm/IR/DerivedTypes.h (+4-4) 
- (modified) llvm/include/llvm/IR/Type.h (-4) 
- (modified) llvm/include/llvm/ProfileData/InstrProfData.inc (+6-6) 
- (modified) llvm/lib/Analysis/StackSafetyAnalysis.cpp (+2-2) 
- (modified) llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/DwarfEHPrepare.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/StackProtector.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/TargetLoweringBase.cpp (+4-4) 
- (modified) llvm/lib/ExecutionEngine/ExecutionEngine.cpp (+1-1) 
- (modified) llvm/lib/Frontend/Offloading/Utility.cpp (+2-2) 
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+7-7) 
- (modified) llvm/lib/IR/Type.cpp (-4) 
- (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp (+1-1) 
- (modified) llvm/lib/Target/ARM/ARMISelLowering.cpp (+2-2) 
- (modified) llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp (+1-1) 
- (modified) llvm/lib/Target/DirectX/DXILOpBuilder.cpp (+1-1) 
- (modified) llvm/lib/Target/PowerPC/PPCISelLowering.cpp (+1-1) 
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86ISelLoweringCall.cpp (+2-2) 
- (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+6-6) 
- (modified) llvm/lib/Target/XCore/XCoreISelLowering.cpp (+1-1) 
- (modified) llvm/lib/Transforms/CFGuard/CFGuard.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroElide.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Coroutines/CoroInstr.h (+2-2) 
- (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+4-4) 
- (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+4-4) 
- (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp (+5-5) 
- (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/CodeExtractor.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp (+2-2) 
- (modified) llvm/lib/Transforms/Utils/EscapeEnumerator.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/InlineFunction.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/SanitizerStats.cpp (+3-3) 
- (modified) llvm/tools/bugpoint/Miscompilation.cpp (+2-2) 
- (modified) llvm/unittests/Analysis/CGSCCPassManagerTest.cpp (+8-8) 
- (modified) llvm/unittests/Analysis/LazyCallGraphTest.cpp (+24-24) 
- (modified) llvm/unittests/Analysis/MemoryBuiltinsTest.cpp (+1-1) 
- (modified) llvm/unittests/Analysis/ScalarEvolutionTest.cpp (+1-1) 
- (modified) llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp (+2-2) 
- (modified) llvm/unittests/FuzzMutate/OperationsTest.cpp (+2-2) 
- (modified) llvm/unittests/Linker/LinkModulesTest.cpp (+7-7) 


``````````diff
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...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/71029


More information about the llvm-commits mailing list