Permalink
Browse files

[imcc] fix -O2 empty ins->next in used_once [GH #1042]

If the deleted op leads to the last op, which has no op->next
break the used_once loop.

Fixes GH #1042 t/op/exit_6.pasm
    set I0, 0 # used_once => deleted
    end
  • Loading branch information...
1 parent 03345be commit 414d7f85582a48632791154ef2b78a09f89fb2a0 Reini Urban committed Feb 28, 2014
Showing with 9 additions and 11 deletions.
  1. +4 −3 ChangeLog
  2. +3 −0 compilers/imcc/optimizer.c
  3. +2 −8 t/op/exit.t
View
@@ -10,9 +10,10 @@
- leading to empty ins->op ptrs when deleting or skipping
certain instruction [GH #1039],
- a wrong logic leading to missed detecting writes
- from get_results [GH #1041], and
- - propagate only matching types in setters [GH #1043].
- Only 2 remaining -O2 test failures.
+ from get_results [GH #1041],
+ - propagate only matching types in setters [GH #1042], and
+ - empty ins->next in used_once deletion [GH #1044].
+ Only 1 remaining -O2 test regression.
- Build
+ Set emacs buffer-read-only:t tags in generated files [GH #1034]
+ Provide coda for generated include/*.pasm files [GH #1032]
@@ -1670,6 +1670,9 @@ used_once(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit))
unit->ostat.deleted_ins++;
unit->ostat.used_once++;
opt++;
+
+ if (!ins) /* if there's no next GH 1042 */
+ break;
}
}
}
View
@@ -5,7 +5,6 @@ use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
-use Test::More;
use Parrot::Test tests => 9;
=head1 NAME
@@ -22,8 +21,6 @@ Test both success and failure exit status.
=cut
-$ENV{TEST_PROG_ARGS} ||= '';
-
pir_exit_code_is( <<'CODE', 0, 'pir exit with success' );
.sub main :main
exit 0
@@ -54,14 +51,11 @@ pir_exit_code_is( <<'CODE', 0, 'pir exits with success by default' );
.end
CODE
-TODO: {
- local $TODO = '-O2 used_once: empty ins [GH #1042]'
- if $ENV{TEST_PROG_ARGS} =~ / -O2/;
- pasm_exit_code_is( <<'CODE', 0, 'exit with success by default' );
+# empty ins->next in -O2 used_once fixed with [GH #1042]
+pasm_exit_code_is( <<'CODE', 0, 'exit with success by default' );
set I0, 0
end
CODE
-}
pir_exit_code_is( <<'CODE', 2, "pir exit code isn't exception type" );
.sub main :main

0 comments on commit 414d7f8

Please sign in to comment.