Commit Graph

4378 Commits

Author SHA1 Message Date
Chris Lattner
4e84e7720c Users can never be null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8895 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 17:33:39 +00:00
Chris Lattner
4bb7c02eba Minor speedups for the instcombine pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8894 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 17:11:01 +00:00
Chris Lattner
884d6c4e10 Speed up the predicate used to decide when to inline by caching the size
of callees between executions.

On eon, in release mode, this changes the inliner from taking 11.5712s
to taking 2.2066s.  In debug mode, it went from taking 14.4148s to
taking 7.0745s.  In release mode, this is a 24.7% speedup of gccas, in
debug mode, it's a total speedup of 11.7%.

This also makes it slightly more aggressive.  This could be because we
are not judging the size of the functions quite as accurately as before.
When we start looking at the performance of the generated code, this can
be investigated further.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8893 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 15:52:43 +00:00
Brian Gaeke
2c9b913fc0 Add # of printed instructions statistic to both the SPARC and X86 LLC backends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8892 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 15:41:21 +00:00
Chris Lattner
5f92e2b11f Avoid doing pointless work. Amazingly, this makes us go faster.
Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8890 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 15:23:43 +00:00
Chris Lattner
d5a310e4b3 Implement the NamedRegionTimer class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8889 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 15:02:31 +00:00
Brian Gaeke
378b524ba0 All of our supported operating systems (so far) and FreeBSD technically
want you to include <sys/stat.h> for fstat(), struct stat, and friends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8887 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 03:30:28 +00:00
Chris Lattner
69091be83b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8884 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 22:19:20 +00:00
Chris Lattner
43f820d1f7 Change the interface to PromoteMemToReg to also take a DominatorTree
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8883 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 21:20:13 +00:00
Chris Lattner
24011be956 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8881 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 20:54:03 +00:00
Chris Lattner
f708c7901d Move support/lib/Support back to lib/Support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8874 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:24:38 +00:00
Chris Lattner
d324e2501c Add support for the Invoke instruction by using the LowerInvoke pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8872 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:16:09 +00:00
Chris Lattner
c58c169eda Instead of hacking in custom support for Invoke/Unwind, use the LowerInvoke pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8871 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:15:47 +00:00
Chris Lattner
86e4445ec3 Initial checkin of the LLVM->LLVM transform to support code generators which
do not support stack unwinding yet


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8869 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:14:42 +00:00
Chris Lattner
b55803a9f4 simplify-cfg is really a function pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8868 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:14:16 +00:00
Chris Lattner
bede31ff3a Be more careful handling PHI nodes, which might be of potentially high degree.
This reduces the time to verify a function from eon with a large number of
large PHI nodes from 22996s (6.38 hours) to 10.5499s


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8866 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 17:44:18 +00:00
Chris Lattner
92e4975af4 The first PHI node may be null, scan for the first non-null one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8865 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 05:34:39 +00:00
Chris Lattner
3c881cb4ce The VersionNumbers vector is only used during PHI placement. Turn it into an argument, allowing us to get rid of the vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8864 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 04:33:22 +00:00
Chris Lattner
afa060ea3f * 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.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8863 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 04:26:39 +00:00
Chris Lattner
521c16aadd Simplify the loop a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8862 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:45:44 +00:00
Chris Lattner
92581c24a3 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8861 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:39:10 +00:00
Chris Lattner
036f1e7478 The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8860 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:26:25 +00:00
Chris Lattner
9e38fbf57f * Document instance vars better
* Fuse two parallel loops
* Use a more specific type for AllocaLookup


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8859 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:16:07 +00:00
Chris Lattner
9157f041ab 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8858 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 02:37:36 +00:00
Chris Lattner
0fa157127f * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8857 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 01:52:53 +00:00
Chris Lattner
dd76acac3f A couple of minor code cleanups.
Print literal doubles using ftostr instead of <<, because it yields higher precision numbers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8855 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 00:40:51 +00:00
Chris Lattner
ed468e37a1 Type tables are now AbstractTypeUsers. This allows them to merge together
constants as necessary due to type resolution.  With this change, the
following spec benchmarks now link: 176.gcc, 177.mesa, 252.eon,
253.perlbmk, & 300.twolf.  IOW, all SPEC INT and FP benchmarks now link.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8853 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 00:17:43 +00:00
Chris Lattner
00413e3d63 Rename AbstractModuleProvider -> ModuleProvider, to match the header file name,
and because, while the class used by the interface is abstract, the actual
concept is not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8850 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 20:14:59 +00:00
Chris Lattner
9e460f23bb Transform two methods to return pointers directly instead of returning them
as 'by reference' arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8849 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 20:00:03 +00:00
Chris Lattner
51ca860bda Use V for values, not D.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8848 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 19:29:21 +00:00
Chris Lattner
a983359f59 Do not leak the ModuleProvider if releaseModule() throws.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8847 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-04 19:19:37 +00:00
Chris Lattner
70b06fc717 Minor random speedup: make Constant::getNullValue only call ConstantFOO::get
once!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8845 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-03 19:34:51 +00:00
Chris Lattner
23c3288ce9 Explicit copy ctors are no longer needed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8844 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-03 19:02:41 +00:00
Chris Lattner
af6f93ce35 Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8843 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-03 18:57:54 +00:00
Chris Lattner
7685ac8d35 This checkin basically amounts to a complete rewrite of the type-resolution
machinery.  This dramatically simplifies how things works, removes irritating
little corner cases, and overall improves speed and reliability.

