llvm-6502/lib/Analysis
Dan Gohman 655b5a48b9 Delete code for folding undefs in ScalarEvolution. It's invalid in
obscure ways, and it isn't actually important in the real world.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159969 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 23:51:20 +00:00
..
IPA RefreshCallGraph: ignore 'invoke intrinsic'. IntrinsicInst doesnt not recognize invoke, and shouldnt at this point, since the rest of LLVM codebase doesnt expect invoke of intrinsics 2012-06-29 17:49:32 +00:00
AliasAnalysis.cpp
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp
AliasDebugger.cpp
AliasSetTracker.cpp Reduce use list thrashing by using DenseMap's find_as for maps with ValueHandle keys. 2012-06-30 22:37:15 +00:00
Analysis.cpp
BasicAliasAnalysis.cpp refactor the MemoryBuiltin analysis: 2012-06-21 15:45:28 +00:00
BlockFrequencyInfo.cpp
BranchProbabilityInfo.cpp
CaptureTracking.cpp
CFGPrinter.cpp
CMakeLists.txt Update the CMake files. 2012-06-29 09:01:47 +00:00
CodeMetrics.cpp
ConstantFolding.cpp
DbgInfoPrinter.cpp Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and 2012-06-28 00:05:13 +00:00
DominanceFrontier.cpp
DomPrinter.cpp
InlineCost.cpp
InstCount.cpp
InstructionSimplify.cpp
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp
LazyValueInfo.cpp make LazyValueInfo analyze the default case of switch statements (we know that in the default branch the value cannot be any of the switch cases) 2012-06-28 16:13:37 +00:00
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp
Lint.cpp
LLVMBuild.txt
Loads.cpp
LoopDependenceAnalysis.cpp
LoopInfo.cpp Enable the new LoopInfo algorithm by default. 2012-06-26 04:11:38 +00:00
LoopPass.cpp Enable the new LoopInfo algorithm by default. 2012-06-26 04:11:38 +00:00
Makefile
MemDepPrinter.cpp
MemoryBuiltins.cpp fold PHI nodes in SizeOffsetEvaluator whenever possible. 2012-07-03 17:13:25 +00:00
MemoryDependenceAnalysis.cpp refactor the MemoryBuiltin analysis: 2012-06-21 15:45:28 +00:00
ModuleDebugInfoPrinter.cpp Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and 2012-06-28 00:05:13 +00:00
NoAliasAnalysis.cpp
PathNumbering.cpp
PathProfileInfo.cpp
PathProfileVerifier.cpp
PHITransAddr.cpp
PostDominators.cpp
ProfileEstimatorPass.cpp
ProfileInfo.cpp
ProfileInfoLoader.cpp Round 2 of dead private variable removal. 2012-06-06 19:47:08 +00:00
ProfileInfoLoaderPass.cpp Round 2 of dead private variable removal. 2012-06-06 19:47:08 +00:00
ProfileVerifierPass.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp Delete code for folding undefs in ScalarEvolution. It's invalid in 2012-07-09 23:51:20 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp
ScalarEvolutionNormalization.cpp
SparsePropagation.cpp
Trace.cpp
TypeBasedAliasAnalysis.cpp
ValueTracking.cpp PHINode::hasConstantValue(): return undef if the PHI is fully recursive. 2012-07-03 21:15:40 +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))

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