@@ -1961,10 +1961,16 @@ void SPIRVEmitIntrinsics::insertAssignTypeIntrs(Instruction *I,
1961
1961
GR->buildAssignPtr (B, ElemTy ? ElemTy : deduceElementType (Op, true ),
1962
1962
Op);
1963
1963
} else {
1964
+ Value *OpTyVal = Op;
1965
+ if (OpTy->isTargetExtTy ()) {
1966
+ // We need to do this in order to be consistent with how target ext
1967
+ // types are handled in `processInstrAfterVisit`
1968
+ OpTyVal = getNormalizedPoisonValue (OpTy);
1969
+ }
1964
1970
CallInst *AssignCI =
1965
1971
buildIntrWithMD (Intrinsic::spv_assign_type, {OpTy},
1966
- getNormalizedPoisonValue (OpTy), Op , {}, B);
1967
- GR->addAssignPtrTypeInstr (Op , AssignCI);
1972
+ getNormalizedPoisonValue (OpTy), OpTyVal , {}, B);
1973
+ GR->addAssignPtrTypeInstr (OpTyVal , AssignCI);
1968
1974
}
1969
1975
}
1970
1976
}
@@ -2075,22 +2081,14 @@ void SPIRVEmitIntrinsics::processInstrAfterVisit(Instruction *I,
2075
2081
BPrepared = true ;
2076
2082
}
2077
2083
Type *OpTy = Op->getType ();
2078
- Value *OpTyVal = Op;
2079
- if (OpTy->isTargetExtTy ())
2080
- OpTyVal = getNormalizedPoisonValue (OpTy);
2081
2084
Type *OpElemTy = GR->findDeducedElementType (Op);
2082
2085
Value *NewOp = Op;
2083
2086
if (OpTy->isTargetExtTy ()) {
2087
+ // Since this value is replaced by poison, we need to do the same in
2088
+ // `insertAssignTypeIntrs`.
2089
+ Value *OpTyVal = getNormalizedPoisonValue (OpTy);
2084
2090
NewOp = buildIntrWithMD (Intrinsic::spv_track_constant,
2085
2091
{OpTy, OpTyVal->getType ()}, Op, OpTyVal, {}, B);
2086
- if (isPointerTy (OpTy)) {
2087
- if (OpElemTy) {
2088
- GR->buildAssignPtr (B, OpElemTy, NewOp);
2089
- } else {
2090
- insertTodoType (NewOp);
2091
- GR->buildAssignPtr (B, OpTy, NewOp);
2092
- }
2093
- }
2094
2092
}
2095
2093
if (!IsConstComposite && isPointerTy (OpTy) && OpElemTy != nullptr &&
2096
2094
OpElemTy != IntegerType::getInt8Ty (I->getContext ())) {
0 commit comments