1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test/Transforms
Chandler Carruth d600be3a1d Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable.
The core idea is to (re-)introduce some redundancies where their cost is
hidden by the cost of materializing immediates for constant operands of
PHI nodes. When the cost of the redundancies is covered by this,
avoiding materializing the immediate has numerous benefits:
1) Less register pressure
2) Potential for further folding / combining
3) Potential for more efficient instructions due to immediate operand

As a motivating example, consider the remarkably different cost on x86
of a SHL instruction with an immediate operand versus a register
operand.

This pattern turns up surprisingly frequently, but is somewhat rarely
obvious as a significant performance problem.

The pass is entirely target independent, but it does rely on the target
cost model in TTI to decide when to speculate things around the PHI
node. I've included x86-focused tests, but any target that sets up its
immediate cost model should benefit from this pass.

There is probably more that can be done in this space, but the pass
as-is is enough to get some important performance on our internal
benchmarks, and should be generally performance neutral, but help with
more extensive benchmarking is always welcome.

One awkward part is that this pass has to be scheduled after
*everything* that can eliminate these kinds of redundancies. This
includes SimplifyCFG, GVN, etc. I'm open to suggestions about better
places to put this. We could in theory make it part of the codegen pass
pipeline, but there doesn't really seem to be a good reason for that --
it isn't "lowering" in any sense and only relies on pretty standard cost
model based TTI queries, so it seems to fit well with the "optimization"
pipeline model. Still, further thoughts on the pipeline position are
welcome.

I've also only implemented this in the new pass manager. If folks are
very interested, I can try to add it to the old PM as well, but I didn't
really see much point (my use case is already switched over to the new
PM).

I've tested this pretty heavily without issue. A wide range of
benchmarks internally show no change outside the noise, and I don't see
any significant changes in SPEC either. However, the size class
computation in tcmalloc is substantially improved by this, which turns
into a 2% to 4% win on the hottest path through tcmalloc for us, so
there are definitely important cases where this is going to make
a substantial difference.

Differential revision: https://reviews.llvm.org/D37467

