mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
perf: 逐指令活集拍平为单一位集加消费方维度守卫同步
This commit is contained in:
@@ -75,8 +75,9 @@ pub fn dce_precise(f: &mut IRFunction, live: &LiveInfo) -> PreciseOutcome {
|
||||
return PreciseOutcome { live_reusable: true };
|
||||
}
|
||||
// 维度守卫:live 与 insts 对齐才可信(删改后的过期 LiveInfo 索引错位会误删活指令);
|
||||
// 守卫不过时活集必过期,调用方须重建。
|
||||
if live.inst_live_after.len() != f.insts.len() {
|
||||
// 拍平后外层长度 = N×words,空 LiveInfo 的 words 为 0(0==N*0 会误判对齐),
|
||||
// 须同时判 words > 0。守卫不过时活集必过期,调用方须重建。
|
||||
if live.inst_live_after.len() != f.insts.len() * live.words || live.words == 0 {
|
||||
return PreciseOutcome { live_reusable: false };
|
||||
}
|
||||
let mut keep = vec![true; f.insts.len()];
|
||||
|
||||
@@ -38,7 +38,7 @@ pub(super) fn pass_dead_with_liveness(f: &IRFunction, live: &LiveInfo, keep: &mu
|
||||
if !keep[i] || label_target[i] {
|
||||
continue;
|
||||
}
|
||||
let after = &live.inst_live_after[i];
|
||||
let after = &live.inst_live_after[i * live.words..(i + 1) * live.words];
|
||||
let not_live_after = |r: u32| !oxide_liveness::bitset_get(after, r as usize);
|
||||
// 通用规则:纯指令结果不被后续使用 → 删(is_pure=false 已防 CALL/SPILL/UNSPILL)
|
||||
if let Some(r) = inst.def_reg() {
|
||||
|
||||
Reference in New Issue
Block a user