[PATCH] D62766: [Attributor] Deduce "nosync" function attribute.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 17:15:36 PDT 2019


jdoerfert requested changes to this revision.
jdoerfert added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/docs/LangRef.rst:1476-1478
+    This function attribute indicates that the function does not communicate
+    (synchronize) with another thread. If the function does ever synchronize 
+    with another thread, the behavior is undefined.
----------------
arsenm wrote:
> arsenm wrote:
> > I think this is a bit vague. In particular I don't think the LangRef defines what a "thread" means anywhere. I also think this needs to be more clear on what kinds of synchronization is allowed. Is this only communication through some addressable memory? What about GPU cross lane communication operations?
> > 
> > I'm wondering if this is sufficient to solve this problem: http://lists.llvm.org/pipermail/llvm-dev/2013-November/067359.html
> > TLDR, memory instructions can currently be hoisted over an arbitrary call if they are accessing a noalias argument
> This is also mentioned as a proper attribute here (which I would greatly prefer to adding another string attribute), but only handled as a string attribute
That is a good point. I was initially thinking string attributes are fine but D62784 seems to be stuck which makes the testing of them hard.

Long story short, lets make them enum attributes.

@sstefan1 could you please make this a proper enum attribute? This will require some additional "mechanics" in:
`llvm/lib/AsmParser/LLParser.cpp`
`llvm/lib/Bitcode/Reader/BitcodeReader.cpp`
`llvm/lib/Bitcode/Writer/BitcodeWriter.cpp`
`llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp`
`llvm/lib/IR/Attributes.cpp`
`llvm/lib/IR/Verifier.cpp`

Could be more though. Look for an existing attribute, e.g. Cold, and how that is handled.


@uenoku Could you please also make `nofree` an enum attribute?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62766/new/

https://reviews.llvm.org/D62766





More information about the llvm-commits mailing list