Open llvmbot opened 8 years ago
mentioned in issue llvm/llvm-project#30616
The implementation of -fprofile-sample-use tells the driver to enable LOC tracking, we also need to track inline activity. For reference, the original patch is http://reviews.llvm.org/D5888.
To track inlines, we'll need the debug code generator to also emit inline information.
The inline stack is still not maintained correctly in this bug. Here is how to reproduce:
Printing analysis 'Branch Probability Analysis' for function '_Z3foov': ---- Branch Probabilities ---- edge entry -> if.then.i probability is 0x50000000 / 0x80000000 = 62.50% edge entry -> if.else.i probability is 0x30000000 / 0x80000000 = 37.50% edge if.then.i -> _ZL3barv.exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] edge if.else.i -> _ZL3barv.exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] Printing analysis 'Branch Probability Analysis' for function '_ZL3barv': ---- Branch Probabilities ---- edge entry -> if.then probability is 0x50000000 / 0x80000000 = 62.50% edge entry -> if.else probability is 0x30000000 / 0x80000000 = 37.50% edge if.then -> if.end probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] edge if.else -> if.end probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
Printing analysis 'Branch Probability Analysis' for function '_Z3foov': ---- Branch Probabilities ---- edge entry -> if.then.i probability is 0x00000000 / 0x80000000 = 0.00% edge entry -> if.else.i probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] edge if.then.i -> _ZL3barv.exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] edge if.else.i -> _ZL3barv.exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] Printing analysis 'Branch Probability Analysis' for function '_ZL3barv': ---- Branch Probabilities ---- edge entry -> if.then probability is 0x50000000 / 0x80000000 = 62.50% edge entry -> if.else probability is 0x30000000 / 0x80000000 = 37.50% edge if.then -> if.end probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] edge if.else -> if.end probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
With and without "-g", branch-probability gives different branch probability estimation for _Z3foov.
If -fprofile-sample-use is specified, clang will set CodeGenOptions::LocTrackingOnly and make the FE emit debug info. However, as the debug info is not emitted in the final binary, there are several issues that prevents the debug info from being updated correctly:
- The discriminator will not be applied due to !hasDebugInfo(F) check
- Inline stack is not maintained during function inlining
In general, we need frontend to pass down a parameter to let backend optimization know that debug info still needs to be maintained.
It sounds like this can be one of the main source of performance loss for sample fdo.
Yes. The testing I've been doing so far has used -g in both the gen and the use binaries, however.
The trick of not emitting the debug info marker is used to get the code generator not to emit debug info. The bug is using the same hasDebugInfo() function in the discriminator assignment. That pass should dig past that. I'll take a look.
If -fprofile-sample-use is specified, clang will set CodeGenOptions::LocTrackingOnly and make the FE emit debug info. However, as the debug info is not emitted in the final binary, there are several issues that prevents the debug info from being updated correctly:
- The discriminator will not be applied due to !hasDebugInfo(F) check
- Inline stack is not maintained during function inlining
In general, we need frontend to pass down a parameter to let backend optimization know that debug info still needs to be maintained.
It sounds like this can be one of the main source of performance loss for sample fdo.
assigned to @dnovillo
Extended Description
If -fprofile-sample-use is specified, clang will set CodeGenOptions::LocTrackingOnly and make the FE emit debug info. However, as the debug info is not emitted in the final binary, there are several issues that prevents the debug info from being updated correctly:
In general, we need frontend to pass down a parameter to let backend optimization know that debug info still needs to be maintained.