From b4858c634e35e70627d59f5070d4ddcd8604e4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Pettersson?= Date: Mon, 25 Sep 2023 11:21:24 +0200 Subject: [clang][CodeGen] Simplify code based on opaque pointers (#65624) - Update CodeGenTypeCache to use a single union for all pointers in address space zero. - Introduce a UnqualPtrTy in CodeGenTypeCache, and use that (for example instead of llvm::PointerType::getUnqual) in some places. - Drop some redundant bit/pointers casts from ptr to ptr. --- clang/lib/CodeGen/CodeGenModule.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8b0c9340775c..130cedcd4f2b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -360,13 +360,14 @@ CodeGenModule::CodeGenModule(ASTContext &C, IntTy = llvm::IntegerType::get(LLVMContext, C.getTargetInfo().getIntWidth()); IntPtrTy = llvm::IntegerType::get(LLVMContext, C.getTargetInfo().getMaxPointerWidth()); - Int8PtrTy = Int8Ty->getPointerTo(0); - Int8PtrPtrTy = Int8PtrTy->getPointerTo(0); + Int8PtrTy = llvm::PointerType::get(LLVMContext, 0); const llvm::DataLayout &DL = M.getDataLayout(); - AllocaInt8PtrTy = Int8Ty->getPointerTo(DL.getAllocaAddrSpace()); - GlobalsInt8PtrTy = Int8Ty->getPointerTo(DL.getDefaultGlobalsAddressSpace()); - ConstGlobalsPtrTy = Int8Ty->getPointerTo( - C.getTargetAddressSpace(GetGlobalConstantAddressSpace())); + AllocaInt8PtrTy = + llvm::PointerType::get(LLVMContext, DL.getAllocaAddrSpace()); + GlobalsInt8PtrTy = + llvm::PointerType::get(LLVMContext, DL.getDefaultGlobalsAddressSpace()); + ConstGlobalsPtrTy = llvm::PointerType::get( + LLVMContext, C.getTargetAddressSpace(GetGlobalConstantAddressSpace())); ASTAllocaAddressSpace = getTargetCodeGenInfo().getASTAllocaAddressSpace(); // Build C++20 Module initializers. -- cgit v1.2.3