pub struct Mem2Reg;Expand description
mem2reg pass.
§Correctness
Preconditions for a promoted slot:
- The alloca is entry-block local and scalar (
alloca Twith no element count). - Its address is only used by non-volatile
load/store. - The pointer value does not escape (no call args, no stores of the pointer, no GEP/cast/phi/select uses of the pointer itself).
Postconditions for each promoted slot:
- Every
loadis replaced by the reaching SSA value from the dominator walk. - Phi nodes are inserted only at iterated dominance-frontier blocks.
- Every inserted phi has one incoming value per CFG predecessor.
- No promoted
alloca/load/storeremains in the block bodies.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mem2Reg
impl RefUnwindSafe for Mem2Reg
impl Send for Mem2Reg
impl Sync for Mem2Reg
impl Unpin for Mem2Reg
impl UnsafeUnpin for Mem2Reg
impl UnwindSafe for Mem2Reg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more