Highlights of this change are:

1. The exponential algorithm built into the code is now gone.  For example
   the time to disassemble one bytecode file from the mesa benchmark went
   from taking 12.5s to taking 0.16s.
2. The linker bugs should be dramatically reduced.  The one remaining bug
   has to do with constant handling, which I actually introduced in
   "union-find" checkins.
3. The code is much easier to follow, as a result of fewer special cases.
   It's probably also smaller.  yaay.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8842 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-03 18:46:24 +00:00
Chris Lattner
9ad4dac582 These methods are dead, remove them. Because the bodies will soon be
ressurected, just ifdef them out for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8840 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-03 18:39:57 +00:00
Chris Lattner
8ef852f4ea Dramatically simplify DerivedType::refineAbstractTypeToInternal
This makes use of the new PATypeHolder's to keep types from being deleted
prematurely, instead of the wierd "self reference" garbage.  This is easier
to understand and more efficient as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8834 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-03 04:48:21 +00:00
Chris Lattner
1c5164e9cf Make the PATypeHolder use a simple union-find implementation to handle
merging of types.  This makes it MUCH more efficient than before, also
making things simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8833 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 23:35:57 +00:00
Chris Lattner
c7b6f03501 There is no need for BytecodeParser to be an AbstractTypeUser. Instead, it
can just use PATypeHolders


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8832 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 20:26:18 +00:00
Chris Lattner
3200219843 There is no reason for Value to be an AbstractTypeUser. This just makes things
significantly more complete.  Instead, just make DerivedType's AbstractTypeUser's,
and make Value contain a PATypeHolder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8828 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 19:44:40 +00:00
Chris Lattner
876dc577d5 The objects mapped are really PATypeHolders, not PATypeHandles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8822 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 19:00:34 +00:00
Alkis Evlogimenos
7237ecef13 Moved enum and command-line option in separate file. Also added function that returns the user selected register allocator to the caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8819 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 16:57:49 +00:00
Chris Lattner
6b032052cc Implement InstCombine/add.ll:test17 & 18
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8817 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 15:11:26 +00:00
Alkis Evlogimenos
eed462b685 Change llc command line for register allocators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8815 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 06:13:19 +00:00
Alkis Evlogimenos
b5c1af4773 Use std::string::size_type for for ColonPos to stop gcc from giving a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8811 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-01 22:49:22 +00:00
Alkis Evlogimenos
77e78d050a Revert previous change. For some reason this went into the main branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8805 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-01 19:40:13 +00:00
Alkis Evlogimenos
6ac2c8c673 Added command line option for linear scan allocator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8804 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-01 19:38:10 +00:00
Misha Brukman
99b2d3d852 The comment seems irrelevant as the pass has become a BasicBlock pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8803 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-01 05:24:50 +00:00
Chris Lattner
56d225116f Make sure to get the definition of getRegisterAllocator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8801 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-30 22:24:00 +00:00
Chris Lattner
9cd3fe9c6d RegisterAllocation.h is going away
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8795 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-30 20:15:04 +00:00