Dear LLVM community
I’m a novice in compiler principles and optimization, I’m currently working with some example code to see what && how LLVM optimization is doing to generate good machine code. While working I find some functions are being inlined by llvm and some are not, but I don’t know the internals of optimization so I can’t able to figure the reasons and rationale behind them.
For example:
struct value{
int set(){} // Function does nothing!
};
void foo () {} // Function does nothing!
void func( ) {
value obj;
obj.set();
foo();
}
Compiling with command "clang++ -O2 -std=c++11 -stdlib=libc++ -Rpass=inline name.cpp prints
only obj.set() was inlined but not foo(). I don’t understand the rationale behind this (both are empty functions right ?). Why LLVM not inlining the function “foo” ?
Could you please share some pointers (videos or blogs) which explains the design of llvm optimizations . And also what is mean by
Next,
Clang documentation (here) mentions that -Wambiguous-member-template warning is defaulted to on. But when I actually compile the same code as in documentation it doesn’t throw up any warnings. Is the documentation is out-dated for clang 8.0.0 ?
Software details :
Clang 8.0.0 , Linux mint.
Hardware details:
X86-64 bit.
Could you please share your knowledge for the above questions ? it is a great help to me
Thank you very much for your time,
PreeJackie