@@ -450,7 +450,6 @@ CallInst *SPIRVEmitIntrinsics::buildSpvPtrcast(Function *F, Value *Op,
450
450
}
451
451
452
452
void SPIRVEmitIntrinsics::propagateElemType (Value *Op, Type *ElemTy) {
453
- // CallInst *PtrCasted = buildSpvPtrcast(Op, ElemTy);
454
453
SmallVector<User *> Users (Op->users ());
455
454
for (auto *U : Users) {
456
455
if (!isa<Instruction>(U))
@@ -1095,8 +1094,9 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
1095
1094
{B.getInt32 (getPointerAddressSpace (OpTy))}, B);
1096
1095
GR->addAssignPtrTypeInstr (Op, CI);
1097
1096
} else {
1097
+ Type *PrevElemTy = GR->findDeducedElementType (Op);
1098
1098
updateAssignType (AssignCI, Op, OpTyVal);
1099
- propagateElemTypeRec (Op, KnownElemTy, GR-> findDeducedElementType (Op) );
1099
+ propagateElemTypeRec (Op, KnownElemTy, PrevElemTy );
1100
1100
}
1101
1101
} else {
1102
1102
eraseTodoType (Op);
@@ -1412,10 +1412,13 @@ void SPIRVEmitIntrinsics::replacePointerOperandWithPtrCast(
1412
1412
if (mayUpdateOpType (Pointer)) {
1413
1413
// If this wouldn't be the first spv_ptrcast but existing type info is
1414
1414
// uncomplete, update spv_assign_ptr_type arguments.
1415
- if (CallInst *AssignCI = GR->findAssignPtrTypeInstr (Pointer))
1415
+ if (CallInst *AssignCI = GR->findAssignPtrTypeInstr (Pointer)) {
1416
+ Type *PrevElemTy = GR->findDeducedElementType (Pointer);
1416
1417
updateAssignType (AssignCI, Pointer, ExpectedElementVal);
1417
- else
1418
+ propagateElemTypeRec (Pointer, ExpectedElementType, PrevElemTy);
1419
+ } else {
1418
1420
buildAssignPtr (B, ExpectedElementType, Pointer);
1421
+ }
1419
1422
return ;
1420
1423
}
1421
1424
}
@@ -1428,6 +1431,7 @@ void SPIRVEmitIntrinsics::replacePointerOperandWithPtrCast(
1428
1431
I->setOperand (OperandToReplace, PtrCastI);
1429
1432
// We need to set up a pointee type for the newly created spv_ptrcast.
1430
1433
buildAssignPtr (B, ExpectedElementType, PtrCastI);
1434
+ // propagateElemType(Pointer, ExpectedElementType);
1431
1435
}
1432
1436
1433
1437
void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr (Instruction *I,
0 commit comments