1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/lib/Analysis
Philip Reames fadf8b424b [LVI] Infer local facts from unary expressions
As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules. Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined. This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch implements only the unary operation case. Once this is in, I'll implement the same for the binary operations.

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

llvm-svn: 267609
2016-04-26 21:48:16 +00:00
..
AliasAnalysis.cpp NFC: make AtomicOrdering an enum class 2016-04-06 21:19:33 +00:00
AliasAnalysisEvaluator.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
AliasSetTracker.cpp [AliasSetTracker] Correctly handle changing the size of an entry 2016-04-14 22:00:11 +00:00
Analysis.cpp Port DemandedBits to the new pass manager. 2016-04-18 23:55:01 +00:00
AssumptionCache.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
BasicAliasAnalysis.cpp Don't IPO over functions that can be de-refined 2016-04-08 00:48:30 +00:00
BlockFrequencyInfo.cpp Add getBlockProfileCount method to BlockFrequencyInfo 2016-03-23 18:18:26 +00:00
BlockFrequencyInfoImpl.cpp Fix Clang-tidy readability-redundant-control-flow warnings; other minor fixes. 2016-02-02 18:20:45 +00:00
BranchProbabilityInfo.cpp [BPI] Consider deoptimize calls as "unreachable" 2016-04-18 19:01:28 +00:00
CallGraph.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
CallGraphSCCPass.cpp Re-commit optimization bisect support (r267022) without new pass manager support. 2016-04-22 22:06:11 +00:00
CallPrinter.cpp [CG] Rename the DOT printing pass to actually reference "DOT". 2016-03-10 11:04:40 +00:00
CaptureTracking.cpp [CaptureTracking] Support atomicrmw and cmpxchg 2016-02-18 19:23:27 +00:00
CFG.cpp Avoid overly large SmallPtrSet/SmallSet 2016-01-30 01:24:31 +00:00
CFGPrinter.cpp
CFLAliasAnalysis.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
CGSCCPassManager.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
CMakeLists.txt [ThinLTO] Move summary computation from BitcodeWriter to new pass 2016-04-11 13:58:45 +00:00
CodeMetrics.cpp use range-based for loop; NFCI 2016-03-08 20:53:48 +00:00
ConstantFolding.cpp CodeGen: Use PLT relocations for relative references to unnamed_addr functions. 2016-04-22 20:40:10 +00:00
CostModel.cpp [CodeGen] Teach LLVM how to lower @llvm.{min,max}num to {MIN,MAX}NAN 2016-04-14 07:13:24 +00:00
Delinearization.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
DemandedBits.cpp Port DemandedBits to the new pass manager. 2016-04-18 23:55:01 +00:00
DependenceAnalysis.cpp [DependenceAnalysis] Refactor uses of getConstantPart. NFC. 2016-04-19 16:46:57 +00:00
DivergenceAnalysis.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
DominanceFrontier.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
DomPrinter.cpp Introduce analysis pass to compute PostDominators in the new pass manager. NFC 2016-02-25 17:54:07 +00:00
EHPersonalities.cpp Add Rust's personality function to the list of known personality functions 2016-03-15 20:35:45 +00:00
GlobalsModRef.cpp Don't IPO over functions that can be de-refined 2016-04-08 00:48:30 +00:00
InlineCost.cpp Introduce llvm.load.relative intrinsic. 2016-04-22 21:18:02 +00:00
InstCount.cpp
InstructionSimplify.cpp Introduce llvm.load.relative intrinsic. 2016-04-22 21:18:02 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp Correct IDF calculator for ReverseIDF 2016-04-19 06:13:28 +00:00
IVUsers.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
LazyCallGraph.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
LazyValueInfo.cpp [LVI] Infer local facts from unary expressions 2016-04-26 21:48:16 +00:00
Lint.cpp [opaque pointer types] [NFC] FindAvailableLoadedValue: take LoadInst instead of just the pointer. 2016-01-22 01:51:51 +00:00
LLVMBuild.txt Revert r266488. 2016-04-18 17:10:17 +00:00
Loads.cpp [unordered] Add tests and conservative handling in support of future changes [NFCI] 2016-04-21 16:51:08 +00:00
LoopAccessAnalysis.cpp [ValueTracking, VectorUtils] Refactor getIntrinsicIDForCall 2016-04-19 19:10:21 +00:00
LoopInfo.cpp IR: Reserve an MDKind for !llvm.loop; NFC 2016-03-25 00:35:38 +00:00
LoopPass.cpp Re-commit optimization bisect support (r267022) without new pass manager support. 2016-04-22 22:06:11 +00:00
LoopPassManager.cpp [PM] Implement the final conclusion as to how the analysis IDs should 2016-03-11 10:22:49 +00:00
LoopUnrollAnalyzer.cpp [LoopUnrollAnalyzer] Check that we're using SCEV for the same loop we're simulating. 2016-02-26 02:57:05 +00:00
MemDepPrinter.cpp [PM] Port memdep to the new pass manager. 2016-03-10 00:55:30 +00:00
MemDerefPrinter.cpp NFC. Move isDereferenceable to Loads.h/cpp 2016-02-24 12:49:04 +00:00
MemoryBuiltins.cpp Calculate __builtin_object_size when pointer depends on a condition 2016-04-13 12:25:25 +00:00
MemoryDependenceAnalysis.cpp NFC: make AtomicOrdering an enum class 2016-04-06 21:19:33 +00:00
MemoryLocation.cpp
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [ThinLTO] Remove GlobalValueInfo class from index 2016-04-24 14:57:11 +00:00
ObjCARCAliasAnalysis.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp Add support for objc_unsafeClaimAutoreleasedReturnValue to the 2016-01-27 19:05:08 +00:00
OrderedBasicBlock.cpp
PHITransAddr.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
PostDominators.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp [SCEV] Extract out a isSCEVExprNeverPoison helper; NFCI 2016-04-22 05:38:54 +00:00
ScalarEvolutionAliasAnalysis.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
ScalarEvolutionExpander.cpp [SCEV] Improve the run-time checking of the NoWrap predicate 2016-04-25 09:27:16 +00:00
ScalarEvolutionNormalization.cpp Remove emacs mode markers from .cpp files. NFC 2016-04-24 17:55:41 +00:00
ScopedNoAliasAA.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
SparsePropagation.cpp
StratifiedSets.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
TargetLibraryInfo.cpp [NVPTX] Infer __nvvm_reflect as nounwind, readnone 2016-03-31 21:29:57 +00:00
TargetTransformInfo.cpp [TTI] Add getInliningThresholdMultiplier. 2016-04-15 01:38:48 +00:00
Trace.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
TypeBasedAliasAnalysis.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
ValueTracking.cpp [ValueTracking] Improve isImpliedCondition when the dominating cond is false. 2016-04-25 17:23:36 +00:00
VectorUtils.cpp [ValueTracking, VectorUtils] Refactor getIntrinsicIDForCall 2016-04-19 19:10:21 +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))

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