Skip to content

Commit 7c034d0

Browse files
committed
[SPIR-V] Change return value of mapType function
It's a follow up change for intel#3856 Signed-off-by: Dmitry Sidorov <[email protected]>
1 parent f6569d1 commit 7c034d0

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
@@ -1794,10 +1794,11 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
17941794

17951795
SPIRVType *LLVMToSPIRVBase::mapType(Type *T, SPIRVType *BT) {
17961796
auto EmplaceStatus = TypeMap.try_emplace(T, BT);
1797-
(void)EmplaceStatus;
17981797
// TODO: Uncomment the assertion, once the type mapping issue is resolved
17991798
// assert(EmplaceStatus.second && "The type was already added to the map");
18001799
SPIRVDBG(dbgs() << "[mapType] " << *T << " => "; spvdbgs() << *BT << '\n');
1800+
if (!EmplaceStatus.second)
1801+
return TypeMap[T];
18011802
return BT;
18021803
}
18031804

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)