[llvm-dev] Hoisting in the presence of volatile loads.
Krzysztof Parzyszek via llvm-dev
llvm-dev at lists.llvm.org
Wed Dec 20 05:33:04 PST 2017
Hi Alina,
The testcase was inspired by a situation that a customer reported to us
a while back.
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.
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.
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.
-Krzysztof
On 12/19/2017 7:14 PM, Alina Sbirlea wrote:
> Hi Krzysztof,
>
> Could I get some background info on reasoning about hoisting in the
> presence of volatile loads?
> I was looking at this testcase: test/Transforms/LICM/volatile-alias.ll
>
> Context: MemorySSA treats volatile loads as defs. I'm looking to better
> understand expected behavior in the presence of volatile accesses.
> More context: https://reviews.llvm.org/D40375.
>
> Thanks in advance,
> Alina
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list