Skip to content

Commit c419f3e

Browse files
committed
[llvm][SROA] Replace calls to Type::getPointerTo (NFC)
NFC cleanup towards removing method Type::getPointerTo. * Remove unnecessary call to Type::getPointerTo * Replace call to Type::getPointerTo with IRB.getPtrTy
1 parent 6c462fe commit c419f3e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,7 +2879,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
28792879
"endian_shift");
28802880
}
28812881
} else {
2882-
Type *LTy = TargetTy->getPointerTo(AS);
2882+
Type *LTy = IRB.getPtrTy(AS);
28832883
LoadInst *NewLI =
28842884
IRB.CreateAlignedLoad(TargetTy, getNewAllocaSlicePtr(IRB, LTy),
28852885
getSliceAlign(), LI.isVolatile(), LI.getName());
@@ -2909,9 +2909,9 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
29092909
// basis for the new value. This allows us to replace the uses of LI with
29102910
// the computed value, and then replace the placeholder with LI, leaving
29112911
// LI only used for this computation.
2912-
Value *Placeholder = new LoadInst(
2913-
LI.getType(), PoisonValue::get(LI.getType()->getPointerTo(AS)), "",
2914-
false, Align(1));
2912+
Value *Placeholder =
2913+
new LoadInst(LI.getType(), PoisonValue::get(IRB.getPtrTy(AS)), "",
2914+
false, Align(1));
29152915
V = insertInteger(DL, IRB, Placeholder, V, NewBeginOffset - BeginOffset,
29162916
"insert");
29172917
LI.replaceAllUsesWith(V);
@@ -3034,7 +3034,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
30343034
IRB.CreateAlignedStore(V, NewPtr, NewAI.getAlign(), SI.isVolatile());
30353035
} else {
30363036
unsigned AS = SI.getPointerAddressSpace();
3037-
Value *NewPtr = getNewAllocaSlicePtr(IRB, V->getType()->getPointerTo(AS));
3037+
Value *NewPtr = getNewAllocaSlicePtr(IRB, IRB.getPtrTy(AS));
30383038
NewSI =
30393039
IRB.CreateAlignedStore(V, NewPtr, getSliceAlign(), SI.isVolatile());
30403040
}
@@ -3389,7 +3389,6 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
33893389
} else {
33903390
OtherTy = NewAllocaTy;
33913391
}
3392-
OtherPtrTy = OtherTy->getPointerTo(OtherAS);
33933392

33943393
Value *AdjPtr = getAdjustedPtr(IRB, DL, OtherPtr, OtherOffset, OtherPtrTy,
33953394
OtherPtr->getName() + ".");

0 commit comments

Comments
 (0)