llvm-project/llvm/lib/IR
wlei 47b0758049 [SampleFDO] Persist profile staleness metrics into binary
With https://reviews.llvm.org/D136627, now we have the metrics for profile staleness based on profile statistics, monitoring the profile staleness in real-time can help user quickly identify performance issues. For a production scenario, the build is usually incremental and if we want the real-time metrics, we should store/cache all the old object's metrics somewhere and pull them in a post-build time. To make it more convenient, this patch add an option to persist them into the object binary, the metrics can be reported right away by decoding the binary rather than polling the previous stdout/stderrs from a cache system.

For implementation, it writes the statistics first into a new metadata section(llvm.stats) then encode into a special ELF `.llvm_stats` section. The section data is formatted as a list of key/value pair so that future statistics can be easily extended. This is also under a new switch(`-persist-profile-staleness`)

In terms of size overhead, the metrics are computed at module level, so the size overhead should be small, measured on one of our internal service, it costs less than < 1MB for a 10GB+ binary.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D136698
2022-11-09 22:34:33 -08:00
..
AbstractCallSite.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
AsmWriter.cpp [Assignment Tracking][3/*] Add DIAssignID metadata boilerplate 2022-11-07 09:05:56 +00:00
Assumptions.cpp [Attributor][OpenMP] Add assumption for non-call assembly instructions 2022-03-28 20:57:52 -05:00
AttributeImpl.h [Attributes] Add additional MemoryEffects APIs (NFC) 2022-10-31 10:44:51 +01:00
Attributes.cpp [Attributes] Add additional MemoryEffects APIs (NFC) 2022-10-31 10:44:51 +01:00
AutoUpgrade.cpp [RISCV] Adjust RV64I data layout by using n32:64 in layout string 2022-10-28 08:27:03 -07:00
BasicBlock.cpp Fix iterator corruption in splitBasicBlockBefore 2022-10-27 17:54:15 +07:00
BuiltinGCs.cpp [llvm] Fix comment typos (NFC) 2022-08-07 00:16:14 -07:00
CMakeLists.txt [IR] Move support for dxil::TypedPointerType to LLVM core IR. 2022-08-04 10:41:11 -04:00
Comdat.cpp
ConstantFold.cpp ConstantFold: Reduce code duplication for checking commuted compare 2022-10-26 10:59:58 -07:00
ConstantRange.cpp [ConstantRange] Fix sdiv() with one bit values (PR56333) 2022-07-01 15:44:59 +02:00
Constants.cpp [IR][InstCombine] Support scalable vector splats ConstantExprs in Constant::getUniqueInteger(). 2022-09-26 14:55:15 -07:00
ConstantsContext.h [ConstantExpr] Remove fneg expression 2022-09-08 10:24:55 +02:00
Core.cpp [llvm-c] Harmonize usage of unwrap (NFC) 2022-11-01 22:52:23 +01:00
DIBuilder.cpp [Assignment Tracking][6/*] Add trackAssignments function 2022-11-08 16:52:11 +00:00
DataLayout.cpp
DebugInfo.cpp Fix an unused-variable warning in release build, NFC. 2022-11-09 13:03:39 +01:00
DebugInfoMetadata.cpp [Assignment Tracking][3/*] Add DIAssignID metadata boilerplate 2022-11-07 09:05:56 +00:00
DebugLoc.cpp
DiagnosticHandler.cpp Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options 2022-06-05 01:07:51 -07:00
DiagnosticInfo.cpp DiagnosticInfo: Report function location for resource limits 2022-10-28 21:42:57 -07:00
DiagnosticPrinter.cpp
Dominators.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
FPEnv.cpp Remove redundant initialization of Optional (NFC) 2022-08-20 21:18:28 -07:00
Function.cpp [IR] Switch everything to use memory attribute 2022-11-04 10:21:38 +01:00
GCStrategy.cpp [IR] Fixed ambiguous call to llvm::report_fatal_error 2022-07-23 16:28:18 +02:00
GVMaterializer.cpp
Globals.cpp [Globals] Treat nobuiltin fns as maybe-derefined. 2022-08-23 13:45:10 +01:00
IRBuilder.cpp [IRBuilder] Use PoisonValue in CreateMasked* 2022-09-19 11:01:41 -07:00
IRPrintingPasses.cpp
InlineAsm.cpp [InlineAsm][bugfix] Correct function addressing in inline asm 2022-10-14 09:47:26 +08:00
Instruction.cpp Reapply [Assignment Tracking][5/*] Add core infrastructure for instruction reference 2022-11-08 14:56:23 +00:00
Instructions.cpp [IR] Switch everything to use memory attribute 2022-11-04 10:21:38 +01:00
IntrinsicInst.cpp [Assignment Tracking][4/*] Add llvm.dbg.assign intrinsic boilerplate 2022-11-07 10:09:22 +00:00
LLVMContext.cpp KCFI sanitizer 2022-08-24 22:41:38 +00:00
LLVMContextImpl.cpp [llvm] Use value instead of getValue (NFC) 2022-07-13 23:11:56 -07:00
LLVMContextImpl.h Reapply [Assignment Tracking][5/*] Add core infrastructure for instruction reference 2022-11-08 14:56:23 +00:00
LLVMRemarkStreamer.cpp
LegacyPassManager.cpp [LegacyPassManager] Move structural hashing into Pass classes. NFC. 2022-03-17 09:51:12 +00:00
MDBuilder.cpp [SampleFDO] Persist profile staleness metrics into binary 2022-11-09 22:34:33 -08:00
Mangler.cpp [COFF] Emit embedded -exclude-symbols: directives for hidden visibility for MinGW 2022-08-11 12:00:08 +03:00
Metadata.cpp [Assignment Tracking][9/*] Don't drop DIAssignID in dropUnknownNonDebugMetadata 2022-11-09 10:49:55 +00:00
MetadataImpl.h
Module.cpp [IR] Use Min behavior for module flag "PIC Level" 2022-08-18 16:28:55 -07:00
ModuleSummaryIndex.cpp [WPD] Use new llvm.public.type.test intrinsic for potentially publicly visible classes 2022-07-26 08:01:08 -07:00
Operator.cpp
OptBisect.cpp ManagedStatic: remove many straightforward uses in llvm 2022-07-10 10:29:15 +02:00
Pass.cpp [LegacyPassManager] Move structural hashing into Pass classes. NFC. 2022-03-17 09:51:12 +00:00
PassInstrumentation.cpp
PassManager.cpp [Clang] Reimplement time tracing of NewPassManager by PassInstrumentation framework 2022-09-11 05:42:55 -07:00
PassRegistry.cpp ManagedStatic: remove many straightforward uses in llvm 2022-07-10 10:29:15 +02:00
PassTimingInfo.cpp [PassTimingInfo] Stop double (or worse) counting passes/analyses 2022-10-13 09:12:12 -07:00
PrintPasses.cpp [NewPM] Switch -filter-passes from ClassName to pass-name 2022-09-07 22:02:26 -07:00
ProfDataUtils.cpp [llvm][ir][NFC] Clean up "if after return" in ProfDataUtils.cpp 2022-08-26 20:27:39 +00:00
ProfileSummary.cpp
PseudoProbe.cpp
ReplaceConstant.cpp
SSAContext.cpp
SafepointIRVerifier.cpp freeze does not change the constant property 2022-06-14 19:53:26 +03:00
Statepoint.cpp
StructuralHash.cpp
SymbolTableListTraitsImpl.h
Type.cpp [IR] Allow typed pointers to be used in vector types 2022-10-27 15:25:17 -04:00
TypeFinder.cpp
TypedPointerType.cpp [IR] Move support for dxil::TypedPointerType to LLVM core IR. 2022-08-04 10:41:11 -04:00
Use.cpp [IR] Remove unused forward declarations (NFC) 2022-04-03 12:54:54 -07:00
User.cpp [IR] Report whether replaceUsesOfWith() changed something (NFC) 2022-05-18 11:46:28 +02:00
Value.cpp [IR] Allow typed pointers to be used in vector types 2022-10-27 15:25:17 -04:00
ValueSymbolTable.cpp
VectorBuilder.cpp [llvm] Don't use Optional::hasValue (NFC) 2022-06-25 21:42:52 -07:00
Verifier.cpp Reapply [Assignment Tracking][5/*] Add core infrastructure for instruction reference 2022-11-08 14:56:23 +00:00