Make DataFlowGraph::insts public, but restricted (#5450)
We have some operations defined on DataFlowGraph purely to work around borrow-checker issues with InstructionData and other data on DataFlowGraph. Part of the problem is that indexing the DFG directly hides the fact that we're only indexing the insts field of the DFG. This PR makes the insts field of the DFG public, but wraps it in a newtype that only allows indexing. This means that the borrow checker is better able to tell when operations on memory held by the DFG won't conflict, which comes up frequently when mutating ValueLists held by InstructionData.
This commit is contained in:
@@ -600,7 +600,7 @@ impl Layout {
|
||||
// If two, the former is conditional and the latter is unconditional.
|
||||
let last = self.last_inst(block)?;
|
||||
if let Some(prev) = self.prev_inst(last) {
|
||||
if dfg[prev].opcode().is_branch() {
|
||||
if dfg.insts[prev].opcode().is_branch() {
|
||||
return Some(prev);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user