matsc-at-sics-se / unison

Unison's source code
http://unison-code.github.io/
Other
5 stars 0 forks source link

uni import: liftRegs: failed to lift rax #13

Closed matsc-at-sics-se closed 6 years ago

matsc-at-sics-se commented 6 years ago

copy_term.zip

$ uni import -f ct_ensure_space copy_term.mir -o ct_ensure_space.uni --target=X86 --maxblocksize=50 --goal=speed --copyremat -d
[...]
Output from extractCallRegs:
[...]
    o16: [rax,rdx] <- IMUL64r [t18,rax]
[...]
Output from liftRegs:
[...]
    o16: [t53,t54] <- IMUL64r [t18,rax]
[...]
Output from runTargetTransforms:
{- crash in handlePropotedOperands, trying to preassign rax to rax -}

liftRegs should have lifted rax, no?

matsc-at-sics-se commented 6 years ago

On closer inspection, extractCallRegs seems to be the culprit:

[...]
    o15: [rax] <- (copy) [t17]
    o16: [rax,rdx] <- IMUL64r [t18,rax]
[...]
    o68: [rdi] <- (copy) [t5]
    o69: [rsi] <- (copy) [t4]
    o70: [rdx] <- (copy) [t36]
    o71: [] <- CALL64pcrel32 [@call_overflow]
[...]
Output from extractCallRegs:
[...]
    o15: [t37] <- (copy) [t17]
    o16: [rax,rdx] <- IMUL64r [t18,rax]
[...]
    o26: [t38] <- (copy) [t6]
    o27: [t39] <- (copy) [t24]
    o28: [t40] <- (copy) [t25]
    o29: [] <- CALL64pcrel32 [@size_at_most]
    o87: [t41:eax] <- (fun) [t37:rax,t38:rdi,t39:rsi,t40:edx] (call: o29)
[...]

So perhaps an instance of #11

matsc-at-sics-se commented 6 years ago

Fixed by --explicitcallreg.