Is there a reason not to hoist both the guard and the load?<div>(I really don't know what's legal here)<br><div dir="auto"><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 5, 2017, 8:12 PM Max Kazantsev via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">mkazantsev added a comment.<br>
<br>
Hi Daniel,<br>
<br>
1. The motivating example is the following situation:<br>
<br>
`  int array[LEN];`<br>
<br>
`  void accessArray(int index) {`<br>
`    guard(0 <= index && index < LEN);`<br>
`    do_something(array[index]);`<br>
`  }`<br>
<br>
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.<br>
<br>
2. It seems that you're right about assumes, I will remove them.<br>
<br>
3. Ok, I will try to do it in a faster manner.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D37460" rel="noreferrer" target="_blank">https://reviews.llvm.org/D37460</a><br>
<br>
<br>
<br>
</blockquote></div></div></div>