[PATCH] D23214: [MDA] Treat invariant.start as non-dependence

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 12:23:27 PDT 2016


I really want to say yes, but ....

1. Your argument is identical for the other intrisics right above it. None
of them touch memory in practice.
2. MDA is deliberately returning it as a Dep so that things know where the
invariants start and end (again, same with lifetime markers).
I realize this is not ideal (and in fact, sucks), but things depend on it.

3. Without this, you will enable hoisting that is not allowed, if things
use MDA to perform hoisting.

You cannot move the invariant start and end calls, and MDA saying they are
read-only will enable them to be moved.
We last tried this by saying they did not touch memory (which is correct),
and peter had to revert the set of changes that gave them "The correct
answer" because it broke on real code.

I don't think we are going to end up with different situation here.

Instead, once we have an attribute we can mark these with that says "can't
add or remove control flow dependencies", we should mark them that way.

i don't see how you can resolve the "Things rely on memdep to give them
clobbers for these and the lifetime markers" issue, without api changes.

A similar thing happens, BTW, with certain size accesses, where GVN relies
on memdep to return a false clobber so it can perform load widening (see
line 534).

If you want to somehow split up the API's so this makes sense, i'm not
opposed.
But i don't think you can just change the behavior :)




On Fri, Aug 5, 2016 at 11:02 AM, Anna Thomas <anna at azul.com> wrote:

> anna created this revision.
> anna added reviewers: sanjoy, reames, dberlin.
> anna added a subscriber: llvm-commits.
>
> Currently invariant.start intrinsic is treated as modifying memory. This
> patch changes invariant.start to be treated as read-only memory operation
> by MDA.
> This inturn helps passes such as GVN and memcpy optimizations to treat
> invariant.start as non-clobbering.
>
> https://reviews.llvm.org/D23214
>
> Files:
>   lib/Analysis/MemoryDependenceAnalysis.cpp
>   test/Transforms/DeadStoreElimination/invariant.start.ll
>   test/Transforms/GVN/invariant.start.ll
>   test/Transforms/MemCpyOpt/invariant.start.ll
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/282475c6/attachment.html>


More information about the llvm-commits mailing list