1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 13:33:37 +02:00
llvm-mirror/test/Analysis
Wei Mi 00d0d9c981 [SCEV] Try to reuse existing value during SCEV expansion
Current SCEV expansion will expand SCEV as a sequence of operations
and doesn't utilize the value already existed. This will introduce
redundent computation which may not be cleaned up throughly by
following optimizations.

This patch introduces an ExprValueMap which is a map from SCEV to the
set of equal values with the same SCEV. When a SCEV is expanded, the
set of values is checked and reused whenever possible before generating
a sequence of operations.

The original commit triggered regressions in Polly tests. The regressions
exposed two problems which have been fixed in current version.

1. Polly will generate a new function based on the old one. To generate an
instruction for the new function, it builds SCEV for the old instruction,
applies some tranformation on the SCEV generated, then expands the transformed
SCEV and insert the expanded value into new function. Because SCEV expansion
may reuse value cached in ExprValueMap, the value in old function may be
inserted into new function, which is wrong.
   In SCEVExpander::expand, there is a logic to check the cached value to
be used should dominate the insertion point. However, for the above
case, the check always passes. That is because the insertion point is
in a new function, which is unreachable from the old function. However
for unreachable node, DominatorTreeBase::dominates thinks it will be
dominated by any other node.
   The fix is to simply add a check that the cached value to be used in
expansion should be in the same function as the insertion point instruction.

2. When the SCEV is of scConstant type, expanding it directly is cheaper than
reusing a normal value cached. Although in the cached value set in ExprValueMap,
there is a Constant type value, but it is not easy to find it out -- the cached
Value set is not sorted according to the potential cost. Existing reuse logic
in SCEVExpander::expand simply chooses the first legal element from the cached
value set.
   The fix is that when the SCEV is of scConstant type, don't try the reuse
logic. simply expand it.

Differential Revision: http://reviews.llvm.org/D12090

llvm-svn: 259736
2016-02-04 01:27:38 +00:00
..
AssumptionCache [PM] Actually add the new pass manager support for the assumption cache. 2015-01-22 21:53:09 +00:00
BasicAA [BasicAA] Fix for missing must alias (D16343) 2016-01-30 05:52:53 +00:00
BlockFrequencyInfo Use getEdgeProbability() instead of getEdgeWeight() in BFI and remove getEdgeWeight() interfaces from MBPI. 2015-12-18 21:53:24 +00:00
BranchProbabilityInfo [BPI] Replace weights by probabilities in BPI. 2015-12-22 18:56:14 +00:00
CallGraph [gc.statepoint] Change gc.statepoint intrinsic's return type to token type instead of i32 type 2015-12-26 07:54:32 +00:00
CFLAliasAnalysis [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
CostModel Implemented cost model for masked gather and scatter operations 2015-12-28 20:10:59 +00:00
Delinearization [SCEV] Mark AddExprs as nsw or nuw if legal 2015-10-22 19:57:19 +00:00
DemandedBits [DemandedBits] Revert r249687 due to PR26071 2016-02-03 15:05:06 +00:00
DependenceAnalysis Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
DivergenceAnalysis AMDGPU/SI: Fix implemenation of isSourceOfDivergence() for graphics shaders 2015-12-19 02:54:15 +00:00
Dominators Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
GlobalsModRef [GlobalsAA] Relax condition in checking globals as args to functions 2016-01-14 08:46:45 +00:00
LazyCallGraph [LCG] Build an edge abstraction for the LazyCallGraph and use it to 2016-02-02 03:57:13 +00:00
Lint [WinEH] Delete the old landingpad implementation of Windows EH 2015-10-09 23:34:53 +00:00
LoopAccessAnalysis [Vectorization] Actually return from error case in isStridedPtr 2016-01-08 01:55:13 +00:00
LoopInfo [PM] Port LoopInfo to the new pass manager, adding both a LoopAnalysis 2015-01-20 10:58:50 +00:00
MemoryDependenceAnalysis [MDA] change BlockScanLimit into a command line option. 2015-07-21 21:50:39 +00:00
PostDominators FileCheck-ize tests. 2013-08-22 00:51:19 +00:00
RegionInfo [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ScalarEvolution [SCEV] Try to reuse existing value during SCEV expansion 2016-02-04 01:27:38 +00:00
ScopedNoAliasAA [Testsuite] Renumber metadata in ScopedNoAliasAA test to match CHECK lines 2015-05-11 09:10:14 +00:00
TypeBasedAliasAnalysis Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
ValueTracking Revert "[ValueTracking] Understand more select patterns in ComputeKnownBits" 2016-01-14 15:49:32 +00:00