1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/test/Transforms
Chad Rosier 2e3937b806 [Reassociate] Add negated value of negative constant to the Duplicates list.
In OptimizeAdd, we scan the operand list to see if there are any common factors
between operands that can be factored out to reduce the number of multiplies
(e.g., 'A*A+A*B*C+D' -> 'A*(A+B*C)+D'). For each operand of the operand list, we
only consider unique factors (which is tracked by the Duplicate set). Now if we
find a factor that is a negative constant, we add the negated value as a factor
as well, because we can percolate the negate out. However, we mistakenly don't
add this negated constant to the Duplicates set.

Consider the expression A*2*-2 + B. Obviously, nothing to factor.

For the added value A*2*-2 we over count 2 as a factor without this change,
which causes the assert reported in PR30256.  The problem is that this code is
assuming that all the multiply operands of the add are already reassociated.
This change avoids the issue by making OptimizeAdd tolerate multiplies which
haven't been completely optimized; this sort of works, but we're doing wasted
work: we'll end up revisiting the add later anyway.

Another possible approach would be to enforce RPO iteration order more strongly.
If we have RedoInsts, we process them immediately in RPO order, rather than
waiting until we've finished processing the whole function. Intuitively, it
seems like the natural approach: reassociation works on expression trees, so
the optimization only works in one direction. That said, I'm not sure how
practical that is given the current Reassociate; the "optimal" form for an
expression depends on its use list (see all the uses of "user_back()"), so
Reassociate is really an iterative optimization of sorts, so any changes here
would probably get messy.

PR30256

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

