Skip to content
Snippets Groups Projects
Commit 0459c0e4 authored by rarbore2's avatar rarbore2
Browse files

Merge branch 'ccp-improvements' into 'main'

CCP improvements

See merge request !75
parents 5d2ed362 bf6026c5
No related branches found
No related tags found
1 merge request!75CCP improvements
Pipeline #200533 passed
...@@ -383,8 +383,14 @@ fn ccp_flow_function( ...@@ -383,8 +383,14 @@ fn ccp_flow_function(
}), }),
// If node has only one output, if doesn't directly handle crossover of // If node has only one output, if doesn't directly handle crossover of
// reachability and constant propagation. Read handles that. // reachability and constant propagation. Read handles that.
Node::If { control, cond: _ } => inputs[control.idx()].clone(), Node::If { control, cond } => {
Node::Match { control, sum: _ } => inputs[control.idx()].clone(), assert!(!inputs[control.idx()].is_reachable() || inputs[cond.idx()].is_reachable());
inputs[control.idx()].clone()
}
Node::Match { control, sum } => {
assert!(!inputs[control.idx()].is_reachable() || inputs[sum.idx()].is_reachable());
inputs[control.idx()].clone()
}
Node::Fork { Node::Fork {
control, control,
factors: _, factors: _,
...@@ -426,9 +432,21 @@ fn ccp_flow_function( ...@@ -426,9 +432,21 @@ fn ccp_flow_function(
// TODO: At least for now, reduce nodes always produce unknown values. // TODO: At least for now, reduce nodes always produce unknown values.
Node::Reduce { Node::Reduce {
control, control,
init: _, init,
reduct: _, reduct,
} => inputs[control.idx()].clone(), } => {
let reachability = inputs[control.idx()].reachability.clone();
if reachability == ReachabilityLattice::Reachable {
assert!(inputs[init.idx()].is_reachable());
let mut constant = inputs[init.idx()].constant.clone();
if inputs[reduct.idx()].is_reachable() {
constant = ConstantLattice::meet(&constant, &inputs[reduct.idx()].constant);
}
CCPLattice { reachability, constant }
} else {
CCPLattice { reachability, constant: ConstantLattice::top() }
}
},
Node::Return { control, data } => inputs[control.idx()].clone(), Node::Return { control, data } => inputs[control.idx()].clone(),
Node::Parameter { index: _ } => CCPLattice::bottom(), Node::Parameter { index: _ } => CCPLattice::bottom(),
// A constant node is the "source" of concrete constant lattice values. // A constant node is the "source" of concrete constant lattice values.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment