[LLVMdev] What opt pass attempts implements this optimization?

Dan Gohman gohman at apple.com
Tue Oct 6 21:35:28 PDT 2009


On Oct 6, 2009, at 4:28 PM, Villmow, Micah wrote:

> I have a very simple kernel that is generating very very bad code.
>
> The basic kernel pseudo-code is as follows:
> forloop(1 to n) {
>   forloop(0 to j) {
>   A
> }
> B
> }
> C
>
> It is generating very ugly and inefficient code for a vector system  
> similar to the following pseudo-code:
> if (n > 1) {
>   if (j) {
>                 forloop(1 to n) {
>                                 forloop(0 to j) {
>                                 A
>                                 }
>                                 B
>                 }
>                C
>    } else {
>                 forloop(1 to n) {
>                                 B
>                 }
>                 C
>    }
> } else {
> C
> }

It's possible that there's something going on with loop unswitching  
here. Do you
have a testcase which demonstrates this?

Dan




More information about the llvm-dev mailing list