1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Transforms
Adam Nemet f602aa8cdd Output optimization remarks in YAML
(Re-committed after moving the template specialization under the yaml
namespace.  GCC was complaining about this.)

This allows various presentation of this data using an external tool.
This was first recommended here[1].

As an example, consider this module:

  1 int foo();
  2 int bar();
  3
  4 int baz() {
  5   return foo() + bar();
  6 }

The inliner generates these missed-optimization remarks today (the
hotness information is pulled from PGO):

  remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
  remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)

Now with -pass-remarks-output=<yaml-file>, we generate this YAML file:

  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 10 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: foo
    - String:  will not be inlined into
    - Caller: baz
  ...
  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 18 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: bar
    - String:  will not be inlined into
    - Caller: baz
  ...

This is a summary of the high-level decisions:

* There is a new streaming interface to emit optimization remarks.
E.g. for the inliner remark above:

   ORE.emit(DiagnosticInfoOptimizationRemarkMissed(
                DEBUG_TYPE, "NotInlined", &I)
            << NV("Callee", Callee) << " will not be inlined into "
            << NV("Caller", CS.getCaller()) << setIsVerbose());

NV stands for named value and allows the YAML client to process a remark
using its name (NotInlined) and the named arguments (Callee and Caller)
without parsing the text of the message.

Subsequent patches will update ORE users to use the new streaming API.

* I am using YAML I/O for writing the YAML file.  YAML I/O requires you
to specify reading and writing at once but reading is highly non-trivial
for some of the more complex LLVM types.  Since it's not clear that we
(ever) want to use LLVM to parse this YAML file, the code supports and
asserts that we're writing only.

On the other hand, I did experiment that the class hierarchy starting at
DiagnosticInfoOptimizationBase can be mapped back from YAML generated
here (see D24479).

* The YAML stream is stored in the LLVM context.

* In the example, we can probably further specify the IR value used,
i.e. print "Function" rather than "Value".

* As before hotness is computed in the analysis pass instead of
DiganosticInfo.  This avoids the layering problem since BFI is in
Analysis while DiagnosticInfo is in IR.

[1] https://reviews.llvm.org/D19678#419445

Differential Revision: https://reviews.llvm.org/D24587

