[PATCH] D22778: Add Loop Sink pass to reverse the LICM based of basic block frequency.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 12:44:45 PDT 2016


On Mon, Oct 17, 2016 at 12:09 PM, Daniel Berlin <dberlin at dberlin.org> wrote:

> This should be pretty easy:
>
> for loop:
>   if (g) {
>     if (a) {
>       c = b;
>   }
>    use c
>   }
>  }
>

For this case, c is not loop invariant, thus will not be handled by loop
sink.

But for nested loop, this could happen:

c = b;
for loop1:
  if (g) {
    for loop2 {
      use c
    }
  }
}

"c = b" could be sinked to the preheader of loop2 instead of loop2's body.

Dehao


>
>
> (there will be Phi nodes, obviously, to make this work).
>
>
> On Mon, Oct 17, 2016 at 11:49 AM, David Li <davidxl at google.com> wrote:
>
>> davidxl added a comment.
>>
>> Example of parent BB being colder than the use BB?
>>
>>
>> https://reviews.llvm.org/D22778
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161017/057e5f0d/attachment.html>


More information about the llvm-commits mailing list