]> granicus.if.org Git - llvm/commit
[LICM] Disallow sinking of unordered atomic loads into loops
authorMax Kazantsev <max.kazantsev@azul.com>
Wed, 11 Oct 2017 07:26:45 +0000 (07:26 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Wed, 11 Oct 2017 07:26:45 +0000 (07:26 +0000)
commitffec7873dea657797899ee5b4ec3b65f8d683c8e
tree6ec14cba36c2f74367939f846d7ea3635f5c62b5
parent168a8230000ecfefaba6511adea04f1c3eacfc8a
[LICM] Disallow sinking of unordered atomic loads into loops

Sinking of unordered atomic load into loop must be disallowed because it turns
a single load into multiple loads. The relevant section of the documentation
is: http://llvm.org/docs/Atomics.html#unordered, specifically the Notes for
Optimizers section. Here is the full text of this section:

> Notes for optimizers
> In terms of the optimizer, this **prohibits any transformation that
> transforms a single load into multiple loads**, transforms a store into
> multiple stores, narrows a store, or stores a value which would not be
> stored otherwise. Some examples of unsafe optimizations are narrowing
> an assignment into a bitfield, rematerializing a load, and turning loads
> and stores into a memcpy call. Reordering unordered operations is safe,
> though, and optimizers should take advantage of that because unordered
> operations are common in languages that need them.

Patch by Daniil Suchkov!

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D38392

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315438 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/loopsink.ll