[llvm-dev] Informing transformation passes of non-concurrent memory accesses

Philip Pfaffe via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 14 04:22:59 PDT 2017


Hi Andreas,

2017-03-14 11:56 GMT+01:00 Andreas Scherman via llvm-dev <
llvm-dev at lists.llvm.org>:

> The example in the docs[1] states that the LLVM concurrency model does not
> allow the hoisting of loads and introduction of local variables due to
> another thread potentially altering the value whilst running the function.
>
As a possible clarification: The optimization restriction you cite only
applies to stores to possibly shared variables. Speculative loads are legal.

In the example in the docs, the offending bit is not loading x into a local
variable xtemp, but unconditionally storing xtemp back into x. Emphasis on
`unconditionally`. I.e., if it weren't for the `if (a[i])` in the original
piece of code, the transformation would be legal!

Best,
Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170314/63114eb7/attachment.html>


More information about the llvm-dev mailing list