<div dir="ltr">Daniel,<div>Thanks a lot for the pointer, that's very helpful! I'll use that as a guide to update how we handle volatile accesses.<br></div><div>Mind if I ask for feedback when I update the patch?</div><div><br></div><div><span style="font-size:12.8px">Krzysztof,</span><br></div><div><span style="font-size:12.8px">Thanks for the answer, that was very informative! I appreciate it!</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Best,</span></div><div><span style="font-size:12.8px">Alina</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 20, 2017 at 5:33 AM, Krzysztof Parzyszek <span dir="ltr"><<a href="mailto:kparzysz@codeaurora.org" target="_blank">kparzysz@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alina,<br>
The testcase was inspired by a situation that a customer reported to us a while back.<br>
There was a function taking two pointers, one was used to load something from device-mapped memory (volatile), while the other was accessing regular memory.  These two pointers were aliased (in LLVM), but not because they were proven to alias, but because they weren't proved to be different.<br>
However, according to the C rules, accessing a volatile object through a non-volatile pointer results in an undefined behavior, so we could have assumed that the program was well-formed and thus that the pointers didn't alias after all.<br>
In the end, what was important was that the loop was running as fast as possible, and any invariant code should have been moved out of it.  The non-volatile load was not (because of how AliasSetTracker was treating volatile loads), and the customer reported it to us as a missed performance opportunity.<br>
<br>
-Krzysztof<div class="HOEnZb"><div class="h5"><br>
<br>
On 12/19/2017 7:14 PM, Alina Sbirlea wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Krzysztof,<br>
<br>
Could I get some background info on reasoning about hoisting in the presence of volatile loads?<br>
I was looking at this testcase: test/Transforms/LICM/volatile-<wbr>alias.ll<br>
<br>
Context: MemorySSA treats volatile loads as defs. I'm looking to better understand expected behavior in the presence of volatile accesses.<br>
More context: <a href="https://reviews.llvm.org/D40375" rel="noreferrer" target="_blank">https://reviews.llvm.org/D4037<wbr>5</a>.<br>
<br>
Thanks in advance,<br>
Alina<br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<br>
</font></span></blockquote></div><br></div>