llvm-svn: 319164
2017-11-28 11:32:31 +00:00
..
ADCE [ADCE][Dominators] Reapply: Teach ADCE to preserve dominators 2017-08-22 16:30:21 +00:00
AddDiscriminators
AlignmentFromAssumptions
ArgumentPromotion
AtomicExpand
BDCE [BDCE] Don't check demanded bits on unsized types 2017-08-16 16:09:22 +00:00
BranchFolding
CalledValuePropagation Add CalledValuePropagation pass 2017-10-25 13:40:08 +00:00
CallSiteSplitting [CallSiteSplitting] Remove some indirection (NFC). 2017-11-18 18:14:13 +00:00
CodeExtractor [PartialInliner] Inline vararg functions that forward varargs. 2017-11-13 10:35:52 +00:00
CodeGenPrepare [CGP] Fix handling of null pointer values in optimizeMemoryInst 2017-11-27 11:29:15 +00:00
ConstantHoisting Fix out-of-order stepping behavior in programs with hoisted constants. 2017-11-09 20:01:31 +00:00
ConstantMerge Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
ConstProp
Coroutines [coroutines] Add support for symmetric control transfer (musttail on coro.resumes followed by a suspend) 2017-08-25 02:25:10 +00:00
CorrelatedValuePropagation [CVP] Remove some {s|u}add.with.overflow checks. 2017-11-10 19:13:35 +00:00
CrossDSOCFI [cfi] Build __cfi_check as Thumb when applicable. 2017-08-29 22:29:15 +00:00
DCE Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
DeadArgElim
DeadStoreElimination Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
DivRemPairs [DivRemPairs] split tests per target to account for bots that don't build for all targets 2017-09-09 14:10:59 +00:00
EarlyCSE Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
EliminateAvailableExternally
EntryExitInstrumenter Rename test/Transforms/CountingFunctionInserter -> EntryExitInstrumenter 2017-11-21 17:22:19 +00:00
ExpandMemCmp/X86 re-land [ExpandMemCmp] Split ExpandMemCmp from CodeGen into its own pass." 2017-11-03 12:12:27 +00:00
Float2Int
ForcedFunctionAttrs
FunctionAttrs Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
FunctionImport Fix bot failures by requiring x86 target 2017-08-19 19:15:04 +00:00
GCOVProfiling Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
GlobalDCE
GlobalMerge Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
GlobalOpt Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
GlobalSplit
GuardWidening
GVN [GVN] Prevent ScalarPRE from hoisting across instructions that don't pass control flow to successors 2017-11-28 07:07:55 +00:00
GVNHoist Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
GVNSink Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
IndVarSimplify IndVarSimplify: preserve debug information attached to widened PHI nodes. 2017-11-02 23:17:06 +00:00
InferAddressSpaces InferAddressSpaces: Fix bug about replacing addrspacecast 2017-10-30 21:19:41 +00:00
InferFunctionAttrs
Inline Inliner: Don't mark notail calls with the 'tail' attribute 2017-11-27 19:03:40 +00:00
InstCombine [InstCombine] Test for PR35354: unable to vectorize loop with std::max 2017-11-21 14:49:13 +00:00
InstMerge
InstNamer
InstSimplify [InstSimplify] add fcmp with negative constant tests; NFC 2017-11-27 16:08:34 +00:00
InterleavedAccess [X86][LLVM]Expanding Supports lowerInterleaved{store|load}() in X86InterleavedAccess (VF64 stride 3-4) 2017-10-02 07:35:25 +00:00
Internalize
IPConstantProp
IRCE [IRCE] Smart range intersection 2017-11-20 06:07:57 +00:00
JumpThreading Fix some misc. -enable-var-scope violations 2017-11-13 01:47:52 +00:00
LCSSA
LICM [LICM] Fix PR35342 2017-11-17 20:38:25 +00:00
LoadStoreVectorizer Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
LoopDataPrefetch
LoopDeletion
LoopDistribute
LoopIdiom Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
LoopInterchange [LoopInterchange] Fix phi node ordering miscompile. 2017-10-21 13:58:37 +00:00
LoopLoadElim
LoopPredication [LoopPredication] Enable predication when latchCheckIV is wider than rangeCheck 2017-11-02 21:21:02 +00:00
LoopReroll
LoopRotate Fix llvm/test/Transforms/LoopRotate/pr35210.ll in rL318237, it uses debug options. 2017-11-15 06:46:58 +00:00
LoopSimplify [SCEV] Teach SCEV to find maxBECount when loop endbound is variant 2017-10-13 14:30:43 +00:00
LoopSimplifyCFG
LoopStrengthReduce Revert r314886 "[X86] Improvement in CodeGen instruction selection for LEAs (re-applying post required revision changes.)" 2017-10-04 17:54:06 +00:00
LoopUnroll loop-unroll: teach remapInstruction to update dbg.value intrinsics. 2017-11-01 23:12:35 +00:00
LoopUnswitch [LoopUnswitch] Fix a simple bug which disables loop unswitch for select statement 2017-08-29 21:45:11 +00:00
LoopVectorize [LV] Model masking in VPlan, introducing VPInstructions 2017-11-20 12:01:47 +00:00
LoopVersioning
LoopVersioningLICM
LowerAtomic LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020) 2017-08-23 15:43:28 +00:00
LowerExpectIntrinsic
LowerGuardIntrinsic
LowerInvoke
LowerSwitch
LowerTypeTests Current implementation of Value::replaceUsesExceptBlockAddr() uses UseList 2017-11-17 00:30:24 +00:00
Mem2Reg Re-land r313825: "[IR] Add llvm.dbg.addr, a control-dependent version of llvm.dbg.declare" 2017-09-21 19:52:03 +00:00
MemCpyOpt Fix some misc. -enable-var-scope violations 2017-11-13 01:47:52 +00:00
MergeFunc [TailRecursionElimination] Skip debug intrinsics. 2017-11-28 09:32:25 +00:00
MergeICmps Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion." 2017-10-10 08:00:45 +00:00
MetaRenamer
NameAnonGlobals
NaryReassociate
NewGVN Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
ObjCARC ObjCARC: do not increment past the end of the BB 2017-10-24 00:09:10 +00:00
PartiallyInlineLibCalls [PartiallyInlineLibCalls][x86] add TTI hook to allow sqrt inlining to depend on arg rather than result 2017-11-27 21:15:43 +00:00
PGOProfile Add heuristics for irreducible loop metadata under PGO 2017-11-20 21:03:38 +00:00
PhaseOrdering [PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC 2017-11-15 16:37:30 +00:00
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociation] regenerate test checks; NFC 2017-11-13 19:46:28 +00:00
Reg2Mem
RewriteStatepointsForGC Strip off invariant.start because memory locations arent invariant 2017-11-02 18:24:04 +00:00
SafeStack Parse and print DIExpressions inline to ease IR and MIR testing 2017-08-23 20:31:27 +00:00
SampleProfile Include already promoted counts when computing SUM for VP. 2017-11-06 19:52:49 +00:00
Scalarizer
SCCP [SCCP] Pick the right lattice value for constants. 2017-11-22 03:04:55 +00:00
SeparateConstOffsetFromGEP
SimpleLoopUnswitch [PM/Unswitch] Teach SimpleLoopUnswitch to do non-trivial unswitching, 2017-11-17 19:58:36 +00:00
SimplifyCFG [Hexagon] Remove trailing spaces, NFC 2017-11-22 20:43:00 +00:00
Sink
SLPVectorizer SLPVectorizer.cpp: Avoid std::stable_sort(properlyDominates()). 2017-11-21 09:41:01 +00:00
SpeculateAroundPHIs Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. 2017-11-28 11:32:31 +00:00
SpeculativeExecution
SROA This reverts commit r319096 and r319097. 2017-11-28 01:25:38 +00:00
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
StructurizeCFG [Dominators] Include infinite loops in PostDominatorTree 2017-08-15 18:14:57 +00:00
TailCallElim
ThinLTOBitcodeWriter ModuleUtils: Stop using comdat members to generate unique module ids. 2017-10-05 21:54:53 +00:00
Util [InstCombine] Add a flag to disable LowerDbgDeclare 2017-09-13 01:43:25 +00:00
WholeProgramDevirt [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local. 2017-11-04 17:04:39 +00:00