Browse Source
* cranelift: Minimize ways to manipulate instruction results In particular, remove support for detaching/attaching/appending instruction results. The AliasAnalysis pass used detach_results, but leaked the detached ValueList; using clear_results instead is better. The verifier's `test_printing_contextual_errors` needed to get the verifier to produce an error containing a pretty-printed instruction, and did so by appending too many results. Instead, failing to append any results gets a similar error out of the verifier, without requiring that we expose the easy-to-misuse append_result method. However, `iconst` is not a suitable instruction for this version of the test because its result type is its controlling type, so failing to create any results caused assertion failures rather than the desired verifier error. I switched to `f64const` which has a non-polymorphic type. The DFG's `aliases` test cleared both results of an instruction and then reattached one of them. Since we have access to DFG internals in these tests, it's easier to directly manipulate the relevant ValueList than to use these unsafe methods. The only other use of attach/append was in `make_inst_results_reusing` which decided which to use based on whether a particular result was supposed to reuse an existing value. Inlining both methods there revealed that they were nearly identical and could have most of their code factored out. While I was looking at uses of `DataFlowGraph::results`, I also simplified replace_with_aliases a little bit. * Review commentspull/8296/head
Jamey Sharp
7 months ago
committed by
GitHub
3 changed files with 33 additions and 71 deletions
Loading…
Reference in new issue