llvm-svn: 282539
2016-09-27 20:55:07 +00:00
..
ADCE
AddDiscriminators Do not assign new discriminator for all intrinsics. 2016-08-05 17:56:49 +00:00
AlignmentFromAssumptions
ArgumentPromotion
AtomicExpand
BBVectorize Revert -r278267 [ValueTracking] An improvement to IR ValueTracking on Non-negative Integers 2016-08-22 13:14:07 +00:00
BDCE
BranchFolding
CodeExtractor CodeExtractor : Add ability to preserve profile data. 2016-08-02 02:15:45 +00:00
CodeGenPrepare
ConstantHoisting This implements a more optimal algorithm for selecting a base constant in 2016-07-14 07:44:20 +00:00
ConstantMerge
ConstProp Don't remove side effecting instructions due to ConstantFoldInstruction 2016-07-22 04:54:44 +00:00
Coroutines [Coroutines] Part14: Handle coroutines with no suspend points. 2016-09-26 15:49:28 +00:00
CorrelatedValuePropagation llvm/test/Transforms/CorrelatedValuePropagation/alloca.ll REQUIRES +Asserts. 2016-09-15 09:45:31 +00:00
CountingFunctionInserter Add a counter-function insertion pass 2016-09-01 09:42:39 +00:00
CrossDSOCFI [PM] Port CrossDSOCFI to the new pass manager. 2016-07-09 03:25:35 +00:00
DCE
DeadArgElim DeadArgElim: Don't mark swifterror arguments as unused 2016-09-21 15:29:08 +00:00
DeadStoreElimination [DSE] Don't remove stores made live by a call which unwinds. 2016-08-12 01:09:53 +00:00
EarlyCSE [EarlyCSE] Optionally use MemorySSA. NFC. 2016-08-31 19:24:10 +00:00
EliminateAvailableExternally
Float2Int
ForcedFunctionAttrs
FunctionAttrs [FunctionAttrs] Don't try to infer returned if it is already on an argument 2016-09-12 16:04:59 +00:00
FunctionImport [thinlto] Basic thinlto fdo heuristic 2016-09-26 20:37:32 +00:00
GCOVProfiling DebugInfo: New metadata representation for global variables. 2016-09-13 01:12:59 +00:00
GlobalDCE
GlobalMerge DebugInfo: New metadata representation for global variables. 2016-09-13 01:12:59 +00:00
GlobalOpt [GlobalOpt] Dead Eliminate declarations 2016-09-15 20:26:27 +00:00
GuardWidening
GVN GVN-hoist: move hoist testcase to GVNHoist dir 2016-09-22 14:45:46 +00:00
GVNHoist Revert r282168 "GVN-hoist: fix store past load dependence analysis (PR30216)" 2016-09-22 21:20:53 +00:00
IndVarSimplify Revert -r278269 [IndVarSimplify] Eliminate zext of a signed IV when the IV is known to be non-negative 2016-08-22 13:12:07 +00:00
InferFunctionAttrs [InferAttributes] Don't access parameters that don't exist. 2016-09-20 23:10:31 +00:00
Inline Output optimization remarks in YAML 2016-09-27 20:55:07 +00:00
InstCombine [InstCombine] Fixed bug introduced in r282237 2016-09-26 13:18:59 +00:00
InstMerge
InstSimplify [ConstantFold] Improve the bitcast folding logic for constant vectors. 2016-09-13 14:50:47 +00:00
Internalize
IPConstantProp
IRCE [IRCE] Create llvm::Loop instances for cloned out loops 2016-08-14 01:04:46 +00:00
JumpThreading [JumpThreading] Only write back branch-weight MDs for blocks that originally had PGO info 2016-09-06 16:08:33 +00:00
LCSSA Revert "Revert r275883 and r275891. They seem to cause PR28608." 2016-07-20 01:55:27 +00:00
LICM New pass manager for LICM. 2016-07-12 22:37:48 +00:00
LoadCombine
LoadStoreVectorizer Add handling of !invariant.load to PropagateMetadata. 2016-09-11 01:39:08 +00:00
LoopDataPrefetch [PM] Port LoopDataPrefetch AArch64 tests to new pass manager 2016-08-22 12:59:58 +00:00
LoopDeletion [PM] Port Dead Loop Deletion Pass to the new PM 2016-07-14 18:28:29 +00:00
LoopDistribute [BPI] Add new LazyBPI analysis 2016-07-28 23:31:12 +00:00
LoopIdiom Target independent codesize heuristics for Loop Idiom Recognition 2016-08-11 18:28:33 +00:00
LoopInterchange [LoopInterchange] Track all dependencies, not just anti dependencies. 2016-09-21 19:16:47 +00:00
LoopLoadElim [LLE] Don't hoist conditionally executed loads 2016-06-28 04:02:47 +00:00
LoopReroll [LoopReroll] Reroll loops with unordered atomic memory accesses 2016-07-19 00:23:54 +00:00
LoopRotate
LoopSimplify [LoopSimplify] Rebuild LCSSA for the inner loop after separating nested loops. 2016-08-09 22:44:56 +00:00
LoopSimplifyCFG
LoopStrengthReduce [LSR] Don't try and create post-inc expressions on non-rotated loops 2016-08-15 07:53:03 +00:00
LoopUnroll Revert "[LoopUnroll] Properly update loop-info when cloning prologues and epilogues." 2016-09-08 03:51:30 +00:00
LoopUnswitch
LoopVectorize [LV] Scalarize instructions marked scalar after vectorization 2016-09-26 17:08:37 +00:00
LoopVersioning
LoopVersioningLICM [Loop Vectorizer] Fixed memory confilict checks. 2016-08-28 08:53:53 +00:00
LowerAtomic
LowerExpectIntrinsic [Profile] handle select instruction in 'expect' lowering 2016-09-02 22:03:40 +00:00
LowerGuardIntrinsic [PM] Port LowerGuardIntrinsic to the new PM. 2016-07-28 22:08:41 +00:00
LowerInvoke [PM] Port LowerInvoke to the new pass manager 2016-08-12 17:28:27 +00:00
LowerSwitch
LowerTypeTests Revert r277556. Add -lowertypetests-bitsets-level to control bitsets generation 2016-09-27 00:29:53 +00:00
Mem2Reg
MemCpyOpt [MemCpy] Add comments for r279769 2016-08-25 21:03:46 +00:00
MergeFunc
MetaRenamer
NameAnonGlobals [ThinLTO] Ensure anonymous globals renamed even at -O0 2016-09-17 20:40:16 +00:00
NaryReassociate [PM] Port NaryReassociate to the new PM 2016-07-21 22:28:52 +00:00
ObjCARC [ObjCARC] Traverse chain downwards to replace uses of argument passed to 2016-09-13 23:43:11 +00:00
PartiallyInlineLibCalls
PGOProfile [Profile] Implement select instruction instrumentation in IR PGO 2016-09-18 18:34:07 +00:00
PhaseOrdering
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociate] Add test for PR28367. 2016-08-18 13:22:37 +00:00
Reg2Mem
RewriteStatepointsForGC [RS4GC] Remat in presence of phi and use live value 2016-09-22 13:13:06 +00:00
SafeStack [safestack] Fix assertion failure in stack coloring. 2016-09-16 22:04:10 +00:00
SampleProfile Change the basic block weight calculation algorithm to use max instead of voting. 2016-09-21 16:26:51 +00:00
Scalarizer Scalarizer: Support scalarizing intrinsics 2016-07-25 20:02:54 +00:00
SCCP [SCCP] Don't delete side-effecting instructions 2016-08-24 18:10:21 +00:00
SeparateConstOffsetFromGEP [NVPTX] Enable the load-store vectorizer on nvptx. 2016-07-20 22:11:36 +00:00
SimplifyCFG [SimplifyCFG] Update (AND) IR flags when CSE'ing instructions 2016-09-19 08:23:08 +00:00
Sink Add a testcase for r275581 2016-07-19 17:52:41 +00:00
SLPVectorizer Rename tests 2016-09-18 20:25:41 +00:00
SpeculativeExecution [PM] Port SpeculativeExecution to the new PM 2016-08-01 21:48:33 +00:00
SROA Fix revision 281960 2016-09-22 07:56:23 +00:00
StraightLineStrengthReduce [SLSR] Call getPointerSizeInBits with the correct address space. 2016-07-11 18:13:28 +00:00
StripDeadPrototypes
StripSymbols DebugInfo: New metadata representation for global variables. 2016-09-13 01:12:59 +00:00
StructurizeCFG StructurizeCFG: Fix inverting constantexpr conditions 2016-07-15 22:13:16 +00:00
TailCallElim [PM] Port TailCallElim 2016-07-06 23:48:41 +00:00
Util Remove pruning of phi nodes in MemorySSA - it makes updating harder 2016-09-26 17:22:54 +00:00
WholeProgramDevirt WholeProgramDevirt: generate more detailed and accurate remarks. 2016-08-11 19:09:02 +00:00