[PATCH] D12913: Fixed debug info emitting for imported entity defined directly in a function scope.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 13:07:00 PDT 2015


On Tue, Sep 29, 2015 at 7:43 AM, Amjad Aboud via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> aaboud marked an inline comment as done.
>
> ================
> Comment at: test/DebugInfo/imported_entities.ll:12
> @@ +11,3 @@
> +;; This test was generated by running following command:
> +;; clang -cc1 -O0 -g -emit-llvm test.cpp -o - | opt -S -inline -sroa
> +;; Where test.cpp
> ----------------
> dblaikie wrote:
> > Why do you need SROA here?
> It makes the LLVM IR simpler by removing the "lifetime" intrinsic that is
> added by the "-inline" pass.
> Other than that it is not needed.
>
> Anyway, once I use the "always_inline" attribute you suggested, there is
> no need for "-inline" nor "-soa" passes.
>
> ================
> Comment at: test/DebugInfo/imported_entities.ll:19
> @@ +18,3 @@
> +;;
> +;;static inline int foo(bool b) {
> +;;  using namespace NameSpace;
> ----------------
> dblaikie wrote:
> > I usually write these tests by using __attribute__((always_inline)) then
> even at -O0 clang will run LLVM's AlwaysInliner and inline this, rather
> than relying on the normal inliner choosing to inline the function.
> Turned to be a better way to write the test.
> I just needed to keep the static, so clang can get rid of the inlined
> function once it inline it.
>

Hmm, that shouldn't be necessary - in C++ an inline function, once inlined
into all the call sites, should be removed/omitted entirely by the
optimizers, even at -O0. Oh, so long as the function is marked inline - so
inline or static would be needed (in addition to the always_inline
attribute, in either case), not both. I usually use inline, but I'm not
especially wedded to it or anything.


>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D12913
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150929/2f7393fe/attachment.html>


More information about the llvm-commits mailing list