[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:32:28 PST 2017


efriedma added inline comments.


================
Comment at: test/Transforms/LICM/scalar_promote.ll:222
+  ret i32 %ret
+}
+
----------------
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.


https://reviews.llvm.org/D28147





More information about the llvm-commits mailing list