1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

54 Commits

Author SHA1 Message Date
Chris Lattner
87f1ce9b96 This changes the PromoteMemToReg function to create "pruned" SSA form, not
"minimal" SSA form (in other words, it doesn't insert dead PHIs).  This
speeds up the mem2reg pass very significantly because it doesn't have to
do a lot of frivolous work in many common cases.

In the 252.eon function I have been playing with, this doesn't even insert
the 120 PHI nodes that it used to which were trivially dead (in the process
of promoting 356 alloca instructions overall).  This speeds up the mem2reg
pass from 1.2459s to 0.1284s.  More significantly, the DCE pass used to take
2.4138s to remove the 120 dead PHI nodes that mem2reg constructed, now it
takes 0.0134s (which is the time to scan the function and decide that there
is nothing dead).  So overall, on this one function, we speed things up a
total of 3.5179s, which is a 24.8x speedup!  :)

This change is tested by the Mem2Reg/2003-10-05-DeadPHIInsertion.ll test,
which now passes.

llvm-svn: 8884
2003-10-05 22:19:20 +00:00
Chris Lattner
d1c3f771f8 Change the interface to PromoteMemToReg to also take a DominatorTree
llvm-svn: 8883
2003-10-05 21:20:13 +00:00
Chris Lattner
47c12a2771 Speed up the mem2reg transform for allocas which are only read/written in a single
basic block.  This is amazingly common in code generated by the C/C++ front-ends.
This change makes it not have to insert ANY phi nodes, whereas before it would insert
a ton of dead ones which DCE would have to clean up.

Thus, this fix improves compile-time performance of these trivial allocas in two ways:
  1. It doesn't have to do the walking and book-keeping for renaming
  2. It does not insert dead phi nodes for them which would have to
     subsequently be cleaned up.

On my favorite testcase from 252.eon, this special case handles 305 out of
356 promoted allocas in the function.  It speeds up the mem2reg pass from 7.5256s
to 1.2505s.  It inserts 677 fewer dead PHI nodes, which speeds up a subsequent
-dce pass from 18.7524s to 2.4806s.

There are still 120 trivially dead PHI nodes being inserted for variables used
in multiple basic blocks, but they are not handled by this patch.

llvm-svn: 8881
2003-10-05 20:54:03 +00:00
Chris Lattner
ada012bfcd The first PHI node may be null, scan for the first non-null one
llvm-svn: 8865
2003-10-05 05:34:39 +00:00
Chris Lattner
a5fd39ee21 The VersionNumbers vector is only used during PHI placement. Turn it into an argument, allowing us to get rid of the vector.
llvm-svn: 8864
2003-10-05 04:33:22 +00:00
Chris Lattner
4877c37b80 * Update file header comment
*** Revamp the code which handled unreachable code in the function.  Now the
    code is much more efficient for high-degree basic blocks, such as those
    that occur in the 252.eon SPEC benchmark.

For the interested, the time to promote a SINGLE alloca in _ZN7mrScene4ReadERSi
function used to be > 3.5s.  Now it is < .075s.  The function has a LOT of
allocas in it, so it appeared to be infinite looping, this should make it much
nicer.  :)

llvm-svn: 8863
2003-10-05 04:26:39 +00:00
Chris Lattner
baba417853 Simplify the loop a bit
llvm-svn: 8862
2003-10-05 03:45:44 +00:00
Chris Lattner
59281d3581 There is no need for separate WriteSets and PhiNodeBlocks lists. It is just a
work-list of value definitions.  This allows elimination of the explicit
'iterative' step of the algorithm, and also reuses temporary memory better.

llvm-svn: 8861
2003-10-05 03:39:10 +00:00
Chris Lattner
5958d93c95 The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable!

llvm-svn: 8860
2003-10-05 03:26:25 +00:00
Chris Lattner
91d69f2693 * Document instance vars better
* Fuse two parallel loops
* Use a more specific type for AllocaLookup

llvm-svn: 8859
2003-10-05 03:16:07 +00:00
Chris Lattner
773a1c4474 Two small cleanups/speedups:
* Do not insert a new entry into NewPhiNodes during the rename pass if there are no PHIs in a block.
 * Do not compute WriteSets in parallel

llvm-svn: 8858
2003-10-05 02:37:36 +00:00
Chris Lattner
9f0a542057 * Minor cleanups
* Eliminate the KillList instance variable, instead, just delete loads and
  stores as they are "renamed", and delete allocas when they are done
* Make the 'visited' set an instance variable to avoid passing it on the stack.

llvm-svn: 8857
2003-10-05 01:52:53 +00:00
Misha Brukman
56f7db4178 Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner
e1c995e9b6 Fix bug: mem2reg/2003-04-24-MultipleIdenticalSuccessors.ll
llvm-svn: 5919
2003-04-25 00:54:58 +00:00
Chris Lattner
043b4a7621 Fix iterator invalidation problem
llvm-svn: 5895
2003-04-24 17:52:20 +00:00
Chris Lattner
a489b529fe Fix bug where use still existed in dead code
llvm-svn: 5824
2003-04-21 19:15:26 +00:00
Chris Lattner
61d704329e Fix bug: Mem2reg/2003-04-18-DeadBlockProblem.ll
llvm-svn: 5810
2003-04-18 19:25:22 +00:00
Chris Lattner
0ac391e6c8 * Fix bug: Mem2Reg/2003-04-10-DFNotFound.ll
* Make Mem2Reg assign version numbers now for renamed variables instead of
  .mem2reg suffixes.  This produces what people think of as SSA.

