1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib/Analysis
Nikita Popov b9b22bfd31 [LVI] Cleanup/unify cache access
This patch combines the "has" and "get" parts of the cache access.
getCachedValueInfo() now both sets the BBLV return argument, and
returns whether the value was found.

Additionally, the management of the work stack is now integrated
into getBlockValue(). If the value is not cached yet, we try to
push to the stack (and return false, indicating that we need to
solve first), or return overdefined in case of a cycle.

These changes a) avoid a duplicate cache lookup for has & get and
b) ensure that the logic is uniform everywhere. For this reason
this change is also not quite NFC, because previously overdefined
values from the cache, and overdefined values from a cycle received
different treatment when it came to assumption intersection.

Differential Revision: https://reviews.llvm.org/D76788
2020-04-17 18:44:38 +02:00
..
AliasAnalysis.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
Analysis.cpp
AssumeBundleQueries.cpp [NFC] Split Knowledge retention and place it more appropriatly 2020-04-02 15:01:41 +02:00
AssumptionCache.cpp [AssumeBundles] adapt Assumption cache to assume bundles 2020-04-13 12:04:51 +02:00
BasicAliasAnalysis.cpp [NFC] Use VectorType::isScalable to align with ongoing VectorType refactor. 2020-04-12 15:39:13 -07:00
BlockFrequencyInfo.cpp [CFG/BasicBlock] Rename succ_const to const_succ. [NFC] 2020-03-25 12:40:55 -07:00
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp [BPI] Clear handles when releasing memory (NFC) 2020-04-07 22:51:01 +02:00
CallGraph.cpp [CallGraphUpdater] Update the ExternalCallingNode for node replacements 2020-04-15 18:38:50 -05:00
CallGraphSCCPass.cpp [CallGraphUpdater][NFC] Minor updates to D77855 2020-04-15 21:26:35 -05:00
CallPrinter.cpp
CaptureTracking.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
CFG.cpp [CFG/BasicBlock] Rename succ_const to const_succ. [NFC] 2020-03-25 12:40:55 -07:00
CFGPrinter.cpp [CFGPrinter] Adding heat coloring to CFGPrinter 2020-04-08 19:59:51 +00:00
CFLAndersAliasAnalysis.cpp [ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers. 2020-04-14 14:11:02 +03:00
CFLGraph.h
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp [llvm][NFC][CallSite] Remove Implementation uses of CallSite 2020-04-14 14:49:47 -07:00
CMakeLists.txt Revert "Move ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency from Analysis to Object" 2020-04-14 00:27:08 +00:00
CmpInstAnalysis.cpp
CodeMetrics.cpp CodeMetrics.h - include and forward declaration cleanup. NFC. 2020-04-13 13:09:39 +01:00
ConstantFolding.cpp Clean up usages of asserting vector getters in Type 2020-04-09 12:41:28 -07:00
CostModel.cpp
DDG.cpp [DDG] Data Dependence Graph - Graph Simplification 2020-02-19 13:41:51 -05:00
Delinearization.cpp
DemandedBits.cpp
DependenceAnalysis.cpp [DA] Delinearization of fixed-size multi-dimensional arrays 2020-02-27 10:29:01 -05:00
DependenceGraphBuilder.cpp [DDG] Data Dependence Graph - Graph Simplification 2020-02-19 13:41:51 -05:00
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp [CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfo 2020-04-06 17:42:54 +00:00
DomTreeUpdater.cpp
EHPersonalities.cpp
GlobalsModRef.cpp
GuardUtils.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
HeatUtils.cpp [CFGPrinter] Adding heat coloring to CFGPrinter 2020-04-08 19:59:51 +00:00
IndirectCallPromotionAnalysis.cpp
InlineCost.cpp Revert "[TLI] Per-function fveclib for math library used for vectorization" 2020-04-11 01:05:01 +00:00
InstCount.cpp
InstructionPrecedenceTracking.cpp [NFC] Remove obsolete checks followed by fix of isGuaranteedToTransferExecutionToSuccessor 2020-03-30 12:24:41 +07:00
InstructionSimplify.cpp Clean up usages of asserting vector getters in Type 2020-04-09 12:41:28 -07:00
Interval.cpp
IntervalPartition.cpp
IVDescriptors.cpp [IVDescriptors] Remove unnecessary DemandedBits.h include; NFC 2020-04-04 12:07:57 +02:00
IVUsers.cpp
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp [llvm][NFC][CallSite] Remove Implementation uses of CallSite 2020-04-14 14:49:47 -07:00
LazyValueInfo.cpp [LVI] Cleanup/unify cache access 2020-04-17 18:44:38 +02:00
LegacyDivergenceAnalysis.cpp
Lint.cpp [ConstantFolding] Always return something from ConstantFoldConstant 2020-03-04 18:24:47 +01:00
LLVMBuild.txt Revert "Move ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency from Analysis to Object" 2020-04-14 00:27:08 +00:00
Loads.cpp Clean up usages of asserting vector getters in Type 2020-04-09 12:41:28 -07:00
LoopAccessAnalysis.cpp
LoopAnalysisManager.cpp
LoopCacheAnalysis.cpp [ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers. 2020-04-14 14:11:02 +03:00
LoopInfo.cpp [NFC] Add missing 'const' notion to LCSSA-related functions 2020-04-17 17:49:34 +07:00
LoopNestAnalysis.cpp [LoopNest]: Analysis to discover properties of a loop nest. 2020-03-03 18:25:19 +00:00
LoopPass.cpp
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp Clean up usages of asserting vector getters in Type 2020-04-09 12:41:28 -07:00
MemoryDependenceAnalysis.cpp [DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses(PR42151). 2020-03-04 18:40:02 +07:00
MemoryLocation.cpp
MemorySSA.cpp [MemorySSA] Don't verify MemorySSA unless VerifyMemorySSA enabled 2020-02-13 18:46:58 +01:00
MemorySSAUpdater.cpp [GraphDiff] Extend GraphDiff to track a list of updates. 2020-04-03 12:10:36 -07:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp Revert "Move ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency from Analysis to Object" 2020-04-14 00:27:08 +00:00
MustExecute.cpp [Attributor] Detect possibly unbounded cycles in functions 2020-03-13 11:17:33 -05:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationRemarkEmitter.cpp Compute ORE, BPI, BFI in Loop passes. 2020-02-12 09:15:18 -08:00
OrderedInstructions.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
PHITransAddr.cpp
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp [PSI] Add the isCold query support with a given percentile value. 2020-03-02 12:50:15 -08:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp [CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfo 2020-04-06 17:42:54 +00:00
ScalarEvolution.cpp [llvm][NFC][CallSite] Remove Implementation uses of CallSite 2020-04-14 14:49:47 -07:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp Revert "[LSR] re-add testcase for wrongly phi node elimination - NFC" 2020-04-01 12:58:06 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
StackSafetyAnalysis.cpp [memtag] Plug in stack safety analysis. 2020-03-16 16:35:25 -07:00
StratifiedSets.h
SyncDependenceAnalysis.cpp [CFG/BasicBlock] Rename succ_const to const_succ. [NFC] 2020-03-25 12:40:55 -07:00
SyntheticCountsUtils.cpp
TargetLibraryInfo.cpp [ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers. 2020-04-14 14:11:02 +03:00
TargetTransformInfo.cpp [nfc] clang-format TargetTransformInfo.cpp 2020-04-15 14:43:26 +02:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp
ValueLattice.cpp [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
ValueLatticeUtils.cpp
ValueTracking.cpp [ValueTracking] Implement canCreatePoison 2020-04-15 05:58:06 +09:00
VectorUtils.cpp [VectorUtils] Create shufflevector masks as int vectors instead of Constants 2020-04-17 15:28:00 +02:00
VFABIDemangling.cpp

Analysis Opportunities:

//===---------------------------------------------------------------------===//

In test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll, the
ScalarEvolution expression for %r is this:

  {1,+,3,+,2}<loop>

Outside the loop, this could be evaluated simply as (%n * %n), however
ScalarEvolution currently evaluates it as

  (-2 + (2 * (trunc i65 (((zext i64 (-2 + %n) to i65) * (zext i64 (-1 + %n) to i65)) /u 2) to i64)) + (3 * %n))

In addition to being much more complicated, it involves i65 arithmetic,
which is very inefficient when expanded into code.

//===---------------------------------------------------------------------===//

In formatValue in test/CodeGen/X86/lsr-delayed-fold.ll,

ScalarEvolution is forming this expression:

((trunc i64 (-1 * %arg5) to i32) + (trunc i64 %arg5 to i32) + (-1 * (trunc i64 undef to i32)))

This could be folded to

(-1 * (trunc i64 undef to i32))

//===---------------------------------------------------------------------===//