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

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 16:31:49 PDT 2016


Uploading a new version of the patch.  Thanks again for noticing this, Danny.

On Tue, Jul 19, 2016 at 4:13 PM, Daniel Berlin <dberlin at dberlin.org> wrote:
>>
>>  - 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")


More information about the llvm-commits mailing list