[PATCH] D28147: [LICM] Allow promotion of some stores that are not guaranteed to execute

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 12:34:37 PST 2017


efriedma resigned from this revision.
efriedma removed a reviewer: efriedma.
efriedma added inline comments.


================
Comment at: test/Transforms/LICM/scalar_promote.ll:222
+  ret i32 %ret
+}
+
----------------
efriedma wrote:
> efriedma wrote:
> > I'm pretty sure this transform is wrong.  For example, `@capture` could create a mutex protecting `%local`, and lock it.  Then `@opaque` could release the mutex, does some work, and lock the mutex.  In that case, the value stored by `store i32 %x2, i32* %local` is visible to other threads in each iteration, so you can't sink the store out of the loop.
> Err, my example is overly complicated.  You don't need multiple threads.  The address of `%local` escapes, therefore `@opaque` could read it, therefore we have to update it every iteration of the loop.
Err, sorry, ignore me, didn't notice the argmemonly annotation on `@opaque`.  I need to think a bit.


https://reviews.llvm.org/D28147





More information about the llvm-commits mailing list