Skip to content

Commit 81ee059

Browse files
committed
[llvm] Replace uses of Type::getPointerTo (NFC)
opaque pointer clean-up effort (NFC)
1 parent ca611af commit 81ee059

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

llvm/lib/ExecutionEngine/Orc/Speculation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void IRSpeculationLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
6767
auto SpeculatorVTy = StructType::create(MContext, "Class.Speculator");
6868
auto RuntimeCallTy = FunctionType::get(
6969
Type::getVoidTy(MContext),
70-
{SpeculatorVTy->getPointerTo(), Type::getInt64Ty(MContext)}, false);
70+
{PointerType::getUnqual(MContext), Type::getInt64Ty(MContext)}, false);
7171
auto RuntimeCall =
7272
Function::Create(RuntimeCallTy, Function::LinkageTypes::ExternalLinkage,
7373
"__orc_speculate_for", &M);

llvm/lib/IR/Constants.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,7 @@ Constant *ConstantExpr::getAlignOf(Type* Ty) {
23672367
// alignof is implemented as: (i64) gep ({i1,Ty}*)null, 0, 1
23682368
// Note that a non-inbounds gep is used, as null isn't within any object.
23692369
Type *AligningTy = StructType::get(Type::getInt1Ty(Ty->getContext()), Ty);
2370-
Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo(0));
2370+
Constant *NullPtr = Constant::getNullValue(PointerType::getUnqual(AligningTy->getContext()));
23712371
Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0);
23722372
Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
23732373
Constant *Indices[2] = { Zero, One };

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,10 +1292,7 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape,
12921292
std::optional<FieldIDType> SwitchIndexFieldId;
12931293

12941294
if (Shape.ABI == coro::ABI::Switch) {
1295-
auto *FramePtrTy = FrameTy->getPointerTo();
1296-
auto *FnTy = FunctionType::get(Type::getVoidTy(C), FramePtrTy,
1297-
/*IsVarArg=*/false);
1298-
auto *FnPtrTy = FnTy->getPointerTo();
1295+
auto *FnPtrTy = PointerType::getUnqual(C);
12991296

13001297
// Add header fields for the resume and destroy functions.
13011298
// We can rely on these being perfectly packed.
@@ -2487,7 +2484,7 @@ static Value *emitGetSwiftErrorValue(IRBuilder<> &Builder, Type *ValueTy,
24872484
coro::Shape &Shape) {
24882485
// Make a fake function pointer as a sort of intrinsic.
24892486
auto FnTy = FunctionType::get(ValueTy, {}, false);
2490-
auto Fn = ConstantPointerNull::get(FnTy->getPointerTo());
2487+
auto Fn = ConstantPointerNull::get(Builder.getPtrTy());
24912488

24922489
auto Call = Builder.CreateCall(FnTy, Fn, {});
24932490
Shape.SwiftErrorOps.push_back(Call);
@@ -2501,9 +2498,9 @@ static Value *emitGetSwiftErrorValue(IRBuilder<> &Builder, Type *ValueTy,
25012498
static Value *emitSetSwiftErrorValue(IRBuilder<> &Builder, Value *V,
25022499
coro::Shape &Shape) {
25032500
// Make a fake function pointer as a sort of intrinsic.
2504-
auto FnTy = FunctionType::get(V->getType()->getPointerTo(),
2501+
auto FnTy = FunctionType::get(Builder.getPtrTy(),
25052502
{V->getType()}, false);
2506-
auto Fn = ConstantPointerNull::get(FnTy->getPointerTo());
2503+
auto Fn = ConstantPointerNull::get(Builder.getPtrTy());
25072504

25082505
auto Call = Builder.CreateCall(FnTy, Fn, { V });
25092506
Shape.SwiftErrorOps.push_back(Call);

llvm/unittests/Analysis/ScalarEvolutionTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ TEST_F(ScalarEvolutionsTest, CompareSCEVComplexity) {
352352

353353
TEST_F(ScalarEvolutionsTest, CompareValueComplexity) {
354354
IntegerType *IntPtrTy = M.getDataLayout().getIntPtrType(Context);
355-
PointerType *IntPtrPtrTy = IntPtrTy->getPointerTo();
355+
PointerType *IntPtrPtrTy = PointerType::getUnqual(Context);
356356

357357
FunctionType *FTy =
358358
FunctionType::get(Type::getVoidTy(Context), {IntPtrTy, IntPtrTy}, false);

llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,8 +3070,8 @@ TEST_F(OpenMPIRBuilderTest, CopyinBlocks) {
30703070
OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
30713071

30723072
IntegerType *Int32 = Type::getInt32Ty(M->getContext());
3073-
AllocaInst *MasterAddress = Builder.CreateAlloca(Int32->getPointerTo());
3074-
AllocaInst *PrivAddress = Builder.CreateAlloca(Int32->getPointerTo());
3073+
AllocaInst *MasterAddress = Builder.CreateAlloca(Builder.getPtrTy());
3074+
AllocaInst *PrivAddress = Builder.CreateAlloca(Builder.getPtrTy());
30753075

30763076
BasicBlock *EntryBB = BB;
30773077

llvm/unittests/IR/AsmWriterTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ TEST(AsmWriterTest, PrintNullOperandBundle) {
8787
LLVMContext C;
8888
Type *Int32Ty = Type::getInt32Ty(C);
8989
FunctionType *FnTy = FunctionType::get(Int32Ty, Int32Ty, /*isVarArg=*/false);
90-
Value *Callee = Constant::getNullValue(FnTy->getPointerTo());
90+
Value *Callee = Constant::getNullValue(PointerType::getUnqual(C));
9191
Value *Args[] = {ConstantInt::get(Int32Ty, 42)};
9292
std::unique_ptr<BasicBlock> NormalDest(BasicBlock::Create(C));
9393
std::unique_ptr<BasicBlock> UnwindDest(BasicBlock::Create(C));

llvm/unittests/IR/IRBuilderTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ TEST_F(IRBuilderTest, IntrinsicsWithScalableVectors) {
190190
// LLVMScalarOrSameVectorWidth.
191191

192192
Type *VecTy = VectorType::get(Builder.getInt32Ty(), 4, true);
193-
Type *PtrToVecTy = VecTy->getPointerTo();
193+
Type *PtrToVecTy = Builder.getPtrTy();
194194
PredTy = VectorType::get(Builder.getInt1Ty(), 4, true);
195195

196196
ArgTys.clear();

0 commit comments

Comments
 (0)