[PATCH] D22547: [LSV] Don't move stores across may-load instrs, and loosen restrictions on moving loads.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 16:13:15 PDT 2016


>
>
>  - Loads can be moved across may-throw instructions; it's only may-write
>    instructions that must be a barrier.
>
>

This is not correct, at least as LLVM defines may-throw.

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.

We disallow hoisting in mergedloadstoremotion, etc for similar reasons.

This is regardless of whether they read or write the memory in question.

IE

void foo() {
store of D;
if (i feel like it)
  throw()
}

int bar() {
foo()
load of A;
}

You will have made the dereference of A happen when it would not
necessarily have happened before.


(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")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/c30bb8a6/attachment.html>


More information about the llvm-commits mailing list