llvm-6502/lib/Analysis
Sanjoy Das 7f0da20b97 Fix PR22179.
We were incorrectly inferring nsw for certain SCEVs. We can be more
aggressive here (see Richard Smith's comment on
http://llvm.org/bugs/show_bug.cgi?id=22179) but this change just
focuses on correctness.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225591 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-10 23:41:24 +00:00
..
IPA [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
AliasAnalysis.cpp Sink store based on alias analysis 2014-12-15 14:09:53 +00:00
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp
AliasDebugger.cpp
AliasSetTracker.cpp AliasSet: Simplify mergeSetIn 2014-11-19 19:36:18 +00:00
Analysis.cpp Revert "Don't make assumptions about the name of private global variables." 2014-11-15 02:03:53 +00:00
AssumptionCache.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
BasicAliasAnalysis.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp BFI: Saturate when combining edges to a successor 2014-12-05 19:13:42 +00:00
BranchProbabilityInfo.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
CaptureTracking.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
CFG.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
CFGPrinter.cpp
CFLAliasAnalysis.cpp Remove redundant virtual on overriden functions. 2014-11-14 19:06:36 +00:00
CGSCCPassManager.cpp [PM] Fix a pretty nasty bug where the new pass manager would invalidate 2015-01-07 01:58:35 +00:00
CMakeLists.txt [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
CodeMetrics.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
ConstantFolding.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
CostModel.cpp
Delinearization.cpp
DependenceAnalysis.cpp [DependenceAnalysis] Allow subscripts of different types 2014-11-16 16:52:44 +00:00
DominanceFrontier.cpp
DomPrinter.cpp
FunctionTargetTransformInfo.cpp
InstCount.cpp
InstructionSimplify.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.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
JumpInstrTableInfo.cpp Add Forward Control-Flow Integrity. 2014-11-11 21:08:02 +00:00
LazyCallGraph.cpp [PM] Switch the new pass manager to use a reference-based API for IR 2015-01-05 02:47:05 +00:00
LazyValueInfo.cpp remove names from comments; NFC 2015-01-09 16:47:20 +00:00
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp remove function names from comments; NFC 2014-10-21 18:26:57 +00:00
Lint.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
LLVMBuild.txt
Loads.cpp Revert r220349 to re-instate r220277 with a fix for PR21330 -- quite 2014-11-25 08:20:27 +00:00
LoopInfo.cpp Revert "IR: MDNode => Value" 2014-11-11 21:30:22 +00:00
LoopPass.cpp Fix assertion in LICM doFinalization() 2014-09-24 16:48:31 +00:00
Makefile
MemDepPrinter.cpp [REFACTOR] Push logic from MemDepPrinter into getNonLocalPointerDependency 2015-01-09 00:26:45 +00:00
MemoryBuiltins.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
MemoryDependenceAnalysis.cpp [REFACTOR] Push logic from MemDepPrinter into getNonLocalPointerDependency 2015-01-09 00:26:45 +00:00
ModuleDebugInfoPrinter.cpp
NoAliasAnalysis.cpp Simplify code. No functionality change. 2014-10-05 12:21:57 +00:00
PHITransAddr.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +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
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp Fix PR22179. 2015-01-10 23:41:24 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp Revert "IR: MDNode => Value" 2014-11-11 21:30:22 +00:00
SparsePropagation.cpp
StratifiedSets.h Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
TargetTransformInfo.cpp Remove empty statement. No functionality change. 2015-01-08 00:47:03 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
ValueTracking.cpp Analysis: Reformulate WillNotOverflowUnsignedAdd for reusability 2015-01-07 00:39:50 +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))

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