Skip to content

Commit 9f27f45

Browse files
committed
[NFC][SROA] speculateSelectInstLoads(): play nice with typed pointers for now
As requested in https://reviews.llvm.org/D138238#inline-1356685
1 parent 1cbcd8a commit 9f27f45

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,14 @@ static void speculateSelectInstLoads(SelectInst &SI, LoadInst &LI,
15181518

15191519
assert(LI.isSimple() && "We only speculate simple loads");
15201520

1521+
if (auto *TypedPtrTy = LI.getType()->getPointerTo();
1522+
SI.getType() != TypedPtrTy) {
1523+
TV = BitCastInst::CreatePointerBitCastOrAddrSpaceCast(TV, TypedPtrTy, "",
1524+
&LI);
1525+
FV = BitCastInst::CreatePointerBitCastOrAddrSpaceCast(FV, TypedPtrTy, "",
1526+
&LI);
1527+
}
1528+
15211529
IRB.SetInsertPoint(&LI);
15221530
LoadInst *TL =
15231531
IRB.CreateAlignedLoad(LI.getType(), TV, LI.getAlign(),

0 commit comments

Comments
 (0)