Skip to content

Commit 3bac4c0

Browse files
clin111Fznamznon
authored andcommitted
Fix commit 4f7e5d2 for typed pointers
1 parent 8707d15 commit 3bac4c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,12 @@ static void speculateSelectInstLoads(SelectInst &SI, LoadInst &LI,
15311531
assert(LI.isSimple() && "We only speculate simple loads");
15321532

15331533
IRB.SetInsertPoint(&LI);
1534+
// Fix for typed pointers
1535+
auto *LoadPtrType = LI.getPointerOperandType();
1536+
if (LoadPtrType != TV->getType())
1537+
TV = IRB.CreateBitCast(TV, LoadPtrType);
1538+
if (LoadPtrType != FV->getType())
1539+
FV = IRB.CreateBitCast(FV, LoadPtrType);
15341540
LoadInst *TL =
15351541
IRB.CreateAlignedLoad(LI.getType(), TV, LI.getAlign(),
15361542
LI.getName() + ".sroa.speculate.load.true");

0 commit comments

Comments
 (0)