llvm-project/llvm/lib/Transforms/IPO
Wenlei He eca03d2768 [CSSPGO] Track and use context-sensitive post-optimization function size to drive global pre-inliner in llvm-profgen
This change enables llvm-profgen to use accurate context-sensitive post-optimization function byte size as a cost proxy to drive global preinline decisions.

To do this, BinarySizeContextTracker is introduced to track function byte size under different inline context during disassembling. In preinliner, we can not query context byte size under switch `context-cost-for-preinliner`. The tracker uses a reverse trie to keep size of functions under different context (callee as parent, caller as child), and it can give best/longest possible matching context size for given input context.

The new size cost is off by default. There're a few TODOs that needs to addressed: 1) avoid dangling string from `Offset2LocStackMap`, which will be addressed in split context work; 2) using inlinee's entry probe to make sure we have correct zero size for inlinee that's completely optimized away after inlining. Some tuning is also needed.

Differential Revision: https://reviews.llvm.org/D108180
2021-08-18 22:50:57 -07:00
..
AlwaysInliner.cpp [coroutine] should disable inline before calling coro split 2020-12-08 08:53:08 -08:00
Annotation2Metadata.cpp Add pass to add !annotate metadata from @llvm.global.annotations. 2020-11-16 14:57:11 +00:00
ArgumentPromotion.cpp [NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes() 2021-08-13 11:16:52 -07:00
Attributor.cpp [NFC] More get/removeAttribute() cleanup 2021-08-17 21:05:41 -07:00
AttributorAttributes.cpp [Attributor] Do not delete volatile stores to null/undef 2021-08-12 10:39:52 -05:00
BarrierNoopPass.cpp
BlockExtractor.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
CMakeLists.txt Move Function Specialization to its correct location. NFC. 2021-06-11 15:00:10 +01:00
CalledValuePropagation.cpp
ConstantMerge.cpp [ConstantMerge] Don't merge thread_local constants with non-thread_local constants 2021-04-28 23:44:20 +01:00
CrossDSOCFI.cpp
DeadArgumentElimination.cpp [NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes() 2021-08-13 11:16:52 -07:00
ElimAvailExtern.cpp
ExtractGV.cpp [Transforms] Use range-based for loops (NFC) 2021-02-08 22:33:53 -08:00
ForceFunctionAttrs.cpp [Attributes] Determine attribute properties from TableGen data 2021-07-12 22:13:38 +02:00
FunctionAttrs.cpp [NFC] Migrate some callers away from Function/AttributeLists methods that take an index 2021-08-17 21:05:40 -07:00
FunctionImport.cpp [FunctionImport] Fix build with old mingw (NFC) 2021-08-15 15:47:59 +02:00
FunctionSpecialization.cpp [FuncSpec] Return changed if function is changed by tryToReplaceWithConstant 2021-08-06 17:00:17 +08:00
GlobalDCE.cpp
GlobalOpt.cpp [NFC] Cleanup calls to CallBase::getAttribute() 2021-08-18 09:39:33 -07:00
GlobalSplit.cpp
HotColdSplitting.cpp Calculate getTerminator only when necessary 2021-06-13 20:16:07 -07:00
IPO.cpp Function Specialization Pass 2021-06-11 09:11:29 +01:00
IROutliner.cpp [NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes() 2021-08-13 11:16:52 -07:00
InferFunctionAttrs.cpp [inferattrs] Don't infer lib func attributes for nobuiltin functions 2021-04-16 15:36:15 -07:00
InlineSimple.cpp
Inliner.cpp [llvm][Inline] Refactor out InlineOrder 2021-08-12 22:19:53 +08:00
Internalize.cpp [IR] Rename `comdat noduplicates` to `comdat nodeduplicate` 2021-07-20 12:47:10 -07:00
LoopExtractor.cpp
LowerTypeTests.cpp [LTT] Handle merged llvm.assume when dropping type tests 2021-05-25 17:02:13 -07:00
MergeFunctions.cpp [OpaquePtr] Use GlobalValue::getValueType() more 2021-07-13 09:34:34 -07:00
OpenMPOpt.cpp [OpenMP][NFC] Improve debug message for shared memory 2021-08-18 11:56:09 -04:00
PartialInlining.cpp NFC: Migrate PartialInlining to work on InstructionCost 2021-03-30 11:59:45 +01:00
PassManagerBuilder.cpp Add jump-threading optimization for deterministic finite automata 2021-07-27 14:34:04 -04:00
PruneEH.cpp [Local] Do not introduce a new `llvm.trap` before `unreachable` 2021-07-26 23:33:36 -05:00
SCCP.cpp Function Specialization Pass 2021-06-11 09:11:29 +01:00
SampleContextTracker.cpp [CSSPGO] Track and use context-sensitive post-optimization function size to drive global pre-inliner in llvm-profgen 2021-08-18 22:50:57 -07:00
SampleProfile.cpp [SampleFDO] Flow Sensitive Sample FDO (FSAFDO) profile loader 2021-08-18 18:37:35 -07:00
SampleProfileProbe.cpp [CSSPGO] Undoing the concept of dangling pseudo probe 2021-06-18 15:14:11 -07:00
StripDeadPrototypes.cpp
StripSymbols.cpp [Transforms] Use range-based for loops (NFC) 2021-02-08 22:33:53 -08:00
SyntheticCountsPropagation.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
ThinLTOBitcodeWriter.cpp [NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes() 2021-08-13 11:16:52 -07:00
WholeProgramDevirt.cpp [NFC] Replace Function handling of attributes with less confusing calls 2021-08-17 21:05:40 -07:00