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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 20:12:03 PDT 2017


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





More information about the llvm-commits mailing list