llvm-6502/lib/Analysis
Duncan P. N. Exon Smith f465370a49 Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl"
This reverts commit r206677, reapplying my BlockFrequencyInfo rewrite.

I've done a careful audit, added some asserts, and fixed a couple of
bugs (unfortunately, they were in unlikely code paths).  There's a small
chance that this will appease the failing bots [1][2].  (If so, great!)

If not, I have a follow-up commit ready that will temporarily add
-debug-only=block-freq to the two failing tests, allowing me to compare
the code path between what the failing bots and what my machines (and
the rest of the bots) are doing.  Once I've triggered those builds, I'll
revert both commits so the bots go green again.

[1]: http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/1816
[2]: http://llvm-amd64.freebsd.your.org/b/builders/clang-i386-freebsd/builds/18445

<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206704 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-19 22:34:26 +00:00
..
IPA remove some dead code 2014-04-17 22:26:44 +00:00
AliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
AliasAnalysisCounter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
AliasAnalysisEvaluator.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 07:30:04 +00:00
AliasDebugger.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 07:30:04 +00:00
AliasSetTracker.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Analysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
BasicAliasAnalysis.cpp Remove a couple of redundant copies of SmallVector::operator==. 2014-04-18 19:48:03 +00:00
BlockFrequencyInfo.cpp Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" 2014-04-19 22:34:26 +00:00
BlockFrequencyInfoImpl.cpp Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" 2014-04-19 22:34:26 +00:00
BranchProbabilityInfo.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CaptureTracking.cpp [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +00:00
CFG.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CFGPrinter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CMakeLists.txt Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" 2014-04-19 22:34:26 +00:00
CodeMetrics.cpp Consistent use of the noduplicate attribute. 2014-03-17 16:19:07 +00:00
ConstantFolding.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CostModel.cpp Remove a couple of redundant copies of SmallVector::operator==. 2014-04-18 19:48:03 +00:00
Delinearization.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
DependenceAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
DominanceFrontier.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
DomPrinter.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
InstCount.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
InstructionSimplify.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Interval.cpp [Modules] Move CFG.h to the IR library as it defines graph traits over 2014-03-04 11:45:46 +00:00
IntervalPartition.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
IVUsers.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LazyCallGraph.cpp [LCG] Fix the bugs that Ben pointed out in code review (and the MSan bot 2014-04-18 20:44:16 +00:00
LazyValueInfo.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LibCallAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LibCallSemantics.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Lint.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Loads.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LoopInfo.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LoopPass.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Makefile
MemDepPrinter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
MemoryBuiltins.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
MemoryDependenceAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
ModuleDebugInfoPrinter.cpp [C++11] Change DebugInfoFinder to use range-based loops 2014-03-18 09:41:07 +00:00
NoAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
PHITransAddr.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
PostDominators.cpp [Modules] Move CFG.h to the IR library as it defines graph traits over 2014-03-04 11:45:46 +00:00
PtrUseVisitor.cpp [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +00:00
README.txt
RegionInfo.cpp RegionInfo: Do not access a value that was just moved away 2014-04-15 22:09:36 +00:00
RegionPass.cpp remove some dead code 2014-04-17 22:26:44 +00:00
RegionPrinter.cpp Use unique_ptr to manage ownership of child Regions within llvm::Region 2014-04-15 18:32:43 +00:00
ScalarEvolution.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
ScalarEvolutionAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
ScalarEvolutionExpander.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
ScalarEvolutionNormalization.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
SparsePropagation.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
TargetTransformInfo.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Trace.cpp Put the functionality for printing a value to a raw_ostream as an 2014-01-09 02:29:41 +00:00
TypeBasedAliasAnalysis.cpp remove some dead code 2014-04-17 22:26:44 +00:00
ValueTracking.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +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))

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