[llvm-dev] RFC: Adding IR Transformation examples/tutorial code to llvm-project

Florian Hahn via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 4 12:50:58 PST 2019

Thanks for the great comments so far.

My understanding from the comments is that people generally think that adding IR transformation examples to llvm/examples is valuable.

Unless there are remaining high-level concerns, I’d suggest to discuss the details as part of https://reviews.llvm.org/D69416 and iterate on the examples once they are in-tree.


> On Oct 25, 2019, at 01:46, Florian Hahn via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> Hi,
> I’d like to propose adding a new example directory (llvm/examples/IRTransforms) as a new home for example code used by various tutorials. After talking to a few people at the Developers meeting, it became clear to me that it would be valuable to have the code examples for various tutorials in-tree to keep them from bit-rotting and make it very easy to build them.
> I’d suggest adding new IR pass examples to llvm/examples/IRTransforms. The passes in that directory will be built as an ExamplesIRTransforms library, which exposes initializeExampleIRTransforms to initialise the passes. Additionally, if LLVM_BUILD_EXAMPLES=On, we add a  -DBUILD_EXAMPLES define, which is then used in opt to make the example passes available if LLVM_BUILD_EXAMPLES=On. I think that allows for relatively friction-less integration of the example passes into `opt`.
> I’ve put up a patch doing exactly that: https://reviews.llvm.org/D69416 and added a few reviewers, but please join in if you have any thoughts!
> Please let me know if you have any concerns or suggestions to improve the CMake setup & co.
> As initial example, it contains the code we used for the IR transformations in the 'Getting Started With LLVM: Basics’ tutorial.
> I think there were other tutorials with examples that would be great to have there, like 'Writing Loop Optimizations in LLVM’.
> As a second step, to make those examples even more valuable, it would be great to provide an accompanying text version of the tutorials. But I would suggest we start with adding the code, which we already have.
> Cheers,
> Florian
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list