Skip to content

Commit

Permalink
MIR Optimise - Treat asm! outputs as assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Feb 5, 2017
1 parent 9700e50 commit 16f5d2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mir/optimise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ void MIR_Optimise(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path
change_happened = true;
}

// TODO: Convert `&mut *mut_foo` into `mut_foo` if the source is movable and not used afterwards

// >> Propagate/remove dead assignments
while( MIR_Optimise_PropagateSingleAssignments(state, fcn) )
change_happened = true;
Expand Down Expand Up @@ -2138,6 +2140,11 @@ bool MIR_Optimise_GarbageCollect(::MIR::TypeResolve& state, ::MIR::Function& fcn
if( e->flag_idx != ~0u )
used_dfs.at(e->flag_idx) = true;
}
else if( const auto* e = stmt.opt_Asm() )
{
for(const auto& val : e->outputs)
assigned_lval(val.second);
}
else if( const auto* e = stmt.opt_SetDropFlag() )
{
if( e->other != ~0u )
Expand Down

0 comments on commit 16f5d2d

Please sign in to comment.