Skip to content

Commit 53c6356

Browse files
authored
Fixed crash in SPIR-V CodeGen when a const is declared twice (taichi-dev#5813)
1 parent 6894ddc commit 53c6356

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

taichi/codegen/spirv/spirv_ir_builder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,8 @@ void IRBuilder::store_variable(Value pointer, Value value) {
11811181

11821182
void IRBuilder::register_value(std::string name, Value value) {
11831183
auto it = value_name_tbl_.find(name);
1184-
if (it != value_name_tbl_.end()) {
1185-
TI_ERROR("{} is existed.", name);
1184+
if (it != value_name_tbl_.end() && it->second.flag != ValueKind::kConstant) {
1185+
TI_ERROR("{} already exists.", name);
11861186
}
11871187
this->debug(
11881188
spv::OpName, value,

0 commit comments

Comments
 (0)