Skip to content

Commit 61b81ff

Browse files
authored
[SPIR-V] Change return value of mapType function (#3871)
It's a follow up change for #3856 Signed-off-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
1 parent 7bfc276 commit 61b81ff

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,10 +1827,11 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
18271827

18281828
SPIRVType *LLVMToSPIRVBase::mapType(Type *T, SPIRVType *BT) {
18291829
auto EmplaceStatus = TypeMap.try_emplace(T, BT);
1830-
(void)EmplaceStatus;
18311830
// TODO: Uncomment the assertion, once the type mapping issue is resolved
18321831
// assert(EmplaceStatus.second && "The type was already added to the map");
18331832
SPIRVDBG(dbgs() << "[mapType] " << *T << " => "; spvdbgs() << *BT << '\n');
1833+
if (!EmplaceStatus.second)
1834+
return TypeMap[T];
18341835
return BT;
18351836
}
18361837

llvm-spirv/test/pointer_type_mapping.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
; CHECK: Name [[#NAME:]] "struct._ZTS6Object.Object"
66
; CHECK-COUNT-1: TypeStruct [[#NAME]]
77
; TODO add check count one and remove unused, when the type mapping bug is fixed
8-
; CHECK: TypePointer [[#UNUSED:]] {{.*}} [[#NAME]]
98
; CHECK: TypePointer [[#PTRTY:]] {{.*}} [[#NAME]]
9+
; CHECK: TypePointer [[#UNUSED:]] {{.*}} [[#NAME]]
1010
; CHECK: FunctionParameter [[#PTRTY]]
1111
; CHECK-NOT: FunctionParameter [[#UNUSED]]
1212

0 commit comments

Comments
 (0)