Richard Sandiford rsandifo at
Tue Dec 10 02:41:37 PST 2013

Evan Cheng <evan.cheng at> writes:
>>> I'm not sure if I completely follow you. But if the concern is to
>>> distinguish the loads, would it be cleaner to add a property to
>>> MemSDNode? And is this property related to SynchronizationScope property
>>> that's already on MemSDNode?
>> SynchronizationScope is only defined for atomics rather than normal
>> volatile loads though.  I don't think it would make sense to "lower"
>> a volatile load to an atomic one.  For one thing (at least AIUI)
>> all atomic loads are volatile at the DAG level, so in a sense they're
>> "higher" rather than "lower" than volatile loads.  Also, it's useful to
>> allow volatile SEXTLOADs and ZEXTLOADs, which I don't think is possible
>> with atomics.
>> (FWIW I have a target-local follow-on patch for atomic loads and stores
>> and it goes the other way: lowering an atomic operation to a normal
>> volatile one once it has been properly protected.)
>> It's not really the load instruction itself that's special.  I want
>> to match the load exactly as it's matched now and just make sure that
>> a separate instruction is emitted before it in the chain.  For atomic
>> fences we do that at the IR->DAG boundary, and that seemed like the
>> cleanest place to handle this case too.
> Ok, I'm fine with the TargetLowering hook then.

Thanks Evan, committed as r196905.


More information about the llvm-commits mailing list