Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[imcc] fix more -O2 errors, found but empty => delete ins

On some constant propagation on (mostly arithmetic or param) ops,
the ins can be safely deleted. GH #1039

This fixed:
t/compilers/imcc/syn/macro.t 10-11
t/pmc/io.t 13-14
t/op/lexicals.t 42

but broke: t/pmc/exception-old.t 19
  • Loading branch information...
commit ab85cac847e69b29a5f66442e6fd2f7b48756892 1 parent 64dc724
@rurban rurban authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 compilers/imcc/optimizer.c
View
11 compilers/imcc/optimizer.c
@@ -759,15 +759,18 @@ constant_propagation(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit))
if (found) {
const Instruction * const prev = ins2->prev;
if (prev) {
+ any = 1;
if (tmp) { /* see syn/clash_1.pir or syn/const_31.pir */
subst_ins(unit, ins2, tmp, 1);
- any = 1;
IMCC_debug(imcc, DEBUG_OPT2, " reduced to ");
IMCC_debug_ins(imcc, DEBUG_OPT2, tmp);
}
- else {
- ins2->op = oldop;
- IMCC_debug(imcc, DEBUG_OPT2, " no const op for %s\n", ins2->opname);
+ else { /* see syn/macro_10.pir */
+ IMCC_debug(imcc, DEBUG_OPT2, " deleted ");
+ IMCC_debug_ins(imcc, DEBUG_OPT2, ins2);
+ --old->use_count;
+ unit->ostat.deleted_ins++;
+ ins2 = delete_ins(unit, ins2);
}
ins2 = prev->next;
}
Please sign in to comment.
Something went wrong with that request. Please try again.