[PATCH] D37460: [GVN] Prevent LoadPRE from hoisting through guards and assumes

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 20:19:45 PDT 2017


Is there a reason not to hoist both the guard and the load?
(I really don't know what's legal here)

On Tue, Sep 5, 2017, 8:12 PM Max Kazantsev via Phabricator <
reviews at reviews.llvm.org> wrote:

> mkazantsev added a comment.
>
> Hi Daniel,
>
> 1. The motivating example is the following situation:
>
> `  int array[LEN];`
>
> `  void accessArray(int index) {`
> `    guard(0 <= index && index < LEN);`
> `    do_something(array[index]);`
> `  }`
>
> Here we guard on condition that our array access is within bounds,
> otherwise we reject the compiled code and deoptimize. Hoisting the array
> access to a place above the guard means that we try to access the array
> without knowing if it within the bounds or not. I will add a corresponding
> test.
>
> 2. It seems that you're right about assumes, I will remove them.
>
> 3. Ok, I will try to do it in a faster manner.
>
>
> https://reviews.llvm.org/D37460
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170906/0ef40584/attachment.html>


More information about the llvm-commits mailing list