Skip to content

Commit 4346aaf

Browse files
committed
[llvm] Remove uses of Type::getPointerTo() (NFC)
* Remove if its sole use is to support an unnecessary ptr-to-ptr bitcast (remove the bitcast as well) * Replace with use of other APIs. NFC opaque pointer cleanup effort.
1 parent f71ad19 commit 4346aaf

File tree

6 files changed

+6
-13
lines changed

6 files changed

+6
-13
lines changed

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5152,7 +5152,7 @@ void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
51525152
// Save llvm.compiler.used and remove it.
51535153
SmallVector<Constant *, 2> UsedArray;
51545154
SmallVector<GlobalValue *, 4> UsedGlobals;
5155-
Type *UsedElementType = Type::getInt8Ty(M.getContext())->getPointerTo(0);
5155+
Type *UsedElementType = Type::getInt8PtrTy(M.getContext());
51565156
GlobalVariable *Used = collectUsedGlobalVariables(M, UsedGlobals, true);
51575157
for (auto *GV : UsedGlobals) {
51585158
if (GV->getName() != "llvm.embedded.module" &&

llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ bool AMDGPUOpenCLEnqueuedBlockLowering::runOnModule(Module &M) {
9393
if (!HandleTy) {
9494
Type *Int32 = Type::getInt32Ty(C);
9595
HandleTy = StructType::create(
96-
C, {Type::getInt8Ty(C)->getPointerTo(0), Int32, Int32},
96+
C, {Type::getInt8PtrTy(C), Int32, Int32},
9797
"block.runtime.handle.t");
9898
}
9999

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9875,7 +9875,7 @@ SDValue ARMTargetLowering::LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const {
98759875

98769876
ArgListEntry Entry;
98779877
Entry.Node = SRet;
9878-
Entry.Ty = RetTy->getPointerTo();
9878+
Entry.Ty = PointerType::getUnqual(RetTy->getContext());
98799879
Entry.IsSExt = false;
98809880
Entry.IsZExt = false;
98819881
Entry.IsSRet = true;
@@ -21632,13 +21632,6 @@ bool ARMTargetLowering::lowerInterleavedLoad(
2163221632
// to something legal.
2163321633
VecTy = FixedVectorType::get(VecTy->getElementType(),
2163421634
VecTy->getNumElements() / NumLoads);
21635-
21636-
// We will compute the pointer operand of each load from the original base
21637-
// address using GEPs. Cast the base address to a pointer to the scalar
21638-
// element type.
21639-
BaseAddr = Builder.CreateBitCast(
21640-
BaseAddr,
21641-
VecTy->getElementType()->getPointerTo(LI->getPointerAddressSpace()));
2164221635
}
2164321636

2164421637
assert(isTypeLegal(EVT::getEVT(VecTy)) && "Illegal vldN vector type!");

llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ Value *CoroCloner::deriveNewFramePointer() {
875875
case coro::ABI::Retcon:
876876
case coro::ABI::RetconOnce: {
877877
Argument *NewStorage = &*NewF->arg_begin();
878-
auto FramePtrTy = Shape.FrameTy->getPointerTo();
878+
auto FramePtrTy = PointerType::getUnqual(Shape.FrameTy->getContext());
879879

880880
// If the storage is inline, just bitcast to the storage to the frame type.
881881
if (Shape.RetconLowering.IsFrameInlineInStorage)

llvm/lib/Transforms/IPO/IROutliner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ findExtractedOutputToOverallOutputMapping(Module &M, OutlinableRegion &Region,
13461346
// the output, so we add a pointer type to the argument types of the overall
13471347
// function to handle this output and create a mapping to it.
13481348
if (!TypeFound) {
1349-
Group.ArgumentTypes.push_back(Output->getType()->getPointerTo(
1349+
Group.ArgumentTypes.push_back(PointerType::get(Output->getContext(),
13501350
M.getDataLayout().getAllocaAddrSpace()));
13511351
// Mark the new pointer type as the last value in the aggregate argument
13521352
// list.

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3037,7 +3037,7 @@ void FunctionStackPoisoner::copyToShadowInline(ArrayRef<uint8_t> ShadowMask,
30373037
Value *Ptr = IRB.CreateAdd(ShadowBase, ConstantInt::get(IntptrTy, i));
30383038
Value *Poison = IRB.getIntN(StoreSizeInBytes * 8, Val);
30393039
IRB.CreateAlignedStore(
3040-
Poison, IRB.CreateIntToPtr(Ptr, Poison->getType()->getPointerTo()),
3040+
Poison, IRB.CreateIntToPtr(Ptr, PointerType::getUnqual(Poison->getContext())),
30413041
Align(1));
30423042

30433043
i += StoreSizeInBytes;

0 commit comments

Comments
 (0)