Skip to content

Commit e177dd6

Browse files
JOE1994nikic
andauthored
[llvm] Replace uses of Type::getPointerTo() (NFC) (#110163)
Replace uses of `Type::getPointerTo()` which is to be removed. --------- Co-authored-by: Nikita Popov <[email protected]>
1 parent c6876b4 commit e177dd6

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

llvm/lib/CodeGen/GlobalISel/CallLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ void CallLowering::insertSRetStores(MachineIRBuilder &MIRBuilder, Type *RetTy,
10341034
unsigned NumValues = SplitVTs.size();
10351035
Align BaseAlign = DL.getPrefTypeAlign(RetTy);
10361036
unsigned AS = DL.getAllocaAddrSpace();
1037-
LLT OffsetLLTy = getLLTForType(*DL.getIndexType(RetTy->getPointerTo(AS)), DL);
1037+
LLT OffsetLLTy = getLLTForType(*DL.getIndexType(RetTy->getContext(), AS), DL);
10381038

10391039
MachinePointerInfo PtrInfo(AS);
10401040

llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static Value *aspaceWrapValue(DenseMap<Value *, Value *> &Cache, Function *F,
440440
auto *GEPTy = cast<PointerType>(GEP->getType());
441441
auto *NewGEP = GEP->clone();
442442
NewGEP->insertAfter(GEP);
443-
NewGEP->mutateType(GEPTy->getPointerTo(0));
443+
NewGEP->mutateType(PointerType::getUnqual(GEPTy->getContext()));
444444
NewGEP->setOperand(GEP->getPointerOperandIndex(), WrappedPtr);
445445
NewGEP->setName(GEP->getName());
446446
Cache[ToWrap] = NewGEP;
@@ -452,8 +452,7 @@ static Value *aspaceWrapValue(DenseMap<Value *, Value *> &Cache, Function *F,
452452
IB.SetInsertPoint(*InsnPtr->getInsertionPointAfterDef());
453453
else
454454
IB.SetInsertPoint(F->getEntryBlock().getFirstInsertionPt());
455-
auto *PtrTy = cast<PointerType>(ToWrap->getType());
456-
auto *ASZeroPtrTy = PtrTy->getPointerTo(0);
455+
auto *ASZeroPtrTy = IB.getPtrTy(0);
457456
auto *ACast = IB.CreateAddrSpaceCast(ToWrap, ASZeroPtrTy, ToWrap->getName());
458457
Cache[ToWrap] = ACast;
459458
return ACast;

llvm/lib/Transforms/IPO/LowerTypeTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,8 +1658,8 @@ void LowerTypeTestsModule::buildBitSetsFromFunctionsNative(
16581658
".cfi.jumptable", &M);
16591659
ArrayType *JumpTableType =
16601660
ArrayType::get(getJumpTableEntryType(), Functions.size());
1661-
auto JumpTable =
1662-
ConstantExpr::getPointerCast(JumpTableFn, JumpTableType->getPointerTo(0));
1661+
auto JumpTable = ConstantExpr::getPointerCast(
1662+
JumpTableFn, PointerType::getUnqual(M.getContext()));
16631663

16641664
lowerTypeTestCalls(TypeIds, JumpTable, GlobalLayout);
16651665

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3536,8 +3536,8 @@ struct AAHeapToSharedFunction : public AAHeapToShared {
35363536
PoisonValue::get(Int8ArrTy), CB->getName() + "_shared", nullptr,
35373537
GlobalValue::NotThreadLocal,
35383538
static_cast<unsigned>(AddressSpace::Shared));
3539-
auto *NewBuffer =
3540-
ConstantExpr::getPointerCast(SharedMem, Int8Ty->getPointerTo());
3539+
auto *NewBuffer = ConstantExpr::getPointerCast(
3540+
SharedMem, PointerType::getUnqual(M->getContext()));
35413541

35423542
auto Remark = [&](OptimizationRemark OR) {
35433543
return OR << "Replaced globalized variable with "

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ void VPVectorPointerRecipe ::execute(VPTransformState &State) {
17431743
// or query DataLayout for a more suitable index type otherwise.
17441744
const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
17451745
Type *IndexTy = State.VF.isScalable() && (IsReverse || CurrentPart > 0)
1746-
? DL.getIndexType(IndexedTy->getPointerTo())
1746+
? DL.getIndexType(Builder.getPtrTy(0))
17471747
: Builder.getInt32Ty();
17481748
Value *Ptr = State.get(getOperand(0), VPLane(0));
17491749
bool InBounds = isInBounds();

0 commit comments

Comments
 (0)