llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29k stars 11.95k forks source link

Clearly define a category of opaque global attachments #31107

Open pcc opened 7 years ago

pcc commented 7 years ago
Bugzilla Link 31759
Version trunk
OS Linux
CC @joker-eph,@LebedevRI

Extended Description

We currently have two global metadata attachment types (!type and !absolute_symbol) which are semantically significant for correctness. We should clearly define a category of opaque global attachments (akin to metadata attachments on instructions) and make it possible to

  1. copy information from one global to another
  2. drop all the opaque attachments

in a straightforward manner without breaking semantics. If that category includes all metadata attachments, we would need to decide on some other representation for !type and !absolute_symbol.

See also discussion on https://reviews.llvm.org/D29110

pcc commented 7 years ago

Another thing that needs to be defined clearly is how to transform these attachments when downgrading a definition to a declaration. We need to do this consistently in the IRLinker, CloneModule and filterModule (in ThinLTOBitcodeWriter). That I suspect is the root cause of this bug:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170123/423354.html