Skip to content

Conversation

@topperc
Copy link
Collaborator

@topperc topperc commented Nov 22, 2023

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2023

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-backend-amdgpu

Author: Craig Topper (topperc)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/73154.diff

9 Files Affected:

  • (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+10-10)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCleanup.cpp (+2-2)
  • (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (+4-4)
  • (modified) llvm/lib/Transforms/Scalar/SROA.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+3-3)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+5-5)
  • (modified) llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/SanitizerStats.cpp (+1-1)
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index d04645e89f92843..6daf84385dbff31 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -1806,7 +1806,7 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc, ++P; } - DepArrayPtr = Builder.CreateBitCast(DepArray, Builder.getInt8PtrTy()); + DepArrayPtr = Builder.CreateBitCast(DepArray, Builder.getPtrTy()); Builder.restoreIP(OldIP); } @@ -2082,7 +2082,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( // Create and populate array of type-erased pointers to private reduction // values. unsigned NumReductions = ReductionInfos.size(); - Type *RedArrayTy = ArrayType::get(Builder.getInt8PtrTy(), NumReductions); + Type *RedArrayTy = ArrayType::get(Builder.getPtrTy(), NumReductions); Builder.restoreIP(AllocaIP); Value *RedArray = Builder.CreateAlloca(RedArrayTy, nullptr, "red.array"); @@ -2094,7 +2094,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( Value *RedArrayElemPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, RedArray, 0, Index, "red.array.elem." + Twine(Index)); Value *Casted = - Builder.CreateBitCast(RI.PrivateVariable, Builder.getInt8PtrTy(), + Builder.CreateBitCast(RI.PrivateVariable, Builder.getPtrTy(), "private.red.var." + Twine(Index) + ".casted"); Builder.CreateStore(Casted, RedArrayElemPtr); } @@ -2104,7 +2104,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( Function *Func = Builder.GetInsertBlock()->getParent(); Module *Module = Func->getParent(); Value *RedArrayPtr = - Builder.CreateBitCast(RedArray, Builder.getInt8PtrTy(), "red.array.ptr"); + Builder.CreateBitCast(RedArray, Builder.getPtrTy(), "red.array.ptr"); uint32_t SrcLocStrSize; Constant *SrcLocStr = getOrCreateSrcLocStr(Loc, SrcLocStrSize); bool CanGenerateAtomic = @@ -2197,12 +2197,12 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( const ReductionInfo &RI = En.value(); Value *LHSI8PtrPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, LHSArrayPtr, 0, En.index()); - Value *LHSI8Ptr = Builder.CreateLoad(Builder.getInt8PtrTy(), LHSI8PtrPtr); + Value *LHSI8Ptr = Builder.CreateLoad(Builder.getPtrTy(), LHSI8PtrPtr); Value *LHSPtr = Builder.CreateBitCast(LHSI8Ptr, RI.Variable->getType()); Value *LHS = Builder.CreateLoad(RI.ElementType, LHSPtr); Value *RHSI8PtrPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, RHSArrayPtr, 0, En.index()); - Value *RHSI8Ptr = Builder.CreateLoad(Builder.getInt8PtrTy(), RHSI8PtrPtr); + Value *RHSI8Ptr = Builder.CreateLoad(Builder.getPtrTy(), RHSI8PtrPtr); Value *RHSPtr = Builder.CreateBitCast(RHSI8Ptr, RI.PrivateVariable->getType()); Value *RHS = Builder.CreateLoad(RI.ElementType, RHSPtr); @@ -5198,12 +5198,12 @@ void OpenMPIRBuilder::emitNonContiguousDescriptor(InsertPointTy AllocaIP, // args[I] = &dims Builder.restoreIP(CodeGenIP); Value *DAddr = Builder.CreatePointerBitCastOrAddrSpaceCast( - DimsAddr, Builder.getInt8PtrTy()); + DimsAddr, Builder.getPtrTy()); Value *P = Builder.CreateConstInBoundsGEP2_32( - ArrayType::get(Builder.getInt8PtrTy(), Info.NumberOfPtrs), + ArrayType::get(Builder.getPtrTy(), Info.NumberOfPtrs), Info.RTArgs.PointersArray, 0, I); Builder.CreateAlignedStore( - DAddr, P, M.getDataLayout().getPrefTypeAlign(Builder.getInt8PtrTy())); + DAddr, P, M.getDataLayout().getPrefTypeAlign(Builder.getPtrTy())); ++L; } } @@ -5225,7 +5225,7 @@ void OpenMPIRBuilder::emitOffloadingArrays( // Detect if we have any capture size requiring runtime evaluation of the // size so that a constant array could be eventually used. ArrayType *PointerArrayType = - ArrayType::get(Builder.getInt8PtrTy(), Info.NumberOfPtrs); + ArrayType::get(Builder.getPtrTy(), Info.NumberOfPtrs); Info.RTArgs.BasePointersArray = Builder.CreateAlloca( PointerArrayType, /* ArraySize = */ nullptr, ".offload_baseptrs"); diff --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp index 29978bef661c6ea..5c10d4ddaacd512 100644 --- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp @@ -32,8 +32,8 @@ static void lowerSubFn(IRBuilder<> &Builder, CoroSubFnInst *SubFn) { Value *FrameRaw = SubFn->getFrame(); int Index = SubFn->getIndex(); - auto *FrameTy = StructType::get( - SubFn->getContext(), {Builder.getInt8PtrTy(), Builder.getInt8PtrTy()}); + auto *FrameTy = StructType::get(SubFn->getContext(), + {Builder.getPtrTy(), Builder.getPtrTy()}); PointerType *FramePtrTy = FrameTy->getPointerTo(); Builder.SetInsertPoint(SubFn); diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 1a46e8ce1e729eb..e1857abca79040c 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -1481,7 +1481,7 @@ static void handleNoSuspendCoroutine(coro::Shape &Shape) { IRBuilder<> Builder(AllocInst); auto *Frame = Builder.CreateAlloca(Shape.FrameTy); Frame->setAlignment(Shape.FrameAlign); - auto *VFrame = Builder.CreateBitCast(Frame, Builder.getInt8PtrTy()); + auto *VFrame = Builder.CreateBitCast(Frame, Builder.getPtrTy()); AllocInst->replaceAllUsesWith(Builder.getFalse()); AllocInst->eraseFromParent(); CoroBegin->replaceAllUsesWith(VFrame); diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 4093a5a51a4d79e..13e88204c7b47f4 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -1021,7 +1021,7 @@ bool LoopIdiomRecognize::processLoopStridedStore( SCEVExpander Expander(*SE, *DL, "loop-idiom"); SCEVExpanderCleaner ExpCleaner(Expander); - Type *DestInt8PtrTy = Builder.getInt8PtrTy(DestAS); + Type *DestInt8PtrTy = Builder.getPtrTy(DestAS); Type *IntIdxTy = DL->getIndexType(DestPtr->getType()); bool Changed = false; @@ -1282,7 +1282,7 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( // feeds the stores. Check for an alias by generating the base address and // checking everything. Value *StoreBasePtr = Expander.expandCodeFor( - StrStart, Builder.getInt8PtrTy(StrAS), Preheader->getTerminator()); + StrStart, Builder.getPtrTy(StrAS), Preheader->getTerminator()); // From here on out, conservatively report to the pass manager that we've // changed the IR, even if we later clean up these added instructions. There @@ -1334,8 +1334,8 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( // For a memcpy, we have to make sure that the input array is not being // mutated by the loop. - Value *LoadBasePtr = Expander.expandCodeFor( - LdStart, Builder.getInt8PtrTy(LdAS), Preheader->getTerminator()); + Value *LoadBasePtr = Expander.expandCodeFor(LdStart, Builder.getPtrTy(LdAS), + Preheader->getTerminator()); // If the store is a memcpy instruction, we must check if it will write to // the load memory locations. So remove it from the ignored stores. diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 1344765444d29de..458675380d317a1 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3502,7 +3502,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> { NewEndOffset - NewBeginOffset); // Lifetime intrinsics always expect an i8* so directly get such a pointer // for the new alloca slice. - Type *PointerTy = IRB.getInt8PtrTy(OldPtr->getType()->getPointerAddressSpace()); + Type *PointerTy = IRB.getPtrTy(OldPtr->getType()->getPointerAddressSpace()); Value *Ptr = getNewAllocaSlicePtr(IRB, PointerTy); Value *New; if (II.getIntrinsicID() == Intrinsic::lifetime_start) diff --git a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp index 2195406c144c8ba..304e6cbcf5471f2 100644 --- a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp +++ b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp @@ -153,7 +153,7 @@ static Value *getStrlenWithNull(IRBuilder<> &Builder, Value *Str) { static Value *callAppendStringN(IRBuilder<> &Builder, Value *Desc, Value *Str, Value *Length, bool isLast) { auto Int64Ty = Builder.getInt64Ty(); - auto CharPtrTy = Builder.getInt8PtrTy(); + auto CharPtrTy = Builder.getPtrTy(); auto Int32Ty = Builder.getInt32Ty(); auto M = Builder.GetInsertBlock()->getModule(); auto Fn = M->getOrInsertFunction("__ockl_printf_append_string_n", Int64Ty, @@ -165,7 +165,7 @@ static Value *callAppendStringN(IRBuilder<> &Builder, Value *Desc, Value *Str, static Value *appendString(IRBuilder<> &Builder, Value *Desc, Value *Arg, bool IsLast) { Arg = Builder.CreateBitCast( - Arg, Builder.getInt8PtrTy(Arg->getType()->getPointerAddressSpace())); + Arg, Builder.getPtrTy(Arg->getType()->getPointerAddressSpace())); auto Length = getStrlenWithNull(Builder, Arg); return callAppendStringN(Builder, Desc, Arg, Length, IsLast); } @@ -300,7 +300,7 @@ static Value *callBufferedPrintfStart( Type *Tys_alloc[1] = {Builder.getInt32Ty()}; Type *I8Ptr = - Builder.getInt8PtrTy(M->getDataLayout().getDefaultGlobalsAddressSpace()); + Builder.getPtrTy(M->getDataLayout().getDefaultGlobalsAddressSpace()); FunctionType *FTy_alloc = FunctionType::get(I8Ptr, Tys_alloc, false); auto PrintfAllocFn = M->getOrInsertFunction(StringRef("__printf_alloc"), FTy_alloc, Attr); diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index a3737d428a00b5f..d6bb832654cd084 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -44,17 +44,17 @@ static void appendToGlobalArray(StringRef ArrayName, Module &M, Function *F, } GVCtor->eraseFromParent(); } else { - EltTy = StructType::get( - IRB.getInt32Ty(), PointerType::get(FnTy, F->getAddressSpace()), - IRB.getInt8PtrTy()); + EltTy = StructType::get(IRB.getInt32Ty(), + PointerType::get(FnTy, F->getAddressSpace()), + IRB.getPtrTy()); } // Build a 3 field global_ctor entry. We don't take a comdat key. Constant *CSVals[3]; CSVals[0] = IRB.getInt32(Priority); CSVals[1] = F; - CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy()) - : Constant::getNullValue(IRB.getInt8PtrTy()); + CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getPtrTy()) + : Constant::getNullValue(IRB.getPtrTy()); Constant *RuntimeCtorInit = ConstantStruct::get(EltTy, ArrayRef(CSVals, EltTy->getNumElements())); diff --git a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp index 1666535b169600a..ea1355139913fbd 100644 --- a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp +++ b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp @@ -160,7 +160,7 @@ static void convertToRelLookupTable(GlobalVariable &LookupTable) { "reltable.intrinsic"); // Create a bitcast instruction if necessary. - if (Load->getType() != Builder.getInt8PtrTy()) + if (Load->getType() != Builder.getPtrTy()) Result = Builder.CreateBitCast(Result, Load->getType(), "reltable.bitcast"); // Replace load instruction with the new generated instruction sequence. diff --git a/llvm/lib/Transforms/Utils/SanitizerStats.cpp b/llvm/lib/Transforms/Utils/SanitizerStats.cpp index 1791694ec36aa26..e7742c550933ecb 100644 --- a/llvm/lib/Transforms/Utils/SanitizerStats.cpp +++ b/llvm/lib/Transforms/Utils/SanitizerStats.cpp @@ -42,7 +42,7 @@ StructType *SanitizerStatReport::makeModuleStatsTy() { void SanitizerStatReport::create(IRBuilder<> &B, SanitizerStatKind SK) { Function *F = B.GetInsertBlock()->getParent(); Module *M = F->getParent(); - PointerType *Int8PtrTy = B.getInt8PtrTy(); + PointerType *Int8PtrTy = B.getPtrTy(); IntegerType *IntPtrTy = B.getIntPtrTy(M->getDataLayout()); ArrayType *StatTy = ArrayType::get(Int8PtrTy, 2); 
@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2023

@llvm/pr-subscribers-coroutines

Author: Craig Topper (topperc)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/73154.diff

9 Files Affected:

  • (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+10-10)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCleanup.cpp (+2-2)
  • (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (+4-4)
  • (modified) llvm/lib/Transforms/Scalar/SROA.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+3-3)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+5-5)
  • (modified) llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/SanitizerStats.cpp (+1-1)
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index d04645e89f92843..6daf84385dbff31 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -1806,7 +1806,7 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc, ++P; } - DepArrayPtr = Builder.CreateBitCast(DepArray, Builder.getInt8PtrTy()); + DepArrayPtr = Builder.CreateBitCast(DepArray, Builder.getPtrTy()); Builder.restoreIP(OldIP); } @@ -2082,7 +2082,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( // Create and populate array of type-erased pointers to private reduction // values. unsigned NumReductions = ReductionInfos.size(); - Type *RedArrayTy = ArrayType::get(Builder.getInt8PtrTy(), NumReductions); + Type *RedArrayTy = ArrayType::get(Builder.getPtrTy(), NumReductions); Builder.restoreIP(AllocaIP); Value *RedArray = Builder.CreateAlloca(RedArrayTy, nullptr, "red.array"); @@ -2094,7 +2094,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( Value *RedArrayElemPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, RedArray, 0, Index, "red.array.elem." + Twine(Index)); Value *Casted = - Builder.CreateBitCast(RI.PrivateVariable, Builder.getInt8PtrTy(), + Builder.CreateBitCast(RI.PrivateVariable, Builder.getPtrTy(), "private.red.var." + Twine(Index) + ".casted"); Builder.CreateStore(Casted, RedArrayElemPtr); } @@ -2104,7 +2104,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( Function *Func = Builder.GetInsertBlock()->getParent(); Module *Module = Func->getParent(); Value *RedArrayPtr = - Builder.CreateBitCast(RedArray, Builder.getInt8PtrTy(), "red.array.ptr"); + Builder.CreateBitCast(RedArray, Builder.getPtrTy(), "red.array.ptr"); uint32_t SrcLocStrSize; Constant *SrcLocStr = getOrCreateSrcLocStr(Loc, SrcLocStrSize); bool CanGenerateAtomic = @@ -2197,12 +2197,12 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( const ReductionInfo &RI = En.value(); Value *LHSI8PtrPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, LHSArrayPtr, 0, En.index()); - Value *LHSI8Ptr = Builder.CreateLoad(Builder.getInt8PtrTy(), LHSI8PtrPtr); + Value *LHSI8Ptr = Builder.CreateLoad(Builder.getPtrTy(), LHSI8PtrPtr); Value *LHSPtr = Builder.CreateBitCast(LHSI8Ptr, RI.Variable->getType()); Value *LHS = Builder.CreateLoad(RI.ElementType, LHSPtr); Value *RHSI8PtrPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, RHSArrayPtr, 0, En.index()); - Value *RHSI8Ptr = Builder.CreateLoad(Builder.getInt8PtrTy(), RHSI8PtrPtr); + Value *RHSI8Ptr = Builder.CreateLoad(Builder.getPtrTy(), RHSI8PtrPtr); Value *RHSPtr = Builder.CreateBitCast(RHSI8Ptr, RI.PrivateVariable->getType()); Value *RHS = Builder.CreateLoad(RI.ElementType, RHSPtr); @@ -5198,12 +5198,12 @@ void OpenMPIRBuilder::emitNonContiguousDescriptor(InsertPointTy AllocaIP, // args[I] = &dims Builder.restoreIP(CodeGenIP); Value *DAddr = Builder.CreatePointerBitCastOrAddrSpaceCast( - DimsAddr, Builder.getInt8PtrTy()); + DimsAddr, Builder.getPtrTy()); Value *P = Builder.CreateConstInBoundsGEP2_32( - ArrayType::get(Builder.getInt8PtrTy(), Info.NumberOfPtrs), + ArrayType::get(Builder.getPtrTy(), Info.NumberOfPtrs), Info.RTArgs.PointersArray, 0, I); Builder.CreateAlignedStore( - DAddr, P, M.getDataLayout().getPrefTypeAlign(Builder.getInt8PtrTy())); + DAddr, P, M.getDataLayout().getPrefTypeAlign(Builder.getPtrTy())); ++L; } } @@ -5225,7 +5225,7 @@ void OpenMPIRBuilder::emitOffloadingArrays( // Detect if we have any capture size requiring runtime evaluation of the // size so that a constant array could be eventually used. ArrayType *PointerArrayType = - ArrayType::get(Builder.getInt8PtrTy(), Info.NumberOfPtrs); + ArrayType::get(Builder.getPtrTy(), Info.NumberOfPtrs); Info.RTArgs.BasePointersArray = Builder.CreateAlloca( PointerArrayType, /* ArraySize = */ nullptr, ".offload_baseptrs"); diff --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp index 29978bef661c6ea..5c10d4ddaacd512 100644 --- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp @@ -32,8 +32,8 @@ static void lowerSubFn(IRBuilder<> &Builder, CoroSubFnInst *SubFn) { Value *FrameRaw = SubFn->getFrame(); int Index = SubFn->getIndex(); - auto *FrameTy = StructType::get( - SubFn->getContext(), {Builder.getInt8PtrTy(), Builder.getInt8PtrTy()}); + auto *FrameTy = StructType::get(SubFn->getContext(), + {Builder.getPtrTy(), Builder.getPtrTy()}); PointerType *FramePtrTy = FrameTy->getPointerTo(); Builder.SetInsertPoint(SubFn); diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 1a46e8ce1e729eb..e1857abca79040c 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -1481,7 +1481,7 @@ static void handleNoSuspendCoroutine(coro::Shape &Shape) { IRBuilder<> Builder(AllocInst); auto *Frame = Builder.CreateAlloca(Shape.FrameTy); Frame->setAlignment(Shape.FrameAlign); - auto *VFrame = Builder.CreateBitCast(Frame, Builder.getInt8PtrTy()); + auto *VFrame = Builder.CreateBitCast(Frame, Builder.getPtrTy()); AllocInst->replaceAllUsesWith(Builder.getFalse()); AllocInst->eraseFromParent(); CoroBegin->replaceAllUsesWith(VFrame); diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 4093a5a51a4d79e..13e88204c7b47f4 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -1021,7 +1021,7 @@ bool LoopIdiomRecognize::processLoopStridedStore( SCEVExpander Expander(*SE, *DL, "loop-idiom"); SCEVExpanderCleaner ExpCleaner(Expander); - Type *DestInt8PtrTy = Builder.getInt8PtrTy(DestAS); + Type *DestInt8PtrTy = Builder.getPtrTy(DestAS); Type *IntIdxTy = DL->getIndexType(DestPtr->getType()); bool Changed = false; @@ -1282,7 +1282,7 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( // feeds the stores. Check for an alias by generating the base address and // checking everything. Value *StoreBasePtr = Expander.expandCodeFor( - StrStart, Builder.getInt8PtrTy(StrAS), Preheader->getTerminator()); + StrStart, Builder.getPtrTy(StrAS), Preheader->getTerminator()); // From here on out, conservatively report to the pass manager that we've // changed the IR, even if we later clean up these added instructions. There @@ -1334,8 +1334,8 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( // For a memcpy, we have to make sure that the input array is not being // mutated by the loop. - Value *LoadBasePtr = Expander.expandCodeFor( - LdStart, Builder.getInt8PtrTy(LdAS), Preheader->getTerminator()); + Value *LoadBasePtr = Expander.expandCodeFor(LdStart, Builder.getPtrTy(LdAS), + Preheader->getTerminator()); // If the store is a memcpy instruction, we must check if it will write to // the load memory locations. So remove it from the ignored stores. diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 1344765444d29de..458675380d317a1 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3502,7 +3502,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> { NewEndOffset - NewBeginOffset); // Lifetime intrinsics always expect an i8* so directly get such a pointer // for the new alloca slice. - Type *PointerTy = IRB.getInt8PtrTy(OldPtr->getType()->getPointerAddressSpace()); + Type *PointerTy = IRB.getPtrTy(OldPtr->getType()->getPointerAddressSpace()); Value *Ptr = getNewAllocaSlicePtr(IRB, PointerTy); Value *New; if (II.getIntrinsicID() == Intrinsic::lifetime_start) diff --git a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp index 2195406c144c8ba..304e6cbcf5471f2 100644 --- a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp +++ b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp @@ -153,7 +153,7 @@ static Value *getStrlenWithNull(IRBuilder<> &Builder, Value *Str) { static Value *callAppendStringN(IRBuilder<> &Builder, Value *Desc, Value *Str, Value *Length, bool isLast) { auto Int64Ty = Builder.getInt64Ty(); - auto CharPtrTy = Builder.getInt8PtrTy(); + auto CharPtrTy = Builder.getPtrTy(); auto Int32Ty = Builder.getInt32Ty(); auto M = Builder.GetInsertBlock()->getModule(); auto Fn = M->getOrInsertFunction("__ockl_printf_append_string_n", Int64Ty, @@ -165,7 +165,7 @@ static Value *callAppendStringN(IRBuilder<> &Builder, Value *Desc, Value *Str, static Value *appendString(IRBuilder<> &Builder, Value *Desc, Value *Arg, bool IsLast) { Arg = Builder.CreateBitCast( - Arg, Builder.getInt8PtrTy(Arg->getType()->getPointerAddressSpace())); + Arg, Builder.getPtrTy(Arg->getType()->getPointerAddressSpace())); auto Length = getStrlenWithNull(Builder, Arg); return callAppendStringN(Builder, Desc, Arg, Length, IsLast); } @@ -300,7 +300,7 @@ static Value *callBufferedPrintfStart( Type *Tys_alloc[1] = {Builder.getInt32Ty()}; Type *I8Ptr = - Builder.getInt8PtrTy(M->getDataLayout().getDefaultGlobalsAddressSpace()); + Builder.getPtrTy(M->getDataLayout().getDefaultGlobalsAddressSpace()); FunctionType *FTy_alloc = FunctionType::get(I8Ptr, Tys_alloc, false); auto PrintfAllocFn = M->getOrInsertFunction(StringRef("__printf_alloc"), FTy_alloc, Attr); diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index a3737d428a00b5f..d6bb832654cd084 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -44,17 +44,17 @@ static void appendToGlobalArray(StringRef ArrayName, Module &M, Function *F, } GVCtor->eraseFromParent(); } else { - EltTy = StructType::get( - IRB.getInt32Ty(), PointerType::get(FnTy, F->getAddressSpace()), - IRB.getInt8PtrTy()); + EltTy = StructType::get(IRB.getInt32Ty(), + PointerType::get(FnTy, F->getAddressSpace()), + IRB.getPtrTy()); } // Build a 3 field global_ctor entry. We don't take a comdat key. Constant *CSVals[3]; CSVals[0] = IRB.getInt32(Priority); CSVals[1] = F; - CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy()) - : Constant::getNullValue(IRB.getInt8PtrTy()); + CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getPtrTy()) + : Constant::getNullValue(IRB.getPtrTy()); Constant *RuntimeCtorInit = ConstantStruct::get(EltTy, ArrayRef(CSVals, EltTy->getNumElements())); diff --git a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp index 1666535b169600a..ea1355139913fbd 100644 --- a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp +++ b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp @@ -160,7 +160,7 @@ static void convertToRelLookupTable(GlobalVariable &LookupTable) { "reltable.intrinsic"); // Create a bitcast instruction if necessary. - if (Load->getType() != Builder.getInt8PtrTy()) + if (Load->getType() != Builder.getPtrTy()) Result = Builder.CreateBitCast(Result, Load->getType(), "reltable.bitcast"); // Replace load instruction with the new generated instruction sequence. diff --git a/llvm/lib/Transforms/Utils/SanitizerStats.cpp b/llvm/lib/Transforms/Utils/SanitizerStats.cpp index 1791694ec36aa26..e7742c550933ecb 100644 --- a/llvm/lib/Transforms/Utils/SanitizerStats.cpp +++ b/llvm/lib/Transforms/Utils/SanitizerStats.cpp @@ -42,7 +42,7 @@ StructType *SanitizerStatReport::makeModuleStatsTy() { void SanitizerStatReport::create(IRBuilder<> &B, SanitizerStatKind SK) { Function *F = B.GetInsertBlock()->getParent(); Module *M = F->getParent(); - PointerType *Int8PtrTy = B.getInt8PtrTy(); + PointerType *Int8PtrTy = B.getPtrTy(); IntegerType *IntPtrTy = B.getIntPtrTy(M->getDataLayout()); ArrayType *StatTy = ArrayType::get(Int8PtrTy, 2); 
@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2023

@llvm/pr-subscribers-flang-openmp

Author: Craig Topper (topperc)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/73154.diff

9 Files Affected:

  • (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+10-10)
  • (modified) llvm/lib/Transforms/Coroutines/CoroCleanup.cpp (+2-2)
  • (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (+4-4)
  • (modified) llvm/lib/Transforms/Scalar/SROA.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+3-3)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+5-5)
  • (modified) llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/SanitizerStats.cpp (+1-1)
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index d04645e89f92843..6daf84385dbff31 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -1806,7 +1806,7 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc, ++P; } - DepArrayPtr = Builder.CreateBitCast(DepArray, Builder.getInt8PtrTy()); + DepArrayPtr = Builder.CreateBitCast(DepArray, Builder.getPtrTy()); Builder.restoreIP(OldIP); } @@ -2082,7 +2082,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( // Create and populate array of type-erased pointers to private reduction // values. unsigned NumReductions = ReductionInfos.size(); - Type *RedArrayTy = ArrayType::get(Builder.getInt8PtrTy(), NumReductions); + Type *RedArrayTy = ArrayType::get(Builder.getPtrTy(), NumReductions); Builder.restoreIP(AllocaIP); Value *RedArray = Builder.CreateAlloca(RedArrayTy, nullptr, "red.array"); @@ -2094,7 +2094,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( Value *RedArrayElemPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, RedArray, 0, Index, "red.array.elem." + Twine(Index)); Value *Casted = - Builder.CreateBitCast(RI.PrivateVariable, Builder.getInt8PtrTy(), + Builder.CreateBitCast(RI.PrivateVariable, Builder.getPtrTy(), "private.red.var." + Twine(Index) + ".casted"); Builder.CreateStore(Casted, RedArrayElemPtr); } @@ -2104,7 +2104,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( Function *Func = Builder.GetInsertBlock()->getParent(); Module *Module = Func->getParent(); Value *RedArrayPtr = - Builder.CreateBitCast(RedArray, Builder.getInt8PtrTy(), "red.array.ptr"); + Builder.CreateBitCast(RedArray, Builder.getPtrTy(), "red.array.ptr"); uint32_t SrcLocStrSize; Constant *SrcLocStr = getOrCreateSrcLocStr(Loc, SrcLocStrSize); bool CanGenerateAtomic = @@ -2197,12 +2197,12 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductions( const ReductionInfo &RI = En.value(); Value *LHSI8PtrPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, LHSArrayPtr, 0, En.index()); - Value *LHSI8Ptr = Builder.CreateLoad(Builder.getInt8PtrTy(), LHSI8PtrPtr); + Value *LHSI8Ptr = Builder.CreateLoad(Builder.getPtrTy(), LHSI8PtrPtr); Value *LHSPtr = Builder.CreateBitCast(LHSI8Ptr, RI.Variable->getType()); Value *LHS = Builder.CreateLoad(RI.ElementType, LHSPtr); Value *RHSI8PtrPtr = Builder.CreateConstInBoundsGEP2_64( RedArrayTy, RHSArrayPtr, 0, En.index()); - Value *RHSI8Ptr = Builder.CreateLoad(Builder.getInt8PtrTy(), RHSI8PtrPtr); + Value *RHSI8Ptr = Builder.CreateLoad(Builder.getPtrTy(), RHSI8PtrPtr); Value *RHSPtr = Builder.CreateBitCast(RHSI8Ptr, RI.PrivateVariable->getType()); Value *RHS = Builder.CreateLoad(RI.ElementType, RHSPtr); @@ -5198,12 +5198,12 @@ void OpenMPIRBuilder::emitNonContiguousDescriptor(InsertPointTy AllocaIP, // args[I] = &dims Builder.restoreIP(CodeGenIP); Value *DAddr = Builder.CreatePointerBitCastOrAddrSpaceCast( - DimsAddr, Builder.getInt8PtrTy()); + DimsAddr, Builder.getPtrTy()); Value *P = Builder.CreateConstInBoundsGEP2_32( - ArrayType::get(Builder.getInt8PtrTy(), Info.NumberOfPtrs), + ArrayType::get(Builder.getPtrTy(), Info.NumberOfPtrs), Info.RTArgs.PointersArray, 0, I); Builder.CreateAlignedStore( - DAddr, P, M.getDataLayout().getPrefTypeAlign(Builder.getInt8PtrTy())); + DAddr, P, M.getDataLayout().getPrefTypeAlign(Builder.getPtrTy())); ++L; } } @@ -5225,7 +5225,7 @@ void OpenMPIRBuilder::emitOffloadingArrays( // Detect if we have any capture size requiring runtime evaluation of the // size so that a constant array could be eventually used. ArrayType *PointerArrayType = - ArrayType::get(Builder.getInt8PtrTy(), Info.NumberOfPtrs); + ArrayType::get(Builder.getPtrTy(), Info.NumberOfPtrs); Info.RTArgs.BasePointersArray = Builder.CreateAlloca( PointerArrayType, /* ArraySize = */ nullptr, ".offload_baseptrs"); diff --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp index 29978bef661c6ea..5c10d4ddaacd512 100644 --- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp @@ -32,8 +32,8 @@ static void lowerSubFn(IRBuilder<> &Builder, CoroSubFnInst *SubFn) { Value *FrameRaw = SubFn->getFrame(); int Index = SubFn->getIndex(); - auto *FrameTy = StructType::get( - SubFn->getContext(), {Builder.getInt8PtrTy(), Builder.getInt8PtrTy()}); + auto *FrameTy = StructType::get(SubFn->getContext(), + {Builder.getPtrTy(), Builder.getPtrTy()}); PointerType *FramePtrTy = FrameTy->getPointerTo(); Builder.SetInsertPoint(SubFn); diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 1a46e8ce1e729eb..e1857abca79040c 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -1481,7 +1481,7 @@ static void handleNoSuspendCoroutine(coro::Shape &Shape) { IRBuilder<> Builder(AllocInst); auto *Frame = Builder.CreateAlloca(Shape.FrameTy); Frame->setAlignment(Shape.FrameAlign); - auto *VFrame = Builder.CreateBitCast(Frame, Builder.getInt8PtrTy()); + auto *VFrame = Builder.CreateBitCast(Frame, Builder.getPtrTy()); AllocInst->replaceAllUsesWith(Builder.getFalse()); AllocInst->eraseFromParent(); CoroBegin->replaceAllUsesWith(VFrame); diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 4093a5a51a4d79e..13e88204c7b47f4 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -1021,7 +1021,7 @@ bool LoopIdiomRecognize::processLoopStridedStore( SCEVExpander Expander(*SE, *DL, "loop-idiom"); SCEVExpanderCleaner ExpCleaner(Expander); - Type *DestInt8PtrTy = Builder.getInt8PtrTy(DestAS); + Type *DestInt8PtrTy = Builder.getPtrTy(DestAS); Type *IntIdxTy = DL->getIndexType(DestPtr->getType()); bool Changed = false; @@ -1282,7 +1282,7 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( // feeds the stores. Check for an alias by generating the base address and // checking everything. Value *StoreBasePtr = Expander.expandCodeFor( - StrStart, Builder.getInt8PtrTy(StrAS), Preheader->getTerminator()); + StrStart, Builder.getPtrTy(StrAS), Preheader->getTerminator()); // From here on out, conservatively report to the pass manager that we've // changed the IR, even if we later clean up these added instructions. There @@ -1334,8 +1334,8 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( // For a memcpy, we have to make sure that the input array is not being // mutated by the loop. - Value *LoadBasePtr = Expander.expandCodeFor( - LdStart, Builder.getInt8PtrTy(LdAS), Preheader->getTerminator()); + Value *LoadBasePtr = Expander.expandCodeFor(LdStart, Builder.getPtrTy(LdAS), + Preheader->getTerminator()); // If the store is a memcpy instruction, we must check if it will write to // the load memory locations. So remove it from the ignored stores. diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 1344765444d29de..458675380d317a1 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3502,7 +3502,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> { NewEndOffset - NewBeginOffset); // Lifetime intrinsics always expect an i8* so directly get such a pointer // for the new alloca slice. - Type *PointerTy = IRB.getInt8PtrTy(OldPtr->getType()->getPointerAddressSpace()); + Type *PointerTy = IRB.getPtrTy(OldPtr->getType()->getPointerAddressSpace()); Value *Ptr = getNewAllocaSlicePtr(IRB, PointerTy); Value *New; if (II.getIntrinsicID() == Intrinsic::lifetime_start) diff --git a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp index 2195406c144c8ba..304e6cbcf5471f2 100644 --- a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp +++ b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp @@ -153,7 +153,7 @@ static Value *getStrlenWithNull(IRBuilder<> &Builder, Value *Str) { static Value *callAppendStringN(IRBuilder<> &Builder, Value *Desc, Value *Str, Value *Length, bool isLast) { auto Int64Ty = Builder.getInt64Ty(); - auto CharPtrTy = Builder.getInt8PtrTy(); + auto CharPtrTy = Builder.getPtrTy(); auto Int32Ty = Builder.getInt32Ty(); auto M = Builder.GetInsertBlock()->getModule(); auto Fn = M->getOrInsertFunction("__ockl_printf_append_string_n", Int64Ty, @@ -165,7 +165,7 @@ static Value *callAppendStringN(IRBuilder<> &Builder, Value *Desc, Value *Str, static Value *appendString(IRBuilder<> &Builder, Value *Desc, Value *Arg, bool IsLast) { Arg = Builder.CreateBitCast( - Arg, Builder.getInt8PtrTy(Arg->getType()->getPointerAddressSpace())); + Arg, Builder.getPtrTy(Arg->getType()->getPointerAddressSpace())); auto Length = getStrlenWithNull(Builder, Arg); return callAppendStringN(Builder, Desc, Arg, Length, IsLast); } @@ -300,7 +300,7 @@ static Value *callBufferedPrintfStart( Type *Tys_alloc[1] = {Builder.getInt32Ty()}; Type *I8Ptr = - Builder.getInt8PtrTy(M->getDataLayout().getDefaultGlobalsAddressSpace()); + Builder.getPtrTy(M->getDataLayout().getDefaultGlobalsAddressSpace()); FunctionType *FTy_alloc = FunctionType::get(I8Ptr, Tys_alloc, false); auto PrintfAllocFn = M->getOrInsertFunction(StringRef("__printf_alloc"), FTy_alloc, Attr); diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index a3737d428a00b5f..d6bb832654cd084 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -44,17 +44,17 @@ static void appendToGlobalArray(StringRef ArrayName, Module &M, Function *F, } GVCtor->eraseFromParent(); } else { - EltTy = StructType::get( - IRB.getInt32Ty(), PointerType::get(FnTy, F->getAddressSpace()), - IRB.getInt8PtrTy()); + EltTy = StructType::get(IRB.getInt32Ty(), + PointerType::get(FnTy, F->getAddressSpace()), + IRB.getPtrTy()); } // Build a 3 field global_ctor entry. We don't take a comdat key. Constant *CSVals[3]; CSVals[0] = IRB.getInt32(Priority); CSVals[1] = F; - CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy()) - : Constant::getNullValue(IRB.getInt8PtrTy()); + CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getPtrTy()) + : Constant::getNullValue(IRB.getPtrTy()); Constant *RuntimeCtorInit = ConstantStruct::get(EltTy, ArrayRef(CSVals, EltTy->getNumElements())); diff --git a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp index 1666535b169600a..ea1355139913fbd 100644 --- a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp +++ b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp @@ -160,7 +160,7 @@ static void convertToRelLookupTable(GlobalVariable &LookupTable) { "reltable.intrinsic"); // Create a bitcast instruction if necessary. - if (Load->getType() != Builder.getInt8PtrTy()) + if (Load->getType() != Builder.getPtrTy()) Result = Builder.CreateBitCast(Result, Load->getType(), "reltable.bitcast"); // Replace load instruction with the new generated instruction sequence. diff --git a/llvm/lib/Transforms/Utils/SanitizerStats.cpp b/llvm/lib/Transforms/Utils/SanitizerStats.cpp index 1791694ec36aa26..e7742c550933ecb 100644 --- a/llvm/lib/Transforms/Utils/SanitizerStats.cpp +++ b/llvm/lib/Transforms/Utils/SanitizerStats.cpp @@ -42,7 +42,7 @@ StructType *SanitizerStatReport::makeModuleStatsTy() { void SanitizerStatReport::create(IRBuilder<> &B, SanitizerStatKind SK) { Function *F = B.GetInsertBlock()->getParent(); Module *M = F->getParent(); - PointerType *Int8PtrTy = B.getInt8PtrTy(); + PointerType *Int8PtrTy = B.getPtrTy(); IntegerType *IntPtrTy = B.getIntPtrTy(M->getDataLayout()); ArrayType *StatTy = ArrayType::get(Int8PtrTy, 2); 

// Create a bitcast instruction if necessary.
if (Load->getType() != Builder.getInt8PtrTy())
if (Load->getType() != Builder.getPtrTy())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this if and bitcast.

@github-actions
Copy link

github-actions bot commented Nov 22, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

RedArrayTy, RedArray, 0, Index, "red.array.elem." + Twine(Index));
Value *Casted =
Builder.CreateBitCast(RI.PrivateVariable, Builder.getInt8PtrTy(),
Builder.CreateBitCast(RI.PrivateVariable, Builder.getPtrTy(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One leftover bitcast here.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@topperc topperc merged commit aba0401 into llvm:main Nov 22, 2023
@topperc topperc deleted the pr/getint8ptrty branch November 22, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6 participants