regalloc.rs icon indicating copy to clipboard operation
regalloc.rs copied to clipboard

Invalid split between use and def for a modified vreg

Open bnjbvr opened this issue 5 years ago • 0 comments

This issue might be related to #32, although I'm not sure: I've hit the following case in fuzzing, that causes a split between the use and def point of an instruction, for a vreg that is modified by the instruction. This is obviously invalid, and suggests again that the split position should always be at new defs of the current vreg, or at use points.

; run with cargo run -- -a lsra -i 5 -f 5
v2I = I32
v3I = I32
v4I = I32
v5I = I32
v0F = F32
v8F = F32
r0I = real I32 0
r2I = real I32 2
r6F = real F32 6
r7F = real F32 7

b0:
    imm     v5I, 2182655
    cmp_eq  v4I, v5I, v5I
    immf    r7F, -243535420000000000000000000000000000000.0
    cmp_eq  r2I, v4I, v4I
    copy    v3I, v4I
    imm     v2I, 2661195422
    copy    r2I, r2I
    if_then_else r2I, b2:b2, b1:b1

b1:
    loadf   v8F, [v4I, r2I]
    loadf   r6F, [v5I, 3929290037]
    store   [v2I, v2I], v5I
    subm    r2I, 471604252
    addm    r2I, 471604252
    cmp_eqm v4I, v2I
    loadf   v0F, [v3I, v3I]
    finish

b2:
    copy    r2I, r2I
    copy    r2I, r2I
    copy    r0I, r2I
    subm    v2I, r2I
    mulm    v3I, 3941264106
    store   [v4I, v4I], v2I
    finish

bnjbvr avatar Mar 16 '20 15:03 bnjbvr