Skip to content

Commit 7f48a48

Browse files
fix types propagation after update
1 parent 1275cad commit 7f48a48

File tree

4 files changed

+983
-7
lines changed

4 files changed

+983
-7
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,7 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
11231123
Value *OpTyVal = PoisonValue::get(KnownElemTy);
11241124
Type *OpTy = Op->getType();
11251125
if (!Ty || AskTy || isUntypedPointerTy(Ty) || isTodoType(Op)) {
1126+
Type *PrevElemTy = GR->findDeducedElementType(Op);
11261127
GR->addDeducedElementType(Op, KnownElemTy);
11271128
// check if KnownElemTy is complete
11281129
if (!Uncomplete)
@@ -1139,7 +1140,6 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
11391140
{B.getInt32(getPointerAddressSpace(OpTy))}, B);
11401141
GR->addAssignPtrTypeInstr(Op, CI);
11411142
} else {
1142-
Type *PrevElemTy = GR->findDeducedElementType(Op);
11431143
updateAssignType(AssignCI, Op, OpTyVal);
11441144
DenseSet<std::pair<Value *, Value *>> VisitedSubst{
11451145
std::make_pair(I, Op)};
@@ -2249,12 +2249,15 @@ bool SPIRVEmitIntrinsics::postprocessTypes(Module &M) {
22492249
if (Type *ElemTy = deduceElementTypeHelper(Op, Visited, false, true)) {
22502250
if (ElemTy != KnownTy) {
22512251
DenseSet<std::pair<Value *, Value *>> VisitedSubst;
2252+
propagateElemType(CI, ElemTy, VisitedSubst);
2253+
/*
22522254
if (isa<CallInst>(Op)) {
22532255
propagateElemType(CI, ElemTy, VisitedSubst);
22542256
} else {
22552257
updateAssignType(AssignCI, CI, PoisonValue::get(ElemTy));
22562258
propagateElemTypeRec(CI, ElemTy, KnownTy, VisitedSubst);
22572259
}
2260+
*/
22582261
eraseTodoType(Op);
22592262
continue;
22602263
}

llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_function_pointers/fp_two_calls.ll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
; CHECK-DAG: %[[TyPtrInt8:.*]] = OpTypePointer Function %[[TyInt8]]
1818
; CHECK-DAG: %[[TyUncompleteFp:.*]] = OpTypeFunction %[[TyFloat32]] %[[TyPtrInt8]]
1919
; CHECK-DAG: %[[TyPtrUncompleteFp:.*]] = OpTypePointer Function %[[TyUncompleteFp]]
20-
; CHECK-DAG: %[[TyUncompleteBar:.*]] = OpTypeFunction %[[TyInt64]] %[[TyPtrUncompleteFp]] %[[TyPtrInt8]]
21-
; CHECK-DAG: %[[TyPtrUncompleteBar:.*]] = OpTypePointer Function %[[TyUncompleteBar]]
22-
; CHECK-DAG: %[[TyFp:.*]] = OpTypeFunction %[[TyFloat32]] %[[TyPtrUncompleteBar]]
23-
; CHECK-DAG: %[[TyPtrFp:.*]] = OpTypePointer Function %[[TyFp]]
24-
; CHECK-DAG: %[[TyBar:.*]] = OpTypeFunction %[[TyInt64]] %[[TyPtrFp]] %[[TyPtrInt8]]
20+
; CHECK-DAG: %[[TyBar:.*]] = OpTypeFunction %[[TyInt64]] %[[TyPtrUncompleteFp]] %[[TyPtrInt8]]
2521
; CHECK-DAG: %[[TyPtrBar:.*]] = OpTypePointer Function %[[TyBar]]
22+
; CHECK-DAG: %[[TyFp:.*]] = OpTypeFunction %[[TyFloat32]] %[[TyPtrBar]]
23+
; CHECK-DAG: %[[TyPtrFp:.*]] = OpTypePointer Function %[[TyFp]]
2624
; CHECK-DAG: %[[TyTest:.*]] = OpTypeFunction %[[TyVoid]] %[[TyPtrFp]] %[[TyPtrInt8]] %[[TyPtrBar]]
2725
; CHECK: %[[test]] = OpFunction %[[TyVoid]] None %[[TyTest]]
2826
; CHECK: %[[fp]] = OpFunctionParameter %[[TyPtrFp]]

llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_subgroups/cl_intel_sub_groups.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737

3838
; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
3939

40-
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_subgroups %s -o - | FileCheck %s
40+
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_subgroups %s -o - | FileCheck %s
41+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_subgroups %s -o - -filetype=obj | spirv-val %}
4142

4243
; CHECK-ERROR: LLVM ERROR: intel_sub_group_shuffle: the builtin requires the following SPIR-V extension: SPV_INTEL_subgroups
4344

0 commit comments

Comments
 (0)