[Issue 9097] Value range propagation to disable some array bound tests

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 9 03:15:13 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9097



--- Comment #3 from bearophile_hugs at eml.cc 2013-07-09 03:15:11 PDT ---
In past dmd generated this with "dmd -O -inline -release -noboundscheck":


__Dmain:
    sub ESP, 0330h
    mov ECX, 0C8h
    push EDI
    mov EAX, 0338h[ESP]
    add EAX, 01770h
    mov 4[ESP], EAX
    xor EAX, EAX
    lea EDI, 014h[ESP]
    rep
    stosd

    mov EAX, 4[ESP]
    mov ECX, 064h
    xor EDX, EDX
    div ECX

    xor EAX, EAX
    mov dword ptr 014h[EDX*4][ESP], 1
    pop EDI
    add ESP, 0330h
    ret


Now it generates this in both the optimized build and the less optimized build
"dmd -O -inline" (beside removing the array bound tests, it also avoids the
"div"):


__Dmain:
    sub ESP, 0324h
    mov ECX, 0C8h
    push EDI
    mov EAX, 032Ch[ESP]
    add EAX, 01770h
    mov 0324h[ESP], EAX
    xor EAX, EAX
    lea EDI, 4[ESP]
    rep
    stosd

    mov ECX, 0324h[ESP]
    mov EAX, ECX
    mov EDX, 051EB851Fh
    mul EDX
    shr EDX, 5
    imul EAX, EDX, 064h
    sub ECX, EAX

    xor EAX, EAX
    mov dword ptr 4[ECX*4][ESP], 1
    pop EDI
    add ESP, 0324h
    ret

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list