[PATCH] D79967: Fix debug info for NoDebug attr

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 14 20:07:08 PDT 2020


yaxunl added a comment.

In D79967#2037675 <https://reviews.llvm.org/D79967#2037675>, @dblaikie wrote:

> I'm not quite following the test case - could you explain how it's testing the situation?
>
> It might be better/easier to have a more intentional test - also, could you check the commit history for this declaration-emitting functionality (CGDebugInfo::EmitFunctionDecl when used for a non-member function) & pull them into this review too?


This patch is a follow up of https://reviews.llvm.org/D79866, where we marked a compiler generated stub function with NoDebug attribute to eliminate debug info for it. Then we found there is a bug causing debug info not fully eliminated for a function with NoDebug attribute when the function is inlined, therefore I created this patch.

The bug can be demonstrated by

https://godbolt.org/z/z_tA3Z

There is debug info with function foo, which should not. If you change -O3 to -O0, the debug info on function foo disappears, which is the expected behavior.

The following code is supposed to eliminate all debug info for functions with NoDebugAttr, however it is not sufficient when the function gets inlined:

https://github.com/llvm/llvm-project/blob/dad2e92eaf531500af5ab9ee3350e3e186944185/clang/lib/CodeGen/CodeGenFunction.cpp#L1272

I can add a lit test for a function with NoDebugAttr.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79967/new/

https://reviews.llvm.org/D79967





More information about the cfe-commits mailing list