-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm] Replace uses of Type::getPointerTo() (NFC) #110163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace uses of `Type::getPointerTo()` which is to be removed.
@llvm/pr-subscribers-llvm-globalisel @llvm/pr-subscribers-llvm-transforms Author: Youngsuk Kim (JOE1994) ChangesReplace uses of Full diff: https://github.com/llvm/llvm-project/pull/110163.diff 5 Files Affected:
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 513914d3218fbc..9f9a1bb89103f4 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -1034,7 +1034,8 @@ void CallLowering::insertSRetStores(MachineIRBuilder &MIRBuilder, Type *RetTy,
unsigned NumValues = SplitVTs.size();
Align BaseAlign = DL.getPrefTypeAlign(RetTy);
unsigned AS = DL.getAllocaAddrSpace();
- LLT OffsetLLTy = getLLTForType(*DL.getIndexType(RetTy->getPointerTo(AS)), DL);
+ LLT OffsetLLTy = getLLTForType(
+ *DL.getIndexType(PointerType::get(RetTy->getContext(), AS)), DL);
MachinePointerInfo PtrInfo(AS);
diff --git a/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp b/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp
index 2b78ed7134c92f..660e00b893c885 100644
--- a/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp
+++ b/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp
@@ -440,7 +440,7 @@ static Value *aspaceWrapValue(DenseMap<Value *, Value *> &Cache, Function *F,
auto *GEPTy = cast<PointerType>(GEP->getType());
auto *NewGEP = GEP->clone();
NewGEP->insertAfter(GEP);
- NewGEP->mutateType(GEPTy->getPointerTo(0));
+ NewGEP->mutateType(PointerType::getUnqual(GEPTy->getContext()));
NewGEP->setOperand(GEP->getPointerOperandIndex(), WrappedPtr);
NewGEP->setName(GEP->getName());
Cache[ToWrap] = NewGEP;
@@ -452,8 +452,7 @@ static Value *aspaceWrapValue(DenseMap<Value *, Value *> &Cache, Function *F,
IB.SetInsertPoint(*InsnPtr->getInsertionPointAfterDef());
else
IB.SetInsertPoint(F->getEntryBlock().getFirstInsertionPt());
- auto *PtrTy = cast<PointerType>(ToWrap->getType());
- auto *ASZeroPtrTy = PtrTy->getPointerTo(0);
+ auto *ASZeroPtrTy = IB.getPtrTy(0);
auto *ACast = IB.CreateAddrSpaceCast(ToWrap, ASZeroPtrTy, ToWrap->getName());
Cache[ToWrap] = ACast;
return ACast;
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index 0742b259c489c0..519a4e9314a26b 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1658,8 +1658,8 @@ void LowerTypeTestsModule::buildBitSetsFromFunctionsNative(
".cfi.jumptable", &M);
ArrayType *JumpTableType =
ArrayType::get(getJumpTableEntryType(), Functions.size());
- auto JumpTable =
- ConstantExpr::getPointerCast(JumpTableFn, JumpTableType->getPointerTo(0));
+ auto JumpTable = ConstantExpr::getPointerCast(
+ JumpTableFn, PointerType::getUnqual(M.getContext()));
lowerTypeTestCalls(TypeIds, JumpTable, GlobalLayout);
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 28da864cad0ffc..35664a5c7a2ac2 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -3536,8 +3536,8 @@ struct AAHeapToSharedFunction : public AAHeapToShared {
PoisonValue::get(Int8ArrTy), CB->getName() + "_shared", nullptr,
GlobalValue::NotThreadLocal,
static_cast<unsigned>(AddressSpace::Shared));
- auto *NewBuffer =
- ConstantExpr::getPointerCast(SharedMem, Int8Ty->getPointerTo());
+ auto *NewBuffer = ConstantExpr::getPointerCast(
+ SharedMem, PointerType::getUnqual(M->getContext()));
auto Remark = [&](OptimizationRemark OR) {
return OR << "Replaced globalized variable with "
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 18116b5701fe19..2f0ba5510b8f34 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1743,7 +1743,7 @@ void VPVectorPointerRecipe ::execute(VPTransformState &State) {
// or query DataLayout for a more suitable index type otherwise.
const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
Type *IndexTy = State.VF.isScalable() && (IsReverse || CurrentPart > 0)
- ? DL.getIndexType(IndexedTy->getPointerTo())
+ ? DL.getIndexType(Builder.getPtrTy(0))
: Builder.getInt32Ty();
Value *Ptr = State.get(getOperand(0), VPLane(0));
bool InBounds = isInBounds();
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
apply nikic's feedback Co-authored-by: Nikita Popov <[email protected]>
✅ With the latest revision this PR passed the C/C++ code formatter. |
Replace uses of `Type::getPointerTo()` which is to be removed. --------- Co-authored-by: Nikita Popov <[email protected]>
Replace uses of
Type::getPointerTo()
which is to be removed.