llvm-6502/lib/Analysis
Shuxin Yang d2eaf45af4 Fix a problem in alias analysis. It is about the misinterpretation of "Object".
This problem is exposed by r171325 which is already reverted. It is rather
hard to fabricate a testing case without it.

r171325 should *NOT* be resurrected as it has a potential problem although 
this problem dosen't directly contribute to PR14988.

The bug is tracked by:
  - rdar://13063553, and
  - http://llvm.org/bugs/show_bug.cgi?id=14988

Thank Arnold for coming up a better solution to this problem. After
comparing this solution and my original proposal, I decided to ditch mine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176225 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 00:24:45 +00:00
..
IPA Begin fleshing out an interface in TTI for modelling the costs of 2013-01-22 11:26:02 +00:00
AliasAnalysis.cpp Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp since 2013-01-31 02:40:59 +00:00
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp
AliasDebugger.cpp
AliasSetTracker.cpp
Analysis.cpp
BasicAliasAnalysis.cpp Fix a problem in alias analysis. It is about the misinterpretation of "Object". 2013-02-28 00:24:45 +00:00
BlockFrequencyInfo.cpp
BranchProbabilityInfo.cpp
CaptureTracking.cpp
CFGPrinter.cpp
CMakeLists.txt
CodeMetrics.cpp Begin fleshing out an interface in TTI for modelling the costs of 2013-01-22 11:26:02 +00:00
ConstantFolding.cpp Constant fold vector bitcasts of halves similarly to how floats and doubles are folded. Test case included. 2013-02-26 22:51:07 +00:00
CostModel.cpp Cost model: Add check for reverse shuffles to CostModel analysis 2013-02-12 02:40:37 +00:00
DbgInfoPrinter.cpp
DependenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
InstCount.cpp
InstructionSimplify.cpp Identify and simplify idempotent intrinsics. Test case included. 2013-02-07 19:26:05 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp
LazyValueInfo.cpp Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp since 2013-01-31 02:40:59 +00:00
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp
Lint.cpp Change GetPointerBaseWithConstantOffset's DataLayout argument from a 2013-01-31 02:00:45 +00:00
LLVMBuild.txt
Loads.cpp Change GetPointerBaseWithConstantOffset's DataLayout argument from a 2013-01-31 02:00:45 +00:00
LoopInfo.cpp Metadata for annotating loops as parallel. The first consumer for this 2013-02-13 18:08:57 +00:00
LoopPass.cpp
Makefile
MemDepPrinter.cpp
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp Unify clang/llvm attributes for asan/tsan/msan (LLVM part) 2013-02-26 06:58:09 +00:00
ModuleDebugInfoPrinter.cpp
NoAliasAnalysis.cpp
PathNumbering.cpp
PathProfileInfo.cpp
PathProfileVerifier.cpp
PHITransAddr.cpp
PostDominators.cpp
ProfileDataLoader.cpp
ProfileDataLoaderPass.cpp Revert "Add LLVMContext::emitWarning methods and use them. <rdar://problem/12867368>" 2013-02-08 21:48:29 +00:00
ProfileEstimatorPass.cpp
ProfileInfo.cpp
ProfileInfoLoader.cpp
ProfileInfoLoaderPass.cpp Revert "Add LLVMContext::emitWarning methods and use them. <rdar://problem/12867368>" 2013-02-08 21:48:29 +00:00
ProfileVerifierPass.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp
ScalarEvolutionNormalization.cpp
SparsePropagation.cpp
TargetTransformInfo.cpp ARM cost model: Address computation in vector mem ops not free 2013-02-08 14:50:48 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
ValueTracking.cpp Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp since 2013-01-31 02:40:59 +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))

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