1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/lib/Analysis
Silviu Baranga 6e6031d4bf [SCEV][LAA] Re-commit r260085 and r260086, this time with a fix for the memory
sanitizer issue. The PredicatedScalarEvolution's copy constructor
wasn't copying the Generation value, and was leaving it un-initialized.

Original commit message:

[SCEV][LAA] Add no wrap SCEV predicates and use use them to improve strided pointer detection

Summary:
This change adds no wrap SCEV predicates with:
  - support for runtime checking
  - support for expression rewriting:
      (sext ({x,+,y}) -> {sext(x),+,sext(y)}
      (zext ({x,+,y}) -> {zext(x),+,sext(y)}

Note that we are sign extending the increment of the SCEV, even for
the zext case. This is needed to cover the fairly common case where y would
be a (small) negative integer. In order to do this, this change adds two new
flags: nusw and nssw that are applicable to AddRecExprs and permit the
transformations above.

We also change isStridedPtr in LAA to be able to make use of
these predicates. With this feature we should now always be able to
work around overflow issues in the dependence analysis.

Reviewers: mzolotukhin, sanjoy, anemet

Subscribers: mzolotukhin, sanjoy, llvm-commits, rengolin, jmolloy, hfinkel

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

llvm-svn: 260112
2016-02-08 17:02:45 +00:00
..
AliasAnalysis.cpp fix formatting; NFC 2016-01-13 22:17:13 +00:00
AliasAnalysisEvaluator.cpp [OperandBundles] Have GlobalsModRef play nice with operand bundles 2015-12-23 09:58:46 +00:00
AliasSetTracker.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
Analysis.cpp [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
AssumptionCache.cpp [PM] Actually add the new pass manager support for the assumption cache. 2015-01-22 21:53:09 +00:00
BasicAliasAnalysis.cpp [BasicAA] NFC - revised comment for function adjustToPointerSize() 2016-01-30 05:58:38 +00:00
BlockFrequencyInfo.cpp Recommit r250345, it was reverted in r250366 to investigate a bot failure. 2015-10-15 14:59:40 +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] Fix two potential divide-by-zero operations that are introduced in r256263. 2015-12-22 23:45:55 +00:00
CallGraph.cpp [Analysis/CallGraph] Switch dump() definitions over to LLVM_DUMP_METHOD. 2015-11-23 02:58:42 +00:00
CallGraphSCCPass.cpp Recommit r256952 "Filtering IR printing for print-after-all/print-before-all" 2016-01-06 22:55:03 +00:00
CallPrinter.cpp [PM/AA] Remove the last relics of the separate IPA library from LLVM, 2015-08-18 17:51:53 +00:00
CaptureTracking.cpp [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
CFG.cpp Avoid overly large SmallPtrSet/SmallSet 2016-01-30 01:24:31 +00:00
CFGPrinter.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
CFLAliasAnalysis.cpp Minor style cleanup of CFLAA. NFC. 2016-01-28 00:54:01 +00:00
CGSCCPassManager.cpp [PM] Remove the defunt CGSCC-specific debug flag. 2015-01-13 22:45:13 +00:00
CMakeLists.txt Move EH-specific helper functions to a more appropriate place 2015-12-02 23:06:39 +00:00
CodeMetrics.cpp Use all_of to simplify control flow. NFC. 2015-10-24 19:30:37 +00:00
ConstantFolding.cpp Remove duplicate documentation in ConstantFolding.cpp. NFC. 2016-01-23 22:49:54 +00:00
CostModel.cpp Implemented cost model for masked gather and scatter operations 2015-12-28 20:10:59 +00:00
Delinearization.cpp SCEV: Allow simple AddRec * Parameter products in delinearization 2015-10-12 08:02:00 +00:00
DemandedBits.cpp [DemandedBits] Revert r249687 due to PR26071 2016-02-03 15:05:06 +00:00
DependenceAnalysis.cpp [SCEV] Add and use SCEVConstant::getAPInt; NFCI 2015-12-17 20:28:46 +00:00
DivergenceAnalysis.cpp Make some headers self-contained, remove unused includes that violate layering. 2016-01-27 16:05:37 +00:00
DominanceFrontier.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
DomPrinter.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
EHPersonalities.cpp [WinEH] Rename CatchReturnInst::getParentPad, NFC 2016-01-15 21:16:19 +00:00
GlobalsModRef.cpp Avoid overly large SmallPtrSet/SmallSet 2016-01-30 01:24:31 +00:00
InlineCost.cpp CallAnalyzer::analyzeCall: change the condition back to "Cost < Threshold" 2016-02-05 20:32:42 +00:00
InstCount.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
InstructionSimplify.cpp [opaque pointer types] [NFC] Add an explicit type argument to ConstantFoldLoadFromConstPtr. 2016-01-22 01:17:26 +00:00
Interval.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
IntervalPartition.cpp
IteratedDominanceFrontier.cpp Move IDF Calculation to a separate file, expose an interface to it. 2015-04-21 19:13:02 +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 [LCG] Build an edge abstraction for the LazyCallGraph and use it to 2016-02-02 03:57:13 +00:00
LazyValueInfo.cpp [LVI] Fix debug output 2016-02-02 22:43:08 +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 [PM/AA] Remove the last relics of the separate IPA library from LLVM, 2015-08-18 17:51:53 +00:00
Loads.cpp [opaque pointer types] [NFC] FindAvailableLoadedValue: take LoadInst instead of just the pointer. 2016-01-22 01:51:51 +00:00
LoopAccessAnalysis.cpp [SCEV][LAA] Re-commit r260085 and r260086, this time with a fix for the memory 2016-02-08 17:02:45 +00:00
LoopInfo.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
LoopPass.cpp LoopInfo: Simplify ownership of Loop objects 2016-01-08 19:08:53 +00:00
MemDepPrinter.cpp [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
MemDerefPrinter.cpp Take alignment into account in isSafeToSpeculativelyExecute and isSafeToLoadUnconditionally. 2015-08-17 15:54:26 +00:00
MemoryBuiltins.cpp Update to use new name alignTo(). 2016-01-14 21:06:47 +00:00
MemoryDependenceAnalysis.cpp Avoid overly large SmallPtrSet/SmallSet 2016-01-30 01:24:31 +00:00
MemoryLocation.cpp [PM/AA] Split the location computation out of getArgLocation so the 2015-06-17 07:12:40 +00:00
ModuleDebugInfoPrinter.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
ObjCARCAliasAnalysis.cpp [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
ObjCARCAnalysisUtils.cpp [ARC] Pull the ObjC ARC components that really serve the role of 2015-08-20 08:06:03 +00:00
ObjCARCInstKind.cpp Add support for objc_unsafeClaimAutoreleasedReturnValue to the 2016-01-27 19:05:08 +00:00
OrderedBasicBlock.cpp [CaptureTracker] Provide an ordered basic block to PointerMayBeCapturedBefore 2015-07-31 14:31:35 +00:00
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
PtrUseVisitor.cpp Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
README.txt
RegionInfo.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
RegionPass.cpp Change range-based for-loops to be -Wrange-loop-analysis clean. 2015-04-15 01:21:15 +00:00
RegionPrinter.cpp [RegionInfo] Add debug-time region viewer functions 2015-08-10 13:21:59 +00:00
ScalarEvolution.cpp [SCEV][LAA] Re-commit r260085 and r260086, this time with a fix for the memory 2016-02-08 17:02:45 +00:00
ScalarEvolutionAliasAnalysis.cpp [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
ScalarEvolutionExpander.cpp [SCEV][LAA] Re-commit r260085 and r260086, this time with a fix for the memory 2016-02-08 17:02:45 +00:00
ScalarEvolutionNormalization.cpp Analysis: Remove implicit ilist iterator conversions 2015-10-10 00:53:03 +00:00
ScopedNoAliasAA.cpp rangify; NFCI 2016-01-13 18:37:28 +00:00
SparsePropagation.cpp Analysis: Remove implicit ilist iterator conversions 2015-10-10 00:53:03 +00:00
StratifiedSets.h Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
TargetLibraryInfo.cpp Disable all standard lib functions for NVVM. 2016-01-26 23:51:06 +00:00
TargetTransformInfo.cpp [TTI] Add getPrefetchDistance from PPCLoopDataPrefetch, NFC 2016-01-27 22:21:25 +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 fix typo 2016-01-13 16:34:10 +00:00
ValueTracking.cpp [ValueTracking] Improve isKnownNonZero for PHI of non-zero constants 2016-02-01 17:03:07 +00:00
VectorUtils.cpp [opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType. 2016-01-19 17:28:00 +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))

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