Commit Graph

244 Commits

Author SHA1 Message Date
Chris Lattner
bebd86d58e The preheader insertion pass only depends on the CFG. Mark it as such, which
allows GCCAS to only run it once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9056 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-12 19:33:10 +00:00
Misha Brukman
cf00c4ab3b Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9027 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 17:57:28 +00:00
Chris Lattner
ebbc1a5aa0 Bill contributed this major rewrite of the -lowerswitch pass to make it generate
logarithmic conditional branch sequences instead of linear sequences.  Thanks Bill!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8928 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 18:46:23 +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
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
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
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
dd7036d19a Fix bugs in the last change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8667 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:30:59 +00:00
Chris Lattner
f98a084908 Fix bug: Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8666 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 22:35:39 +00:00
Chris Lattner
51d6816089 Fix bug: Inline/2003-09-22-PHINodesInExceptionDest.ll
... by making sure to update PHI nodes to take into consideration the
extra edges we get if we inline a call instruction through an invoke.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8664 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 21:59:27 +00:00
Chris Lattner
02a3be020a Rename Function::getEntryNode -> getEntryBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8625 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 14:39:18 +00:00
Chris Lattner
ab4536e353 Minor cleanups, no functional changes
Rename Function::getEntryNode -> getEntryBlock


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8623 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 14:36:23 +00:00
Chris Lattner
e07007c2bd Fix bug: Inline/2003-09-14-InlineValue.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8514 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 02:10:16 +00:00
Chris Lattner
c444a4228f Renamed DominatorTree::Node::getNode() -> getBlock()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8469 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 16:26:13 +00:00
Chris Lattner
f46057be77 Expand the pass to unify all of the unwind blocks as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8456 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 20:34:51 +00:00
Misha Brukman
dfa5f83c8e Spell `occurrence' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8425 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-09 21:54:45 +00:00
Chris Lattner
ee5457cbe8 Eliminate support for the llvm.unwind intrinisic, using the Unwind instruction instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8411 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 19:44:26 +00:00
Chris Lattner
e4d9096409 Should invokify is always true
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8409 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 19:00:30 +00:00
Chris Lattner
7d8a86aa59 Use new interface, simplifies code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8242 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 00:22:27 +00:00
Chris Lattner
841e00b962 Fix bug where we considered function types equivalent even if they had differing numbers of arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8178 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-28 16:42:50 +00:00
Chris Lattner
f30862f33b Remove special casing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8144 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-25 22:34:15 +00:00
Chris Lattner
77c5f733ac Fix bug: Linker/2003-08-23-GlobalVarLinking.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8130 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 19:30:20 +00:00
Chris Lattner
873c5e7859 Implement: Linker/2003-08-24-InheritPtrSize.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8129 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 19:26:42 +00:00
Chris Lattner
dc3602bf0d Implement SimplifyCFG/InvokeEliminate.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8126 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 18:36:16 +00:00
Chris Lattner
657fbe68b8 rethrow is really the language independent primitive here. "throw" can be written
in terms of it and llvm.exc.setcurrent.
Rework the intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8111 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 12:24:11 +00:00
Chris Lattner
80a38d2453 *** Implement inlining of Invoke instructions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8106 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 06:59:16 +00:00
Chris Lattner
7152c237b4 Implement: Inline/cfg_preserve_test.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8099 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 04:06:56 +00:00
Chris Lattner
7d6c24cdbf Implement SimplifyCFG/2003-08-17-FoldSwitch.ll:test5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8093 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 23:18:19 +00:00
Chris Lattner
44bb541c01 Fix bug: LowerSwitch/2003-08-23-EmptySwitch.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8087 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 22:54:34 +00:00
Chris Lattner
f44c6051e0 Do not consider any types that exist in the global symbol table!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8084 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 21:32:24 +00:00
Chris Lattner
e3092c94ad Fix bug: Linker/2003-08-23-RecursiveOpaqueTypeResolve.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8083 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 21:25:54 +00:00
Chris Lattner
fcd0234de6 Implement Linker/2003-08-23-GlobalVarLinking.ll, which should fix 176.gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8080 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 20:31:10 +00:00
Chris Lattner
9732be769e Fix typeo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8059 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 20:16:48 +00:00
Chris Lattner
43f4ba8c7d The process of linking types can cause their addresses to become invalid. For this reason, we must use TypeHandles!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8057 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 19:12:55 +00:00
Chris Lattner
e76c57ad46 Implement Linker/2003-08-20-OpaqueTypeResolve.ll
Hopefully this will fix the 176.gcc spec test as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8051 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 06:07:12 +00:00
Misha Brukman
ef6a6a69ff The word dependent' has no a'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8030 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-21 22:14:26 +00:00
Chris Lattner
e6f7f61cda Fix grammar, add comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7967 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-18 22:54:06 +00:00
Misha Brukman
5560c9d49c Spell `necessary' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7944 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-18 14:43:39 +00:00
Chris Lattner
10b1f5a941 Implement folding of switch instructions.
Implements SimplifyCFG/2003-08-17-FoldSwitch.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7923 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-17 20:21:14 +00:00
Chris Lattner
694e37f08a Fix bug: SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7921 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-17 19:41:53 +00:00