Skip to content

Commit d8b8aa3

Browse files
committed
[llvm] Replace calls to Type::getPointerTo (NFC)
Cleanup work towards removing the method Type::getPointerTo. If a call to Type::getPointerTo is used solely to support an unneeded pointer-cast, remove the call entirely.
1 parent 7eccd52 commit d8b8aa3

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ bool IRTranslator::emitJumpTableHeader(SwitchCG::JumpTable &JT,
791791

792792
// This value may be smaller or larger than the target's pointer type, and
793793
// therefore require extension or truncating.
794-
Type *PtrIRTy = SValue.getType()->getPointerTo();
794+
auto *PtrIRTy = PointerType::getUnqual(SValue.getContext());
795795
const LLT PtrScalarTy = LLT::scalar(DL->getTypeSizeInBits(PtrIRTy));
796796
Sub = MIB.buildZExtOrTrunc(PtrScalarTy, Sub);
797797

llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,13 +1215,9 @@ bool InterleavedLoadCombineImpl::combine(std::list<VectorInfo> &InterleavedLoad,
12151215
return false;
12161216
}
12171217

1218-
// Create a pointer cast for the wide load.
1219-
auto CI = Builder.CreatePointerCast(InsertionPoint->getOperand(0),
1220-
ILTy->getPointerTo(),
1221-
"interleaved.wide.ptrcast");
1222-
12231218
// Create the wide load and update the MemorySSA.
1224-
auto LI = Builder.CreateAlignedLoad(ILTy, CI, InsertionPoint->getAlign(),
1219+
auto Ptr = InsertionPoint->getPointerOperand();
1220+
auto LI = Builder.CreateAlignedLoad(ILTy, Ptr, InsertionPoint->getAlign(),
12251221
"interleaved.wide.load");
12261222
auto MSSAU = MemorySSAUpdater(&MSSA);
12271223
MemoryUse *MSSALoad = cast<MemoryUse>(MSSAU.createMemoryAccessBefore(

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4836,7 +4836,7 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
48364836

48374837
// Also pass the address of the overflow check.
48384838
Entry.Node = Temp;
4839-
Entry.Ty = PtrTy->getPointerTo();
4839+
Entry.Ty = PointerType::getUnqual(PtrTy->getContext());
48404840
Entry.IsSExt = true;
48414841
Entry.IsZExt = false;
48424842
Args.push_back(Entry);

llvm/lib/CodeGen/TargetLoweringBase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,9 +1941,9 @@ TargetLoweringBase::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
19411941
// Android provides a libc function to retrieve the address of the current
19421942
// thread's unsafe stack pointer.
19431943
Module *M = IRB.GetInsertBlock()->getParent()->getParent();
1944-
Type *StackPtrTy = PointerType::getUnqual(M->getContext());
1945-
FunctionCallee Fn = M->getOrInsertFunction("__safestack_pointer_address",
1946-
StackPtrTy->getPointerTo(0));
1944+
auto *PtrTy = PointerType::getUnqual(M->getContext());
1945+
FunctionCallee Fn =
1946+
M->getOrInsertFunction("__safestack_pointer_address", PtrTy);
19471947
return IRB.CreateCall(Fn);
19481948
}
19491949

0 commit comments

Comments
 (0)