The current C++0x draft section 1.10 para #9, defines a concept of (data)
dependence that is used to reason about orders of loads. Briefly, B is
dependent on A if the location of B uses data computed by A, so in
A = load X;
B = load A;
the load of B is guaranteed to happen after the load of A, for some
more or less formal definition of "happens after".
The point is, it is possible to construct cases (see N2176 for examples)
where a compiler, in the process of doing reasonable code simplifications,
may break a data-dependency chain that exists in the source code.
Somehow the compiler needs to preserve the information that one load is
formally (i.e. according to the syntactic rules of 1.10#9) data-dependent
on another - it definitely needs to know to keep the loads in order, and
it might also need to insert a barrier, and perhaps it might want to not
do the simplification in the first place (e.g. on a target model that
was not SC but did guarantee ordering of data-dependent loads).
Is it possible to represent this ordering relationship in LLVM IR?
It seems that it is necessary for correct implementation of C++ on any
memory model, even x86 - if you don't have it, then you have to fall
back to doing as a load-consume as a load-acquire (possibly with hardware
barrier) which could be far more expensive.
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.