Skip to content

Commit 8bd35ca

Browse files
[SPIR-V] Fix LIT tests, improve ICmpInst's type inference (#139726)
1. There are failed LIT tests at the moment due to type inference errors. ``` Failed Tests (3): LLVM :: CodeGen/SPIRV/pointers/ptr-eq-types.ll LLVM :: CodeGen/SPIRV/validate/sycl-hier-par-basic.ll LLVM :: CodeGen/SPIRV/validate/sycl-tangle-group-algorithms.ll ``` This PR improves type inference to fix the errors. 2. The following tests start passing: ``` Unexpectedly Passed Tests (2): LLVM :: CodeGen/SPIRV/pointers/resource-addrspacecast-2.ll LLVM :: CodeGen/SPIRV/pointers/resource-addrspacecast.ll ``` This PR removes XFAILS in those two test cases.
1 parent 9893f6b commit 8bd35ca

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,15 +1081,19 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
10811081
return;
10821082
Value *Op0 = Ref->getOperand(0);
10831083
Value *Op1 = Ref->getOperand(1);
1084-
Type *ElemTy0 = GR->findDeducedElementType(Op0);
1084+
bool Incomplete0 = isTodoType(Op0);
1085+
bool Incomplete1 = isTodoType(Op1);
10851086
Type *ElemTy1 = GR->findDeducedElementType(Op1);
1087+
Type *ElemTy0 = (Incomplete0 && !Incomplete1 && ElemTy1)
1088+
? nullptr
1089+
: GR->findDeducedElementType(Op0);
10861090
if (ElemTy0) {
10871091
KnownElemTy = ElemTy0;
1088-
Incomplete = isTodoType(Op0);
1092+
Incomplete = Incomplete0;
10891093
Ops.push_back(std::make_pair(Op1, 1));
10901094
} else if (ElemTy1) {
10911095
KnownElemTy = ElemTy1;
1092-
Incomplete = isTodoType(Op1);
1096+
Incomplete = Incomplete1;
10931097
Ops.push_back(std::make_pair(Op0, 0));
10941098
}
10951099
} else if (CallInst *CI = dyn_cast<CallInst>(I)) {
@@ -1108,8 +1112,6 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
11081112
IRBuilder<> B(Ctx);
11091113
for (auto &OpIt : Ops) {
11101114
Value *Op = OpIt.first;
1111-
if (Op->use_empty())
1112-
continue;
11131115
if (AskOps && !AskOps->contains(Op))
11141116
continue;
11151117
Type *AskTy = nullptr;

llvm/test/CodeGen/SPIRV/pointers/resource-addrspacecast-2.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
; RUN: llc -verify-machineinstrs -O3 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - | FileCheck %s --match-full-lines
22
; RUN: %if spirv-tools %{ llc -O3 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
33

4-
; FIXME(134119): enable-this once Offset decoration are added.
5-
; XFAIL: spirv-tools
6-
74
%S2 = type { { [10 x { i32, i32 } ] }, i32 }
85

96
; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0

llvm/test/CodeGen/SPIRV/pointers/resource-addrspacecast.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
; RUN: llc -verify-machineinstrs -O3 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - | FileCheck %s
22
; RUN: %if spirv-tools %{ llc -O3 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
33

4-
; FIXME(134119): enable-this once Offset decoration are added.
5-
; XFAIL: spirv-tools
6-
74
%struct.S = type { i32 }
85

96
; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0

0 commit comments

Comments
 (0)