Commit Graph

813 Commits

Author SHA1 Message Date
Chris Lattner
fb312c7e44 Promoting allocas with the 'single store' fastpath is
faster than with the 'local to a block' fastpath.  This speeds
up PR1432 from 2.1232 to 2.0686s (2.6%)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40818 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 20:03:23 +00:00
Chris Lattner
7a5745b38c When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
to increment NumLocalPromoted, and didn't actually delete the
dead alloca, leading to an extra iteration of mem2reg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 20:01:43 +00:00
Chris Lattner
59a2837715 std::map -> DenseMap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40816 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 19:52:20 +00:00
Chris Lattner
c69e491575 fix a logic bug where we wouldn't promote single store allocas if the
stored value was a non-instruction value.  Doh.

This increase the # single store allocas from 8982 to 9026, and
speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40813 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 02:45:02 +00:00
Chris Lattner
4f63e76cda When we do the single-store optimization, delete both the store
and the alloca so they don't get reprocessed.

This speeds up PR1432 from 2.20s to 2.17s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40812 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 02:38:38 +00:00
Chris Lattner
d0458e5d4f Three improvements:
1. Check for revisiting a block before checking domination, which is faster.
  2. If the stored value isn't an instruction, we don't have to check for domination.
  3. If we have a value used in the same block more than once, make sure to remove the
     block from the UsingBlocks vector.  Not doing so forces us to go through the slow
     path for the alloca.

The combination of these improvements increases the number of allocas on the fastpath
from 8935 to 8982 on PR1432.  This speeds it up from 2.90s to 2.20s (31%)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40811 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 02:32:22 +00:00
Chris Lattner
c3f6ea8330 switch from using a std::set to using a SmallPtrSet. This speeds up the
testcase in PR1432 from 6.33s to 2.90s (2.22x)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40810 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 02:21:22 +00:00
Chris Lattner
b776a335b1 In mem2reg, when handling the single-store case, make sure to remove
a using block from the list if we handle it.  Not doing this caused us
to not be able to promote (with the fast path) allocas which have uses (whoops).

This increases the # allocas hitting this fastpath from 4042 to 8935 on the
testcase in PR1432, speeding up mem2reg by 2.6x



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40809 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 02:15:24 +00:00
Chris Lattner
5dd75b4ca7 split rewriting of single-store allocas into its own
method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40806 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:47:41 +00:00
Chris Lattner
bbe104002f refactor some code to shrink PromoteMem2Reg::run a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40805 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:41:18 +00:00
Chris Lattner
483ce14bf4 add a typedef, no other change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40804 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:19:38 +00:00
Chris Lattner
63cdcaa3d6 avoid an unneeded vector copy. This speeds up mem2reg on the testcase
in PR1432 by 6%


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40803 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:07:49 +00:00
Chris Lattner
ac4aa4be9b make RenamePassWorkList a local var instead of an ivar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40802 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:04:40 +00:00
Dan Gohman
c2bbfc18e9 More explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40673 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 15:32:29 +00:00
David Greene
52eec54820 New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 03:43:44 +00:00
Devang Patel
81a129c0fb LCSSA preserves dom info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40604 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 20:23:45 +00:00
Devang Patel
29381fb7cd Use SmallPtrSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40560 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-27 18:34:27 +00:00
Dan Gohman
37f3ee17d2 Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDead
to Instruction::mayWriteToMemory, fixing a FIXME, and helping
various places that call mayWriteToMemory directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40533 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-26 16:06:08 +00:00
Devang Patel
6899b31422 Add BasicInliner interface.
This interface allows clients to inline bunch of functions with module
level call graph information.:wq



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40486 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 18:00:25 +00:00
Devang Patel
58e0ef1e90 Verify loop info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40062 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 18:02:32 +00:00
Devang Patel
a8a8a36629 After a basic block is split into two parts,
second part dominates all the blocks dominated
by original basic block. And first part dominates
second part.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40035 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 02:29:24 +00:00
Devang Patel
72ea8d9060 Now this temp. fix is not required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40034 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 02:22:21 +00:00
Reid Spencer
bde6869ef4 Return Undef if the block has no dominator. This was required to allow
llvm-gcc build to succeed. Without this change it fails in libstdc++
compilation. This causes no regressions in dejagnu tests. However, 
someone who knows this code better might want to review it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39924 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:03:44 +00:00
Dan Gohman
07a96765da Fix comments about vectors to use the current wording.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 14:29:03 +00:00
Devang Patel
b4559a2179 Make LCSSA a loop pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39844 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:57:11 +00:00
Tanya Lattner
08d14d2469 Adding ability to demote phi to stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39744 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 18:41:34 +00:00
Anton Korobeynikov
a289511090 During module cloning copy aliases too. This fixes PR1544
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38505 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 19:07:35 +00:00
Devang Patel
8019893c3f Add SplitEdge and SplitBlock utility routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 21:39:20 +00:00
David Greene
c08fa28897 Fix reference to iterator invalidated by an erase operation. Uncovered
by _GLIBCXX_DEBUG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 02:53:16 +00:00
Devang Patel
0e7f728ad1 Move code to update dominator information after basic block is split
from LoopSimplify.cpp to Dominator.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37689 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 17:23:45 +00:00
Devang Patel
fe7d4e50b8 Add and use DominatorTreeBase::findNearestCommonDominator().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37545 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 23:31:22 +00:00
Devang Patel
f60e5a2cd9 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37542 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:45:31 +00:00
Devang Patel
b28aaadfff simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37541 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:25:31 +00:00
Devang Patel
e3f653606d Simplify. Dominator Tree is required so always available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37540 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:18:00 +00:00
Devang Patel
dba2413b2e Update LoopSimplify to require and preserve DominatorTree only.
Now LoopSimplify does not require nor preserve ETForest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37512 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 01:50:32 +00:00
Devang Patel
f86a73cbef Do not preserve ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37506 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 00:02:08 +00:00
Devang Patel
4b90e3a276 Do not use ETForest as well as DomiantorTree. DominatorTree is sufficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 22:17:16 +00:00
Devang Patel
326821ef12 Use DominatorTree instead of ETForest.
This allows faster immediate domiantor walk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37500 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 21:57:03 +00:00
Devang Patel
9a51157db5 Maintain ETNode as part of DomTreeNode.
This adds redundancy for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37492 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 17:47:21 +00:00
Devang Patel
83beaee227 s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 16:43:25 +00:00
Devang Patel
26a6908768 Add basic block level interface to change immediate dominator
and create new node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 16:22:33 +00:00
Devang Patel
26042420d6 s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 00:32:22 +00:00
Devang Patel
bec7647f98 s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 06:26:14 +00:00
Dan Gohman
fa73ea2d9f Minor comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 14:36:04 +00:00
Dan Gohman
23d9d27c26 Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36994 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 21:10:54 +00:00
Nick Lewycky
ecd94c804a Fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36873 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 13:37:16 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Devang Patel
68c01b3cf3 Mem2Reg does not need TargetData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36444 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 18:32:35 +00:00