Skip to content

Commit ef81cee

Browse files
committed
Merge from 'main' to 'sycl-web' (1 commits)
CONFLICT (content): Merge conflict in llvm/lib/Transforms/Scalar/SROA.cpp
2 parents 172b021 + 2cb3935 commit ef81cee

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,6 @@ static void speculateSelectInstLoads(SelectInst &SI, LoadInst &LI,
15111511
IRBuilderTy &IRB) {
15121512
LLVM_DEBUG(dbgs() << " original load: " << SI << "\n");
15131513

1514-
IRB.SetInsertPoint(&SI);
15151514
Value *TV = SI.getTrueValue();
15161515
Value *FV = SI.getFalseValue();
15171516
// Replace the given load of the select with a select of two loads.
@@ -1525,6 +1524,13 @@ static void speculateSelectInstLoads(SelectInst &SI, LoadInst &LI,
15251524
TV = IRB.CreateBitCast(TV, LoadPtrType);
15261525
if (LoadPtrType != FV->getType())
15271526
FV = IRB.CreateBitCast(FV, LoadPtrType);
1527+
1528+
if (auto *TypedPtrTy = LI.getPointerOperandType();
1529+
!TypedPtrTy->isOpaquePointerTy() && SI.getType() != TypedPtrTy) {
1530+
TV = IRB.CreateBitOrPointerCast(TV, TypedPtrTy, "");
1531+
FV = IRB.CreateBitOrPointerCast(FV, TypedPtrTy, "");
1532+
}
1533+
15281534
LoadInst *TL =
15291535
IRB.CreateAlignedLoad(LI.getType(), TV, LI.getAlign(),
15301536
LI.getName() + ".sroa.speculate.load.true");

0 commit comments

Comments
 (0)