[PATCH] D25132: Invoke add-discriminator at -g0 -fsample-profile

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 14:30:39 PDT 2016


danielcdh added inline comments.


> probinson wrote in AddDiscriminators.cpp:165
> What happens if you specify -fsample-profile -gdwarf-3?  Do you get a DWARF 4 line table with discriminators even though you said you wanted DWARF 3?  I don't think that's a great idea.
> I think it's fine to emit a DWARF 4 line table with discriminators if you see -fsample-profile and no debug info (-g0 or no -g at all), but if somebody asked for DWARF 2 or 3 then you should respect that.
> If you want to tell the user that -fsample-profile requires DWARF 4, you should do that in the Clang driver, not simply override their choice here.

I agree that discriminator should *not* be emitted when user specifies -gdwarf-3. But user should still be able to use -fsample-profile if they add -gdwarf-3. How about we assign discriminator early (kind of like canonicalization). But when generating code, we only emit discriminator when dwarf version is >= 4?

I've updated the patch to reflect the change.

https://reviews.llvm.org/D25132





More information about the llvm-commits mailing list