llvm-6502/lib/Analysis
Suyog Sarda adf8ae4c10 Rectify r213231. Use proper version of 'ComputeNumSignBits'.
Earlier when the code was in InstCombine, we were calling the version of ComputeNumSignBits in InstCombine.h
that automatically added the DataLayout* before calling into ValueTracking.
When the code moved to InstSimplify, we are calling into ValueTracking directly without passing in the DataLayout*.
This patch rectifies the same by passing DataLayout in ComputeNumSignBits.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213295 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 19:07:00 +00:00
..
IPA Add new lines to debugging information. 2014-07-03 02:11:49 +00:00
AliasAnalysis.cpp Improve BasicAA CS-CS queries (redux) 2014-07-17 01:28:25 +00:00
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp
AliasDebugger.cpp
AliasSetTracker.cpp
Analysis.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
BasicAliasAnalysis.cpp Improve BasicAA CS-CS queries (redux) 2014-07-17 01:28:25 +00:00
BlockFrequencyInfo.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
BlockFrequencyInfoImpl.cpp BFI: Add constructor for Weight 2014-07-12 00:26:00 +00:00
BranchProbabilityInfo.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp
CGSCCPassManager.cpp
CMakeLists.txt Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
CodeMetrics.cpp
ConstantFolding.cpp Look through addrspacecast in IsConstantOffsetFromGlobal 2014-07-14 22:39:26 +00:00
CostModel.cpp [CostModel][x86] Improved cost model for alternate shuffles. 2014-07-03 22:24:18 +00:00
Delinearization.cpp remove BasePointer before delinearizing 2014-05-27 22:41:51 +00:00
DependenceAnalysis.cpp remove BasePointer before delinearizing 2014-05-27 22:41:51 +00:00
DominanceFrontier.cpp Templatify DominanceFrontier. 2014-07-12 21:59:52 +00:00
DomPrinter.cpp
InstCount.cpp
InstructionSimplify.cpp Rectify r213231. Use proper version of 'ComputeNumSignBits'. 2014-07-17 19:07:00 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp Add back functionality removed in r210497. 2014-06-21 02:43:02 +00:00
JumpInstrTableInfo.cpp Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
LazyCallGraph.cpp
LazyValueInfo.cpp
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp
Lint.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
LLVMBuild.txt
Loads.cpp
LoopInfo.cpp
LoopPass.cpp Add back functionality removed in r210497. 2014-06-21 02:43:02 +00:00
Makefile
MemDepPrinter.cpp
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp
ModuleDebugInfoPrinter.cpp
NoAliasAnalysis.cpp Improve BasicAA CS-CS queries (redux) 2014-07-17 01:28:25 +00:00
PHITransAddr.cpp
PostDominators.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp Add back functionality removed in r210497. 2014-06-21 02:43:02 +00:00
RegionPrinter.cpp
ScalarEvolution.cpp ScalarEvolution: Derive element size from the type of the loaded element 2014-06-08 19:21:20 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp SCEVExpander: Fold constant PHIs harder. The logic below only understands proper IVs. 2014-06-21 11:47:18 +00:00
ScalarEvolutionNormalization.cpp test check-in: added missing parenthesis in comment 2014-05-28 19:03:33 +00:00
SparsePropagation.cpp
TargetTransformInfo.cpp
Trace.cpp
TypeBasedAliasAnalysis.cpp
ValueTracking.cpp Teach computeKnownBits to look through addrspacecast. 2014-07-15 01:55:03 +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))

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