Inlined callsites need to be emitted in debug info so that sample profile can be annotated to the correct inlined instance.
Details
Diff Detail
Event Timeline
test/DebugInfo/Generic/discriminator.ll | ||
---|---|---|
11 | perhaps write these with attribute((always_inline)) so you can build the example without running the full optimization pipeline & still get the desired code. Do you need two different inline functions or two different destination functions? (maybe it makes the example simpler/more obvious, which is fair - but it could just be two of the same) | |
14 | I assume this function doesn't need a parameter |
btw, there's no need to file a bug as you're providing a fix - feel free to
skip the overhead and just provide the patch & skip the bug
The only real reason to file a bug in the open source tracker is if you
want someone else to look at/work on it/know you are working on it before
you've sent out a patch, etc.
It gives a warning:
a.cc:2:34: warning: GCC does not allow 'always_inline' attribute in this position on a function definition [-Wgcc-compat]
FYI, the debug info size impact for this change: clang-3.8 binary (built by clang itself in release mode with -g) increases from 1117.1MB to 1118.7MB (0.14% increase)
The one thing I don't understand about this patch is why it needs to add a new DW_*discriminator flag? But I don't know enough DWARF to decide whether using the existing flag is OK or not.
Also, this is a final codegen issue? That is, the actual AddDiscriminators pass is DTRT?
Couple of minor fixes/improvements, but looks right enough - commit when ready.
lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | ||
---|---|---|
442 | Drop {} around a single-line block (the idiomatic/prevailing style in the LLVM project, though I don't think we have it written in the style guide) | |
test/DebugInfo/Generic/discriminator.ll | ||
11 | Switch the attribute earlier and you can do this without the separate declaration: static void __attribute__((always_inline)) bar() { xyz(); } | |
16 | CHECK could be a bit more detailed - I'm guessing the first inlined subroutine doesn't need a discriminator, and the second does? Something like: CHECK: DW_TAG_inlined_subroutine CHECK-NOT: DW_AT_discriminator CHECK: DW_TAG_inlined_subroutine CHECK-NOT: {{DW_TAG|NULL}} CHECK: DW_AT_discriminator 1 |
Drop {} around a single-line block (the idiomatic/prevailing style in the LLVM project, though I don't think we have it written in the style guide)