Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
aman4150 committed Nov 5, 2024
1 parent aa6ea4f commit 2d79529
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions crates/polkavm-linker/src/program_from_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4502,40 +4502,40 @@ where
}

let mut modified = false;
if !reachability.is_dynamically_reachable()
&& !reachability.always_reachable_or_exported()
&& !reachability.reachable_from.is_empty()
&& reachability.reachable_from.len() < 64
{
for reg in Reg::ALL {
let mut common_value_opt = None;
for &source in &reachability.reachable_from {
let value = output_regs_for_block[source.index()].get_reg(reg);
if value == RegValue::InputReg(reg, current) {
continue;
}

if let Some(common_value) = common_value_opt {
if common_value == value {
continue;
}

common_value_opt = None;
break;
} else {
common_value_opt = Some(value);
}
}

if let Some(value) = common_value_opt {
let old_value = input_regs_for_block[current.index()].get_reg(reg);
if value != old_value {
input_regs_for_block[current.index()].set_reg(reg, value);
modified = true;
}
}
}
}
// if !reachability.is_dynamically_reachable()
// && !reachability.always_reachable_or_exported()
// && !reachability.reachable_from.is_empty()
// && reachability.reachable_from.len() < 64
// {
// for reg in Reg::ALL {
// let mut common_value_opt = None;
// for &source in &reachability.reachable_from {
// let value = output_regs_for_block[source.index()].get_reg(reg);
// if value == RegValue::InputReg(reg, current) {
// continue;
// }

// if let Some(common_value) = common_value_opt {
// if common_value == value {
// continue;
// }

// common_value_opt = None;
// break;
// } else {
// common_value_opt = Some(value);
// }
// }

// if let Some(value) = common_value_opt {
// let old_value = input_regs_for_block[current.index()].get_reg(reg);
// if value != old_value {
// input_regs_for_block[current.index()].set_reg(reg, value);
// modified = true;
// }
// }
// }
// }

let mut regs = input_regs_for_block[current.index()].clone();
let mut references = BTreeSet::new();
Expand Down

0 comments on commit 2d79529

Please sign in to comment.