Optimizer - Update UD chains during constant propagation
This commit is contained in:
parent
12f9402c94
commit
312392d405
1 changed files with 4 additions and 5 deletions
|
@ -1503,7 +1503,7 @@ bool opopt::PropagateConstants(
|
||||||
T_Set< uint32_t > cDefs{ UseTag< ArrayBacked< 16 > >( ) };
|
T_Set< uint32_t > cDefs{ UseTag< ArrayBacked< 16 > >( ) };
|
||||||
T_AutoArray< double , 16 > cValues;
|
T_AutoArray< double , 16 > cValues;
|
||||||
bool changesMade{ false };
|
bool changesMade{ false };
|
||||||
for ( auto const& udc : oData.varUDChains.values( ) ) {
|
for ( auto& udc : oData.varUDChains.values( ) ) {
|
||||||
cDefs.clear( );
|
cDefs.clear( );
|
||||||
cValues.clear( );
|
cValues.clear( );
|
||||||
|
|
||||||
|
@ -1530,8 +1530,7 @@ bool opopt::PropagateConstants(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto nUses{ udc.uses.size( ) };
|
for ( auto i = 0u ; i < udc.uses.size( ) ; ) {
|
||||||
for ( auto i = 0u ; i < nUses ; i ++ ) {
|
|
||||||
auto const& use{ udc.uses[ i ] };
|
auto const& use{ udc.uses[ i ] };
|
||||||
const auto nRefs{ use.refs.size( ) };
|
const auto nRefs{ use.refs.size( ) };
|
||||||
T_Optional< double > repVal{ };
|
T_Optional< double > repVal{ };
|
||||||
|
@ -1549,13 +1548,13 @@ bool opopt::PropagateConstants(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !repVal ) {
|
if ( !repVal ) {
|
||||||
|
i ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf( "Could replace use at %d with constant %f\n" ,
|
|
||||||
use.node , *repVal );
|
|
||||||
CPReplaceWithConstant_( *oData.instructions[ use.node ].node ,
|
CPReplaceWithConstant_( *oData.instructions[ use.node ].node ,
|
||||||
udc.var , *repVal , oData );
|
udc.var , *repVal , oData );
|
||||||
|
udc.uses.removeSwap( i );
|
||||||
changesMade = true;
|
changesMade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue