Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-O2 check types in constant propagation #1043

Closed
rurban opened this issue Feb 28, 2014 · 0 comments
Closed

-O2 check types in constant propagation #1043

rurban opened this issue Feb 28, 2014 · 0 comments
Assignees

Comments

@rurban
Copy link
Member

rurban commented Feb 28, 2014

$ cat t/op/jitn_13.pir
.sub _main :main
    .local num n
    .local int i
    n = 1.4
    i = n
    print i
    n = 2.5
    i = n
    print i
    n = 3.6
    i = n
    print i

    print "\n"
    end
.end

./parrot -d7161 -O2 t/op/jitn_13.pir
=>

debug = 0x7161, optim = 0x3
Reading t/op/jitn_13.pir
propagating constant 0x2ac15560 set n, 1.4
    checking op 0x2ac155d0 set i, n
 checking register 1 0x2ac155d0 set i, n
    propagating into register 1: 0x2ac155d0 set i, n
 -> 0x2ac155d0 set i, 1.4
    checking op 0x2ac15660 print i
    checking op 0x2ac15770 set n, 2.5
 checking register 0 0x2ac15770 set n, 2.5
propagating constant 0x2ac155d0 set i, 1.4
    checking op 0x2ac15660 print i
 checking register 0 0x2ac15660 print i
    propagating into register 0: 0x2ac15660 print i
 -> 0x2ac15660 print 1.4
    checking op 0x2ac15770 set n, 2.5
    checking op 0x2ac157e0 set i, n
 checking register 0 0x2ac157e0 set i, n
propagating constant 0x2ac15770 set n, 2.5
    checking op 0x2ac157e0 set i, n
 checking register 1 0x2ac157e0 set i, n
    propagating into register 1: 0x2ac157e0 set i, n
 -> 0x2ac157e0 set i, 2.5
    checking op 0x2ac15870 print i
    checking op 0x2ac15980 set n, 3.6
 checking register 0 0x2ac15980 set n, 3.6
propagating constant 0x2ac157e0 set i, 2.5
    checking op 0x2ac15870 print i
 checking register 0 0x2ac15870 print i
    propagating into register 0: 0x2ac15870 print i
 -> 0x2ac15870 print 2.5
    checking op 0x2ac15980 set n, 3.6
    checking op 0x2ac159f0 set i, n
 checking register 0 0x2ac159f0 set i, n
propagating constant 0x2ac15980 set n, 3.6
    checking op 0x2ac159f0 set i, n
 checking register 1 0x2ac159f0 set i, n
    propagating into register 1: 0x2ac159f0 set i, n
 -> 0x2ac159f0 set i, 3.6
    checking op 0x2ac15a80 print i
    checking op 0x2ac15ba0 print "\n"
    checking op 0x2ac15c10 end
propagating constant 0x2ac159f0 set i, 3.6
    checking op 0x2ac15a80 print i
 checking register 0 0x2ac15a80 print i
    propagating into register 0: 0x2ac15a80 print i
 -> 0x2ac15a80 print 3.6
    checking op 0x2ac15ba0 print "\n"
    checking op 0x2ac15c10 end
propagating constant 0x2ac15560 set n, 1.4
    checking op 0x2ac155d0 set i, 1.4
    checking op 0x2ac15660 print 1.4
    checking op 0x2ac15770 set n, 2.5
 checking register 0 0x2ac15770 set n, 2.5
propagating constant 0x2ac155d0 set i, 1.4
    checking op 0x2ac15660 print 1.4
    checking op 0x2ac15770 set n, 2.5
    checking op 0x2ac157e0 set i, 2.5
 checking register 0 0x2ac157e0 set i, 2.5
propagating constant 0x2ac15770 set n, 2.5
    checking op 0x2ac157e0 set i, 2.5
    checking op 0x2ac15870 print 2.5
    checking op 0x2ac15980 set n, 3.6
 checking register 0 0x2ac15980 set n, 3.6
propagating constant 0x2ac157e0 set i, 2.5
    checking op 0x2ac15870 print 2.5
    checking op 0x2ac15980 set n, 3.6
    checking op 0x2ac159f0 set i, 3.6
 checking register 0 0x2ac159f0 set i, 3.6
propagating constant 0x2ac15980 set n, 3.6
    checking op 0x2ac159f0 set i, 3.6
    checking op 0x2ac15a80 print 3.6
    checking op 0x2ac15ba0 print "\n"
    checking op 0x2ac15c10 end
propagating constant 0x2ac159f0 set i, 3.6
    checking op 0x2ac15a80 print 3.6
    checking op 0x2ac15ba0 print "\n"
    checking op 0x2ac15c10 end
sub _main:
    registers in .pir:   I1, N1, S0, P0
    0 labels, 0 lines deleted, 0 if_branch, 0 branch_branch
    0 branch_cond_loop
    0 used once deleted
    0 invariants_moved
    registers needed:    I1, N1, S0, P0
    registers in .pasm:  I1, N1, S0, P0 - 0
    1 basic_blocks, 0 edges
code_size(ops) 27  old_size 0
const 1.4   color 0 use_count 1
const 2.5   color 1 use_count 1
const 3.6   color 2 use_count 1
const "\n"  color 0 use_count 1
add_const_pmc_sub '_main' flags 10 color 0 (Sub) lex_info no :outer(*none*)
0 set_n_nc 0 0  0x2ac15560 set N0, 1.4
3 set_i_nc 0 0  0x2ac155d0 set I0, 1.4
6 print_nc 0    0x2ac15660 print 1.4
8 set_n_nc 0 1  0x2ac15770 set N0, 2.5
11 set_i_nc 0 1 0x2ac157e0 set I0, 2.5
14 print_nc 1   0x2ac15870 print 2.5
16 set_n_nc 0 2 0x2ac15980 set N0, 3.6
19 set_i_nc 0 2 0x2ac159f0 set I0, 3.6
22 print_nc 2   0x2ac15a80 print 3.6
24 print_sc 0   0x2ac15ba0 print "\n"
26 end  0x2ac15c10 end
1 lines compiled.
1.42.53.6
@rurban rurban self-assigned this Feb 28, 2014
rurban pushed a commit that referenced this issue Feb 28, 2014
set reg, const is only a valid const setter ifregx and const have the same type,
otherwise the type are coerced, like set N0, 1 or set I1, 1.5.
Do not propagate such values.
Fixes t/op/jitn_13.pir [GH #1043]
@rurban rurban closed this as completed Feb 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant