Apply suggestions from code review

This commit is contained in:
Eduard-Mihai Burtescu 2023-05-26 19:19:00 +03:00
parent 0db8e0a338
commit 7a44fa1e9c
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(`0.11.1` for `wgpu 0.15`, `0.12.1` for `wgpu 0.16`, and any later versions) (`0.11.1` for `wgpu 0.15`, `0.12.1` for `wgpu 0.16`, and any later versions)
### Fixed 🩹 ### Fixed 🩹
- [PR#1059](https://github.com/EmbarkStudios/rust-gpu/pull/1059) Fix bug where the `inline` pass would not rewrite `OpDecorate` IDs, which would subsequently loose those decorations in later DCE passes. - [PR#1059](https://github.com/EmbarkStudios/rust-gpu/pull/1059) fixed the `inline` pass not copying `OpDecorate`s in the callee (which led to their loss).
## [0.7.0] ## [0.7.0]

View File

@ -352,7 +352,7 @@ impl Inliner<'_, '_> {
result result
} }
///Applies all rewrite rules to the decorations in the header. /// Applies all rewrite rules to the decorations in the header.
fn apply_rewrite_for_decorations(&mut self, rewrite_rules: &FxHashMap<Word, Word>) { fn apply_rewrite_for_decorations(&mut self, rewrite_rules: &FxHashMap<Word, Word>) {
// NOTE(siebencorgie): We don't care *what* decoration we rewrite atm. AFAIK there is no case where rewriting // NOTE(siebencorgie): We don't care *what* decoration we rewrite atm. AFAIK there is no case where rewriting
// the decoration on inline wouldn't be valid. // the decoration on inline wouldn't be valid.
@ -360,7 +360,7 @@ impl Inliner<'_, '_> {
if self.annotations[annotation_idx].class.opcode == Op::Decorate { if self.annotations[annotation_idx].class.opcode == Op::Decorate {
if let Some(id) = self.annotations[annotation_idx].operands[0].id_ref_any_mut() { if let Some(id) = self.annotations[annotation_idx].operands[0].id_ref_any_mut() {
if let Some(&rewrite) = rewrite_rules.get(id) { if let Some(&rewrite) = rewrite_rules.get(id) {
//Copy decoration instruction and push it. // Copy decoration instruction and push it.
let mut instcpy = self.annotations[annotation_idx].clone(); let mut instcpy = self.annotations[annotation_idx].clone();
*instcpy.operands[0].id_ref_any_mut().unwrap() = rewrite; *instcpy.operands[0].id_ref_any_mut().unwrap() = rewrite;
self.annotations.push(instcpy); self.annotations.push(instcpy);