Skip to content

[SPIR-V] Change return value of mapType function #3871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm-spirv/lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1794,10 +1794,11 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,

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

Expand Down
2 changes: 1 addition & 1 deletion llvm-spirv/test/pointer_type_mapping.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
; CHECK: Name [[#NAME:]] "struct._ZTS6Object.Object"
; CHECK-COUNT-1: TypeStruct [[#NAME]]
; TODO add check count one and remove unused, when the type mapping bug is fixed
; CHECK: TypePointer [[#UNUSED:]] {{.*}} [[#NAME]]
; CHECK: TypePointer [[#PTRTY:]] {{.*}} [[#NAME]]
; CHECK: TypePointer [[#UNUSED:]] {{.*}} [[#NAME]]
; CHECK: FunctionParameter [[#PTRTY]]
; CHECK-NOT: FunctionParameter [[#UNUSED]]

Expand Down