[LLVMdev] Design question about a fence elimination algorithm

JF Bastien jfb at google.com
Sat Aug 30 09:35:30 PDT 2014


>
> 2) Another possibility is to have the ExpandAtomicPass keep a vector of
> the places where it currently calls emitLeading/TrailingFence, and give it
> at the end of runOnFunction to another target hook. The target could then
> do the fence elimination/insertion, having all the information present.
> Code could be shared between the targets in the same way as above through
> helper functions.
> Drawback: I suspect it might be a bit involved to keep a vector of
> insertion points in a function while mutating the control-flow of the
> function. Is there any simple way of doing that without a risk of
> invalidation ?
>

One thing we didn't discuss in person (kind of related to 2 here) is that
you could use metadata on each instruction.  The metadata would record the
information that the passes currently discard when lowering, and the
algorithm would have to be able to handle partial loss or duplication of
this data (say, if an instruction gets copied with or without its metadata,
and potentially deleted).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140830/f519a835/attachment.html>


More information about the llvm-dev mailing list