1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/lib/Analysis
Sanjoy Das bbb7dedca9 [ValueTracking] Use guards to prove non-nullness of a value
Reviewers: apilipenko, majnemer, reames

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 269008
2016-05-10 02:35:44 +00:00
..
AliasAnalysis.cpp
AliasAnalysisEvaluator.cpp
AliasSetTracker.cpp
Analysis.cpp
AssumptionCache.cpp
BasicAliasAnalysis.cpp [BasicAA] Guard intrinsics don't write to memory 2016-05-10 02:35:41 +00:00
BlockFrequencyInfo.cpp [PM] port Branch Frequency Analaysis pass to new PM 2016-05-05 21:13:27 +00:00
BlockFrequencyInfoImpl.cpp fix spelling; NFC 2016-05-09 16:07:45 +00:00
BranchProbabilityInfo.cpp [PM] Port Branch Probability Analysis pass to the new pass manager. 2016-05-05 02:59:57 +00:00
CallGraph.cpp
CallGraphSCCPass.cpp
CallPrinter.cpp
CaptureTracking.cpp Fold compares irrespective of whether allocation can be elided 2016-05-03 14:58:21 +00:00
CFG.cpp
CFGPrinter.cpp
CFLAliasAnalysis.cpp [CFLAA] Fix a use-of-invalid-pointer bug. 2016-05-02 18:09:19 +00:00
CGSCCPassManager.cpp
CMakeLists.txt
CodeMetrics.cpp
ConstantFolding.cpp [ConstantFolding, ValueTracking] Fold constants involving bitcasts of ConstantVector 2016-05-04 06:13:33 +00:00
CostModel.cpp
Delinearization.cpp
DemandedBits.cpp
DependenceAnalysis.cpp
DivergenceAnalysis.cpp DivergenceAnalysis: Fix crash with no return blocks 2016-05-09 16:57:08 +00:00
DominanceFrontier.cpp
DomPrinter.cpp
EHPersonalities.cpp
GlobalsModRef.cpp
InlineCost.cpp [Inliner] don't assume that a Constant alloca size is a ConstantInt (PR27277) 2016-05-09 21:51:53 +00:00
InstCount.cpp
InstructionSimplify.cpp Fold compares irrespective of whether allocation can be elided 2016-05-03 14:58:21 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp
IVUsers.cpp
LazyCallGraph.cpp
LazyValueInfo.cpp [LVI] Add an API to LazyValueInfo so that it can export ConstantRanges 2016-05-02 19:58:00 +00:00
Lint.cpp
LLVMBuild.txt
Loads.cpp
LoopAccessAnalysis.cpp [LV] Hint at the new loop distribution pragma in optimization remark 2016-05-09 23:03:44 +00:00
LoopInfo.cpp [LoopUnroll] Unroll loops which have exit blocks to EH pads 2016-05-03 03:57:40 +00:00
LoopPass.cpp
LoopPassManager.cpp PM: Check that loop passes preserve a basic set of analyses 2016-05-03 21:35:08 +00:00
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp
MemoryLocation.cpp
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp ThinLTO: fix assertion and refactor check for hidden use from inline ASM in a helper function 2016-05-06 08:25:33 +00:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OrderedBasicBlock.cpp
PHITransAddr.cpp
PostDominators.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp [SCEV] Use guards to prove predicates 2016-05-10 00:31:49 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp [SCEVExpander] Clang format expressions; NFC 2016-05-10 00:32:31 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
SparsePropagation.cpp
StratifiedSets.h
TargetLibraryInfo.cpp [X86] Promote several single precision FP libcalls on Windows 2016-05-08 08:15:50 +00:00
TargetTransformInfo.cpp
Trace.cpp
TypeBasedAliasAnalysis.cpp
ValueTracking.cpp [ValueTracking] Use guards to prove non-nullness of a value 2016-05-10 02:35:44 +00:00
VectorUtils.cpp [VectorUtils] Query number of sign bits to allow more truncations 2016-05-09 14:32:30 +00:00

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))

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