File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1284,6 +1284,29 @@ bool CJitter::CopyPropagation(StatementList& statements)
12841284 innerStatement.jmpCondition = outerStatement.jmpCondition ;
12851285 changed = true ;
12861286 }
1287+ // Substitute src operand of a statement if our defining statement (outerStatement) is a OP_MOV
1288+ // Example:
1289+ // outerDstSymbol -> t0
1290+ // Before:
1291+ // - t0 = r0
1292+ // - r1 = t0 & r2
1293+ // After:
1294+ // - t0 = r0
1295+ // - r1 = r0 & r2
1296+ // After substitution, t0 will not be used anymore making outerStatement eligible for removal
1297+ else if (outerStatement.op == OP_MOV)
1298+ {
1299+ auto replacementSym = outerStatement.src1 ;
1300+ innerStatement.VisitSources (
1301+ [&](SymbolRefPtr& symbol, bool ) {
1302+ if (symbol->Equals (outerDstSymbol))
1303+ {
1304+ symbol = replacementSym;
1305+ changed = true ;
1306+ }
1307+ });
1308+ assert (changed);
1309+ }
12871310 // Find all the add/sub constant and add them together
12881311 // Example
12891312 // outerDstSymbol -> t0
You can’t perform that action at this time.
0 commit comments