Rhs X removals in coptstop.c should no longer be dangerous.

This commit is contained in:
Alex Volkov
2026-03-26 18:32:04 -04:00
parent 6027487c30
commit 321e47f0f3

View File

@@ -1423,12 +1423,10 @@ static unsigned Opt_a_tosbitwise (StackOpData* D, opc_t OPC)
InsertEntry (D, X, D->IP++); InsertEntry (D, X, D->IP++);
} }
/* ### Bug to come: there are dangerous Rhs X removal attempts here. /* Note: Eager Rhs X removals here can sometimes produce slightly worse
** Runtime function calls can be "loads", and must be treated as a ** code after all other optimizers have run. This may need a general
** single A/X unit, so removal of X load alone is not valid. ** study of which is better: eager removal, or letting other optimizers
** This can be solved with an additional "removable Rhs" test, or ** take care of unneeded loads.
** by simply not forcing the LI_REMOVE flag and letting other optimizers
** remove any unnecessary loads.
*/ */
/* Do high-byte operation only when its result is used */ /* Do high-byte operation only when its result is used */
if ((GetRegInfo (D->Code, D->IP, REG_X) & REG_X) != 0) { if ((GetRegInfo (D->Code, D->IP, REG_X) & REG_X) != 0) {