llvm-svn: 5771
2003-04-10 19:41:13 +00:00
Chris Lattner
a49e96dda5 Change the mem2reg interface to accept a TargetData argument
llvm-svn: 5685
2003-03-03 17:25:18 +00:00
Chris Lattner
2e4c1c8640 Split mem2reg promotion into two parts: a function which does the work, and
a pass which wraps the function.  This allows other passes to use the functionality

llvm-svn: 5610
2003-02-22 23:57:48 +00:00
Chris Lattner
283d117dad Clean up std namespace references
llvm-svn: 5608
2003-02-22 22:25:17 +00:00
Chris Lattner
b565d3ac5b - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to
setPreservesCFG to be less confusing.

llvm-svn: 4255
2002-10-21 20:00:28 +00:00
Chris Lattner
7cf9f6f4b1 Updates to work with recent Statistic's changes:
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
    * Broke constructor to take two const char * arguments instead of one, so
      that indendation can be taken care of automatically.
    * Sort the list by pass name when printing
    * Make sure to print all statistics as a group, instead of randomly when
      the statistics dtors are called.
    * Updated ProgrammersManual with new semantics.

llvm-svn: 4002
2002-10-01 22:38:41 +00:00
Chris Lattner
2cf19d980a - Fix bug: Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
llvm-svn: 3917
2002-09-24 21:19:41 +00:00
Chris Lattner
37c3a1d80c Clean up code due to auto-insert constructors
llvm-svn: 3665
2002-09-10 22:38:47 +00:00
Chris Lattner
20b85d96e4 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
Chris Lattner
a21e315db4 - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument

llvm-svn: 3265
2002-08-08 19:01:30 +00:00
Chris Lattner
7a9eb848cd * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3113
2002-07-26 21:12:46 +00:00
Chris Lattner
c482880f9e *** empty log message ***
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
dfd421a7df MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner
adba963886 Add support for printing out statistics information when -stats is added to
the command line

llvm-svn: 2601
2002-05-10 15:38:35 +00:00
Chris Lattner
2a43c7c03d Merge all individual .h files into a single Scalar.h file
llvm-svn: 2537
2002-05-07 20:03:00 +00:00
Chris Lattner
8a6104c3cb Fixed bug: test/Regression/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
llvm-svn: 2423
2002-05-01 15:38:23 +00:00
Chris Lattner
f5d07697e6 changes because iMemory.h no longer #includes DerivedTypes.h
This only requires Type.h anyway

llvm-svn: 2405
2002-04-29 18:48:30 +00:00
Chris Lattner
96e0c48175 Eliminate duplicate or unneccesary #include's
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner
589debc4ba Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.

llvm-svn: 2395
2002-04-29 14:57:45 +00:00
Chris Lattner
ec70d92221 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
llvm-svn: 2386
2002-04-28 21:27:06 +00:00
Chris Lattner
321a8cf4ba Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
50a089867d Eliminate the PromoteInstance class, incorporating it into the PromotePass
class.

llvm-svn: 2375
2002-04-28 19:12:38 +00:00
Chris Lattner
b8ade8715e Eliminate visited, CurrentValue, and WriteSets as instance variables of
PromoteInstance.  Make them local variables that are passed around as
appropriate.  Especially in the case of CurrentValue, this makes the
code simpler.

llvm-svn: 2374
2002-04-28 18:54:01 +00:00
Chris Lattner
1d9e63dca0 * Fix bug: test/Regression/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll
* Minor cleanup that was missed in last patch

llvm-svn: 2373
2002-04-28 18:39:46 +00:00
Chris Lattner
246083577b This huge changeset is a strictly cleanup change
Bugfixes will come in the next revision so that the diff is obvious.

llvm-svn: 2372
2002-04-28 18:27:55 +00:00
Chris Lattner
07fe96ca98 Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace

llvm-svn: 2370
2002-04-28 16:21:30 +00:00
Chris Lattner
741453dd60 Change the Dominator info and LoopInfo classes to keep track of BasicBlock's, not
const BasicBlocks

llvm-svn: 2337
2002-04-28 00:15:57 +00:00
Chris Lattner
536cf1b13f * Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well

llvm-svn: 2333
2002-04-27 06:56:12 +00:00
Chris Lattner
7ae20d642d Add #includes to make up for #includes pruned out of header files.
llvm-svn: 2207
2002-04-09 18:37:46 +00:00
Chris Lattner
31e5838296 s/Method/Function
Remove extraneous #includes of llvm/Assembly/Writer

llvm-svn: 2178
2002-04-08 22:03:00 +00:00
Chris Lattner
bc15ae64dd Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.

llvm-svn: 2144
2002-04-07 20:49:59 +00:00
Cameron Buschardt
49c09d5b24 * Move classes around
* rename constructor function
* Move stuff into anonymous namespaces

llvm-svn: 2007
2002-03-27 23:28:40 +00:00
Cameron Buschardt
bcff69b0f4 Implemented promote mem->reg pass.
llvm-svn: 2005
2002-03-27 23:17:37 +00:00