1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Lightweight SSA repair for passes that do NOT modify the CFG structure.
//!
//! After instruction-only passes (constant propagation, copy propagation, DCE,
//! algebraic simplification), the SSA form needs minor cleanup but NOT full
//! reconstruction. The CFG topology, dominator tree, and phi placement are all
//! still valid — only instruction-level artifacts need attention.
//!
//! [`repair_ssa`](super::SsaFunction::repair_ssa) is the fast-path alternative
//! to [`rebuild_ssa`](super::SsaFunction::rebuild_ssa) for passes classified as
//! `ModificationScope::InstructionsOnly` or `UsesOnly`.
//!
//! # What it does
//!
//! 1. **Nop stripping** — Removes `Nop` instructions, reindexes variable `DefSite`s
//! 2. **Trivial phi elimination** — Removes phis where all operands resolve to one value
//! 3. **Dead phi elimination** — Removes phis whose result has no consumers
//! 4. **Variable compaction** — Removes orphaned variables and reindexes IDs
//!
//! # What it does NOT do (saving significant overhead)
//!
//! - Recompute dominators or dominance frontiers
//! - Recompute liveness
//! - Re-place phi nodes
//! - Full variable renaming
//! - Orphan origin assignment
//!
//! # When to use vs. `rebuild_ssa`
//!
//! | Pass type | Use |
//! |-----------|-----|
//! | Instruction-only (replace opcodes, substitute uses) | `repair_ssa` |
//! | CFG-modifying (add/remove blocks, change branches) | `rebuild_ssa` |
use crate::;