<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
 - Loads can be moved across may-throw instructions; it's only may-write<br>
   instructions that must be a barrier.<br>
<br></blockquote><div><br></div><div><br>This is not correct, at least as LLVM defines may-throw.</div><div><br></div><div>If you hoist above a may-throw, and it throws, you may have caused a pointer dereference to occur that would not have not occurred.</div><div><br></div><div>We disallow hoisting in mergedloadstoremotion, etc for similar reasons.</div><div><br></div><div>This is regardless of whether they read or write the memory in question.</div><div><br></div><div>IE</div><div><br></div><div>void foo() {</div><div>store of D;</div><div>if (i feel like it)<br>  throw()</div><div>}<br></div><div><br></div><div>int bar() {</div><div>foo()</div><div>load of A;</div><div>}</div><div><br></div><div>You will have made the dereference of A happen when it would not necessarily have happened before.</div><div><br></div><div><br></div><div>(Andy Trick correctly pointed out we could treat the throwing as reading/writing unknown memory, but doing so would destroy a lot of other nice aliasing properties, and propagate info that is probably "too conservative")</div></div></div></div>