Fix desired branch elision heuristic
This commit is contained in:
parent
5887efa841
commit
94b3bd529a
@ -10,22 +10,34 @@ struct Visit {
|
||||
has_branch: bool,
|
||||
}
|
||||
|
||||
impl Visitor for Visit {
|
||||
fn visit_br(&mut self, _: &Br) {
|
||||
impl Visit {
|
||||
fn set_branch(&mut self, br: &Br) {
|
||||
if br.target() != 0 {
|
||||
self.has_branch = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_br_if(&mut self, _: &BrIf) {
|
||||
self.has_branch = true;
|
||||
impl Visitor for Visit {
|
||||
fn visit_br(&mut self, stat: &Br) {
|
||||
self.set_branch(stat);
|
||||
}
|
||||
|
||||
fn visit_br_if(&mut self, stat: &BrIf) {
|
||||
self.set_branch(stat.target());
|
||||
}
|
||||
|
||||
fn visit_br_table(&mut self, table: &BrTable) {
|
||||
self.has_branch = true;
|
||||
self.set_branch(table.default());
|
||||
|
||||
if table.data().is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
for target in table.data() {
|
||||
self.set_branch(target);
|
||||
}
|
||||
|
||||
let id = table as *const _ as usize;
|
||||
let len = self.br_map.len() + 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user