llvm-svn: 296003
2017-02-23 18:49:03 +00:00
..
ADCE
AddDiscriminators Encode duplication factor from loop vectorization and loop unrolling to discriminator. 2017-02-10 21:09:07 +00:00
AlignmentFromAssumptions
ArgumentPromotion Verifier: Disallow a line number without a file in DISubprogram 2017-02-17 23:57:42 +00:00
AtomicExpand
BBVectorize Introduce -unroll-partial-threshold to separate PartialThreshold from Threshold in loop unorller. 2017-01-17 23:39:33 +00:00
BDCE
BranchFolding
CodeExtractor
CodeGenPrepare
ConstantHoisting
ConstantMerge
ConstProp opt: Rename -default-data-layout flag to -data-layout and make it always override the layout. 2017-02-17 17:36:52 +00:00
Coroutines [coroutines] Spill the result of the invoke instruction correctly 2017-01-25 02:25:54 +00:00
CorrelatedValuePropagation
CountingFunctionInserter
CrossDSOCFI
DCE
DeadArgElim
DeadStoreElimination
EarlyCSE [EarlyCSE] Don't DSE across readnone functions that may throw 2017-01-17 20:15:47 +00:00
EliminateAvailableExternally
Float2Int
ForcedFunctionAttrs
FunctionAttrs [FunctionAttrs] try to extend nonnull-ness of arguments from a callsite back to its parent function 2017-02-13 23:10:51 +00:00
FunctionImport [ModuleSummaryAnalysis] Don't crash when referencing unnamed globals. 2017-02-22 18:53:38 +00:00
GCOVProfiling
GlobalDCE [PH] Replace uses of AssertingVH from members of analysis results with 2017-01-24 12:55:57 +00:00
GlobalMerge
GlobalOpt Verifier: Disallow a line number without a file in DISubprogram 2017-02-17 23:57:42 +00:00
GlobalSplit
GuardWidening
GVN opt: Rename -default-data-layout flag to -data-layout and make it always override the layout. 2017-02-17 17:36:52 +00:00
GVNHoist Fix my GVNHoist test case from r294317 2017-02-07 17:35:53 +00:00
IndVarSimplify opt: Rename -default-data-layout flag to -data-layout and make it always override the layout. 2017-02-17 17:36:52 +00:00
InferAddressSpaces Bug 31948: Fix assertion when bitcasting constantexpr pointers 2017-02-17 00:32:19 +00:00
InferFunctionAttrs
Inline [Inline] add tests to show attribute information loss; NFC 2017-02-15 17:42:58 +00:00
InstCombine AMDGPU: Replace disabled exp inputs with undef 2017-02-23 00:44:03 +00:00
InstMerge Remove the load hoisting code of MLSM, it is completely subsumed by GVNHoist 2017-01-24 19:55:36 +00:00
InstSimplify [InstSimplify] add nsw/nuw (xor X, signbit), signbit --> X 2017-02-18 21:59:09 +00:00
InterleavedAccess [ARM] Don't lower f16 interleaved accesses. 2017-02-11 01:53:00 +00:00
Internalize
IPConstantProp [IPCP] Don't propagate return value for naked functions. 2017-02-04 19:44:14 +00:00
IRCE [IRCE] Add a missing invariant check 2017-02-07 23:59:07 +00:00
JumpThreading [JumpThreading] Re-enable JumpThreading for guards 2017-02-17 04:21:14 +00:00
LCSSA
LICM Correct a typo, s/hosting/hoisting/ 2017-02-14 16:41:10 +00:00
LoadCombine [LoadCombine] Change test to not use instcombine. 2017-02-10 00:44:08 +00:00
LoadStoreVectorizer LoadStoreVectorizer: Split even sized illegal chains properly 2017-02-23 03:58:53 +00:00
LoopDataPrefetch
LoopDeletion [PM] Teach LoopDeletion to correctly update the LPM when loops are 2017-01-18 02:41:26 +00:00
LoopDistribute Move test of lazy BFI with ORE to a generic directory 2017-01-13 00:16:23 +00:00
LoopIdiom Fix some broken CHECK lines. 2017-01-22 20:28:56 +00:00
LoopInterchange
LoopLoadElim [PM] Port LoopLoadElimination to the new pass manager and wire it into 2017-01-27 01:32:26 +00:00
LoopPredication [Guards] Introduce loop-predication pass 2017-01-25 16:00:44 +00:00
LoopReroll
LoopRotate
LoopSimplify [BasicBlockUtils] Use getFirstNonPHIOrDbg to set debugloc for instructions created in SplitBlockPredecessors 2017-02-14 21:10:40 +00:00
LoopSimplifyCFG
LoopStrengthReduce [LSR] Canonicalize formula and put recursive Reg related with current loop in ScaledReg. 2017-02-22 21:47:08 +00:00
LoopUnroll [LoopUnroll] Enable PGO-based loop peeling by default. 2017-02-22 00:27:34 +00:00
LoopUnswitch [LoopUnswitch] Remove BFI usage (dead code) 2017-02-10 06:12:06 +00:00
LoopVectorize [LV] Update floating-point induction test checks (NFC) 2017-02-22 21:56:02 +00:00
LoopVersioning
LoopVersioningLICM
LowerAtomic
LowerExpectIntrinsic
LowerGuardIntrinsic
LowerInvoke
LowerSwitch
LowerTypeTests IR: Type ID summary extensions for WPD; thread summary into WPD pass. 2017-02-13 19:26:18 +00:00
Mem2Reg
MemCpyOpt [MemCpyOpt] Don't sink LoadInst below possible clobber. 2016-12-27 17:58:12 +00:00
MergeFunc MergeFunctions: Preserve debug info in thunks, under option -mergefunc-preserve-debug-info 2017-01-21 02:02:56 +00:00
MetaRenamer
NameAnonGlobals
NaryReassociate
NewGVN PredicateInfo: Support switch statements 2017-02-22 22:20:58 +00:00
ObjCARC
PartiallyInlineLibCalls Add positive test for sqrt "partial inlining". NFC. 2017-01-04 21:24:56 +00:00
PGOProfile Re-apply "[profiling] Remove dead profile name vars after emitting name data" 2017-02-14 20:03:48 +00:00
PhaseOrdering
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociate] Add negated value of negative constant to the Duplicates list. 2017-02-23 18:49:03 +00:00
Reg2Mem
RewriteStatepointsForGC
SafeStack
SampleProfile Use base discriminator in sample pgo profile matching. 2017-02-23 18:27:45 +00:00
Scalarizer
SCCP opt: Rename -default-data-layout flag to -data-layout and make it always override the layout. 2017-02-17 17:36:52 +00:00
SeparateConstOffsetFromGEP
SimplifyCFG opt: Rename -default-data-layout flag to -data-layout and make it always override the layout. 2017-02-17 17:36:52 +00:00
Sink
SLPVectorizer [SLP] Fix for PR32036: Vectorized horizontal reduction returning wrong 2017-02-23 13:37:09 +00:00
SpeculativeExecution
SROA
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols
StructurizeCFG AMDGPU: Remove some uses of llvm.SI.export in tests 2017-02-22 00:02:21 +00:00
TailCallElim
ThinLTOBitcodeWriter ThinLTOBitcodeWriter: Write available_externally copies of VCP eligible functions to merged module. 2017-02-14 03:42:38 +00:00
Util PredicateInfo: Support switch statements 2017-02-22 22:20:58 +00:00
WholeProgramDevirt WholeProgramDevirt: For VCP use a 32-bit ConstantInt for the byte offset. 2017-02-17 19:43:45 +00:00