Hi Dan, I am using it to store results of a vectorization analysis. A BasicBlock has certain properties in this context, e.g. we mark control flow that may never diverge in different instances ("threads" if you think in terms of CUDA) of the same function by marking the corresponding blocks. This information is later used when linearizing the function (control flow to data flow conversion). I'll be happy to give you more detail on this if you want to :). I could imagine there are other things that could make use of this, or am I wrong with that? Cheers, Ralf On 5/7/12 11:58 PM, Dan Gohman wrote:> > On May 7, 2012, at 7:21 AM, Ralf Karrenberg<Chareos at gmx.de> wrote: > >> Hi Duncan, >> >> On 5/6/12 6:12 PM, Duncan Sands wrote: >>> Hi Ralf, >>> >>>> Is there a clean way to attach metadata nodes to Arguments and/or >>>> BasicBlocks? >>> >>> not at the moment. Feel free to work on adding this functionality! >> >> I am looking into that now. >> I decided to temporarily go for the following syntax for BasicBlock >> metadata (subject to discussion): >> >> entry: >> !property_1 !0, !property_2 !1 >> %x = fadd float %a, %b >> >> It seems that I have to touch lots of files for this: >> BasicBlock.h/.cpp, Metadata.cpp, LLParser.cpp, AsmParser, AsmWriter, >> BitcodeReader.cpp, BitcodeWriter.cpp so far. >> I basically went and duplicated code that handles metadata attached to >> instructions. > > What kind of things might basic block metadata be used for? > > Dan > >
On May 7, 2012, at 11:11 PM, Ralf Karrenberg <Chareos at gmx.de> wrote:> Hi Dan, > > I am using it to store results of a vectorization analysis. A BasicBlock has certain properties in this context, e.g. we mark control flow that may never diverge in different instances ("threads" if you think in terms of CUDA) of the same function by marking the corresponding blocks. This information is later used when linearizing the function (control flow to data flow conversion). I'll be happy to give you more detail on this if you want to :).Why are you using metadata to store the results of an analysis? LLVM has infrastructure for running analysis passes and making their information available to other passes.> I could imagine there are other things that could make use of this, or am I wrong with that?There are surely many things it could be used for. Interesting questions include whether or not there are other ways to achieve those things, and whether making a basic block be something which can carry special semantics is a concept that makes sense within the rest of the system. Dan
On 5/9/12 2:01 AM, Dan Gohman wrote:> > On May 7, 2012, at 11:11 PM, Ralf Karrenberg<Chareos at gmx.de> wrote: > >> Hi Dan, >> >> I am using it to store results of a vectorization analysis. A BasicBlock has certain properties in this context, e.g. we mark control flow that may never diverge in different instances ("threads" if you think in terms of CUDA) of the same function by marking the corresponding blocks. This information is later used when linearizing the function (control flow to data flow conversion). I'll be happy to give you more detail on this if you want to :). > > Why are you using metadata to store the results of an analysis? > LLVM has infrastructure for running analysis passes and making > their information available to other passes.The analysis is only one way to supply the necessary information to the vectorizer - it could also be generated by a front-end directly. This is a very likely use-case for data-parallel languages that have specific constructs like "uniform"/"varying" (e.g. RenderMan in graphics). Metadata is the perfect thing to store this kind of information.>> I could imagine there are other things that could make use of this, or am I wrong with that? > > There are surely many things it could be used for. Interesting > questions include whether or not there are other ways to > achieve those things, and whether making a basic block be > something which can carry special semantics is a concept that > makes sense within the rest of the system.That is why I brought this up here for discussion with those of you people that know more about the implications that such functionality would have. Cheers, Ralf