diff --git a/crates/rustc_codegen_spirv/src/linker/duplicates.rs b/crates/rustc_codegen_spirv/src/linker/duplicates.rs index 5033dd7775..090f67d0d3 100644 --- a/crates/rustc_codegen_spirv/src/linker/duplicates.rs +++ b/crates/rustc_codegen_spirv/src/linker/duplicates.rs @@ -269,8 +269,8 @@ pub fn remove_duplicate_types(module: &mut Module) { .annotations .retain(|inst| anno_set.insert(inst.assemble())); // Same thing with OpName - let mut debug_set = HashSet::new(); - module - .debugs - .retain(|inst| debug_set.insert(inst.assemble())); + let mut name_ids = HashSet::new(); + module.debugs.retain(|inst| { + inst.class.opcode != Op::Name || name_ids.insert(inst.operands[0].unwrap_id_ref()) + }); }