Skip to content

Commit a5e9fe7

Browse files
committed
Fix nasty miscompilation
1 parent 92b680f commit a5e9fe7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/rustc_codegen_spirv/src/linker/peephole_opts.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ pub fn composite_construct(types: &FxHashMap<Word, Instruction>, function: &mut
7272
// of bounds, but just stop optimizing instead of panicing here.
7373
break;
7474
}
75-
components[index] = Some(value);
75+
if components[index].is_none() {
76+
components[index] = Some(value);
77+
}
7678
// Follow back one in the chain of OpCompositeInsert
7779
cur_inst = match defs.get(&cur_inst.operands[1].unwrap_id_ref()) {
7880
Some(i) => i,

0 commit comments

Comments
 (0)