[llvm-dev] Intro to the architecture of LLVM

121 views
Skip to first unread message

Nick Desaulniers via llvm-dev

unread,
Aug 11, 2020, 4:53:42 PM8/11/20
to llvm-dev
Sharing a link to a presentation I gave recently on the basics of
working with LLVM: https://youtu.be/bUTXhcf_aNc.

I have an extended+modified version of this talk I'm preparing for
LLVM dev conf.
--
Thanks,
~Nick Desaulniers
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Stefanos Baziotis via llvm-dev

unread,
Aug 31, 2020, 5:17:29 PM8/31/20
to Nick Desaulniers, llvm-dev
Hi Nick,

Sorry for the late reply. Here are some thoughts that may be useful to you:

1) You might want to see if there's any overlap with previous similar talks. I think there may be some with these two:
- Introduction to LLVM:  https://www.youtube.com/watch?v=J5xExRGaIIY
- Introduction to Clang:  https://www.youtube.com/watch?v=5kkMpJpIGYU

In the same spirit, at the end it would be good if you put other similar talks that people can watch tii. Apart from the
two already mentioned, also:
- The Clang AST Tutorial:  https://www.youtube.com/watch?v=VqCkCDFLSsc
- LLVM IR Tutorial:  https://www.youtube.com/watch?v=m8G_S5LwlTo
-  Writing an LLVM Pass 101: https://www.youtube.com/watch?v=ar7cJl2aBuU
  This is for the new pass manager, one can also see the doc for the old one:  https://llvm.org/docs/WritingAnLLVMPass.html
- Getting Started with LLVM: Basics:  https://www.youtube.com/watch?v=3QQuhL-dSys
- How to Contribute to LLVM:  https://www.youtube.com/watch?v=C5Y977rLqpw
- LLVM: A Modern, Open C++ Toolchain:  https://www.youtube.com/watch?v=uZI_Qla4pNA
- Understanding Compiler Optimization:  https://www.youtube.com/watch?v=FnGCDLhaxKU
- Hybrid Data Structures:  https://www.youtube.com/watch?v=vElZc6zSIXM (Mentions a lot about LLVM's internal DS)
... (here basically you can just say: "Any talk by Chandler Carruth" :p )
- Register Allocation: More than Coloring:  https://www.youtube.com/watch?v=IK8TMJf3G6U
- Address Spaces in LLVM:  https://www.youtube.com/watch?v=Oj1BNoL1jpM
- Scalar Evolution - Demystified:  https://www.youtube.com/watch?v=AmjliNp0_00

You might think that the last 3-4 are maybe too specific but actually the DS, Address Spaces and Scalar Evolution are almost
everywhere (the DS are truly everywhere). And register allocation is considered by a lot the most important
optimization. The ones that don't agree with that, probably think that inlining is the most important. But sadly
we don't have a tutorial that explains LLVM's inlining.

Finally, note that even having a single slide with these is helpful because I remember myself as a beginner. I found
those after a lot of time searching and some of them by luck. It would be good to have a slide "Start with these".

2) Around 25:06: You can mention Polly's create_ll.sh file:  https://github.com/llvm/llvm-project/blob/master/polly/test/create_ll.sh 
For the Clang part, you can get even less stuff in the emitted IR with this: clang -c -S -emit-llvm -g0 -Xclang -disable-O0-optnone

3) In the example that you show on the video, we can't actually use memcpy(). It's nitpicking and maybe you actually
mentioned it and I missed it but we can't because mempcy() copies only one byte across a buffer. It can't copy
e.g. an int that is 4 bytes.

4) Regarding Canonical Loop Forms in LLVM: There are really more than one loop canonical forms in LLVM
but if we had to say there is one, I guess that would be the Loop Simplify Form. You can read more
about loop forms and generally loops in the loop terminology:  https://llvm.org/docs/LoopTerminology.html 
(You can also tell me if there's something unclear there because I would be one of the first candidates to fix it :) ).

Cheers,
Stefanos
Reply all
Reply to author
Forward
0 new messages