[PATCH] D32563: Add LiveRangeShrink pass to shrink live range within BB.

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 09:23:43 PDT 2017


danielcdh added a comment.

Yes, adding -pre-RA-sched=list-ilp can produce the expected result without this patch for my testcase. I'm not familiar with -pre-RA-sched, any quick insight why this option is not on by default?

Thanks,
Dehao

In https://reviews.llvm.org/D32563#742146, @andreadb wrote:

> In all the new test cases, the problem is indirectly caused by the presence of function calls in the reassociated expression.
>  Your patch is essentially trying to solve a register pressure problem at LLVM IR level by pre-scheduling instructions. However, as Sanjay pointed out, this design can be a bit fragile since later passes may undo your canonicalization.
>
> My understanding is that the `pre-RA-scheduler` pass should be responsible for finding a good schedule that minimizes register pressure in preparation for regalloc.
>  Do you know why `pre-RA-scheduler` is unable to find a good schedule for your particular case?
>
> If I pass ‘test2()’ to llc (with flag `-pre-RA-sched=list-ilp -mtriple=x86_64-unknown-unknown`) then I get the expected schedule of call/add instructions.
>
>   test2:
>           pushq   %r14
>           pushq   %rbx
>           pushq   %rax
>           callq   foo
>           movl    %eax, %r14d
>           callq   foo
>           movl    %eax, %ebx
>           addq    %r14, %rbx
>           callq   foo
>           movl    %eax, %eax
>           addq    %rbx, %rax
>           addq    $8, %rsp
>           popq    %rbx
>           popq    %r14
>           retq
>





https://reviews.llvm.org/D32563





More information about the llvm-commits mailing list