Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RLSRA: fix edge case when (virtual) register is only defd but not used
Consider following - somewhat pathological - TRIL fragment: N... N004 treetop N003 iadd N001 iload 'x' N002 iload 'y' N... such that the value of the `iadd` node (`N003`) is never used. The iadd node is compiled to (say) something like: addi {vr003}, {vr001}, {vr002} This instruction defines (assigns) a virtual register `{vr003}` but since its value is never used, the interval for `{vr003}` of length 1 and such interval was *not* created by interval splitting. Now consider even trickier example: N... N004 treetop N003 icall 'some_func' N... such that value of the icall node (`N003`) is never used just like in previous example (in other words: the code calls a function `some_func` but does not use its return value - an entirely valid, if not common, situation). Here, the call instruction does define (say) virtual register `{vr003}` by having a dependency of linkage-defined return register on `{vr003}`. But since value of `{vr003}` is never used, there's no need to generate register move from linkage-defined return register to `{vr003}`. This commit fixes RLSRA for cases like these.
- Loading branch information