Prevent inline
Does anyone know a trick or official means to prevent a function from being inlined?
Any ugly trick would be fine.
6 Replies
Does Mojo inline functions by default? The Mojo compiler has always been taunted as simple because it doesn't do all this compiler magic unless you explicitly tell it to.
One of the mayor selling point (for me) is that Mojo does the most imaginable optimizations currently available. compiling C++ to MLIR and lowering all the way back to assembly is neat, but the first step C++ to MLIR will loose many intentions a C++ programmer may have had. Mojo is (for me) a nice MLIR syntax. As a result the "compiler magic" is maximal.
That also means that almost everything get inlined... which may not be what you need when debugging stuff...
@always_inline | Mojo Dojo
Learning Resources for Mojo 🔥
I see. Basically we need a decorator that says "don't inline".
you can add -0O (that’s a zero then a capital O) to mojo build to prevent inlining
stands for zero optimizations
Ah, nice