[PATCH] D38392: Disallow sinking of unordered atomic loads into loops

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 15:46:01 PDT 2017


reames added a comment.

In https://reviews.llvm.org/D38392#884816, @danielcdh wrote:

> In the following example:
>
> while(true) {
>
>   a1 = foo();
>   bar(a1);
>   while(true) {
>     if (baz())
>       return atomic_load(a1);
>   }
>
> }
>
> The atomic_load(a1) will be executed once without hoisting. But with LICM, it may be called multiple times.


I can't make out your example enough to assess what you're intent is.  As a general comment, keep in mind that *loading* multiple times is not a problem if only one of them is *used*.


https://reviews.llvm.org/D38392





More information about the llvm-commits mailing list