[LLVMdev] Plan to optimize atomics in LLVM

Tim Northover t.p.northover at gmail.com
Fri Aug 8 12:42:45 PDT 2014


Hi Robin,

> But currently there is lots of
> code duplication, for example RMWs are lowered into monotonic operations +
> fences in ExpandLoadLinked (as we just saw), and load/stores are lowered
> into monotonic operations + fences in SelectionDAGBuilder.. I hope to share
> some code between those by pushing things into a common ExpandAtomicsPass.

I've not had time to think about your examples yet (I will!), but
thought I should comment on the history behind this one anyway.

Until very recently SelectionDAG was the only place that did this kind
of transformation. I added ExpandLoadLinked to give a neater route
(primarily for ARM, as you've noticed). But we still had to leave the
legacy path in place for the other architectures.

I'd love to see them do things before SDAG (if nothing else, we have a
long-term goal to nuke the DAG; but I also think it's a much neater
solution anyway). But I didn't have time to port all of the existing
backends, so we ended up with the duplication you're seeing.

I do like the direction you're suggesting here though. The more we can
move out of SelectionDAG, the less we have to port to GlobalISel when
it finally gets here.

Cheers.

Tim.



More information about the llvm-dev mailing list