Commit Graph

95 Commits

Author SHA1 Message Date
Devang Patel
042b877e84 Fix spelling.
Thanks Duncan!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:07:24 +00:00
Devang Patel
3831005eb1 Rewrite code that 1) filters loops and 2) calculates new loop bounds.
This fixes many bugs. I will add more test cases in a separate check-in.

Some day, the code that manipulates CFG and updates dom. info could use refactoring help.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 21:38:42 +00:00
Devang Patel
d4e7f44319 If the sign of exit condition and split condition does not match
then do not split loop index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 19:48:34 +00:00
Daniel Dunbar
394f0441e0 Change create*Pass factory functions to return Pass* instead of
LoopPass*.
 - Although less precise, this means they can be used in clients
   without RTTI (who would otherwise need to include LoopPass.h, which
   eventually includes things using dynamic_cast). This was the
   simplest solution that presented itself, but I am happy to use a
   better one if available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58010 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 23:32:42 +00:00
Devang Patel
fc19fbd2ca Check loop exit predicate properly while eliminating one iteration loop.
This patch fixes PR 2869


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 22:02:57 +00:00
Devang Patel
d44b7c1b07 Fix typo, fix PR 2865.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 23:22:54 +00:00
Devang Patel
4fe0fe8b49 splitLoop does not handle split condition EQ.
Fixes PR 2805


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 23:45:14 +00:00
Devang Patel
00622952ce Do not ignore iv uses outside the loop.
This one slipped through cracks very well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56284 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 17:53:47 +00:00
Dan Gohman
ae73dc1448 Tidy up several unbeseeming casts from pointer to intptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 17:05:41 +00:00
Dan Gohman
a8c763b307 Use empty() instead of begin() == end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 18:13:49 +00:00
Devang Patel
a5e27f8028 If loop induction variable's start value is less then its exit value then do not split the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 00:12:01 +00:00
Dan Gohman
2864ce6065 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 18:00:21 +00:00
Devang Patel
52abbf5d8a Do not erase induction variable increment if it is used outside the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 22:23:55 +00:00
Gabor Greif
7cbd8a3e92 API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 19:29:10 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Bill Wendling
643310da6d Porting r50563 from Tak to mainline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 00:43:20 +00:00
Gabor Greif
051a950000 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:25:17 +00:00
David Greene
a022e3fc2f Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.

Re-apply 49056 with SmallVector support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49106 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 18:24:46 +00:00
Tanya Lattner
48afd9f8a9 Reverting 49056 due to the build being broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49060 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 23:41:44 +00:00
David Greene
da2903f028 Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 22:14:23 +00:00
Devang Patel
4a3c0ac798 PHI->removeIncomingValue may remove PHInode.
Increment iterator in advance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 17:32:46 +00:00
Devang Patel
60a12907c3 Add incoming value from header only if phi node has any use inside the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 20:16:14 +00:00
Devang Patel
9b03daa2a3 If loop header is also loop exiting block then OrigPN is incoming value for B loop header.
Fixes PR 2030.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 23:18:47 +00:00
Devang Patel
ea06906559 A loop latch phi node may have uses inside loop, not just in loop header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:23:07 +00:00
Devang Patel
23067dfeac While moving exit condition, do not drop loop latch on the floor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:06:36 +00:00
Devang Patel
02c4836f3d Keep track of exit value operand number when operands are swapped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 19:48:48 +00:00
Devang Patel
82ada54da0 Fix PR 1995.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:49:13 +00:00
Devang Patel
c840da14c6 Filter loops that subtract induction variables.
These loops are not yet handled.

Fix PR 1912.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:20:41 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Devang Patel
5ffdc56f53 If ExitValue operand is also defined in Loop header then
insert new ExitValue after this operand definition.

This fixes PR1828.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44539 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:17:21 +00:00
Devang Patel
a6dff2faeb Handle multiple induction variables.
This fixes PR714.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42309 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 18:24:48 +00:00
Devang Patel
1c01350f0f doh..
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42300 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 17:43:08 +00:00
Devang Patel
453a844128 Add transformation to update loop interation space. Now,
for (i=A; i<N; i++) {
  if (i < X && i > Y)
    do_something();
}

is transformed into

U=min(N,X); L=max(A,Y);
for (i=L;i<U;i++)
  do_somethihg();                            



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42299 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 17:31:19 +00:00
Devang Patel
3f65f02d25 Fix PR1692
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42209 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 21:18:19 +00:00
Devang Patel
d15dd8c525 Don't increment invalid iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42178 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20 23:01:50 +00:00
Devang Patel
babbe27007 Relax loop ExitCondition predicate restriction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42122 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 00:28:47 +00:00
Devang Patel
968eee2aa7 Filter loops where split condition's false branch is not empty. For example
for (int i = 0; i < N; ++i) {
  if (i == somevalue)
    dosomething();
   else
    dosomethingelse();
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42121 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 00:15:16 +00:00
Devang Patel
84ef08bfee Bail out early, before modifying anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42120 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 00:11:01 +00:00
Devang Patel
4e062e520a Work is incomplete. Loop is not modified at all right now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42119 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 00:08:13 +00:00
Devang Patel
8893ca6dab Do not eliminate loop when it is invalid to do so. For example,
for(int i = 0; i < N; i++) {
	if ( i == XYZ) {
		A;
	else
		B;
	}
	C;
	D;
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42058 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:01:05 +00:00
Devang Patel
5279d064bc Skeleton for transformations to truncate loop's iteration space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42054 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 20:39:48 +00:00
Bill Wendling
c68491069a Temporary reverting r41817
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053370.html). It's
causing SPASS to fail.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 01:13:55 +00:00
Devang Patel
c3957d1983 Avoid negative logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 01:10:45 +00:00
Devang Patel
d35ed2c16d Refactor code into a separate method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41826 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 00:42:56 +00:00
Devang Patel
964be45e7c Clear split info object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41823 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 00:23:56 +00:00
Devang Patel
4f12c5f615 Split condition does not have to be ICmpInst in all cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41822 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 00:12:56 +00:00
Devang Patel
ba32a5f3cc Check all terminators inside loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10 23:57:58 +00:00
Devang Patel
0c0f7c935b Swap exit condition operands if it works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10 23:34:06 +00:00
Devang Patel
9c7a9f186c Filter exit conditions which are not yet handled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41800 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10 18:33:42 +00:00
Devang Patel
1cd39a4f6e Use simpler test to filter loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41516 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27 21:34:31 +00:00