Commit Graph

86 Commits

Author SHA1 Message Date
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
Devang Patel
d79faee69a Move exit condition and exit branch from exiting block into loop header and dominator info. This avoid execution of dead iteration. Loop is already filter in the beginning such that this change is safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25 02:39:24 +00:00
Devang Patel
be97c986e1 Constant split values needs upper bound and lower bound check, just like any other split value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41389 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25 01:09:14 +00:00
Devang Patel
4a69da9cb0 While calculating upper loop bound for first loop and lower loop bound for second loop, take care of edge cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41387 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25 00:56:38 +00:00
Devang Patel
7097e9a710 Fix regression that I caused yesterday night while adding logic to select appropriate split condition branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41365 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 19:32:26 +00:00
Devang Patel
4259fe3281 It is not safe to execute split condition's true branch first all the time. If split
condition predicate is GT or GE then execute false branch first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 06:17:19 +00:00
Devang Patel
c830aee8e8 Reject ICMP_NE as index split condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41357 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 06:02:25 +00:00
Devang Patel
b88e4200cf Tightenup loop filter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41356 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 05:36:56 +00:00
Devang Patel
7237d1167a Remove incomplete cost analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41354 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 05:21:13 +00:00
Devang Patel
40fc353a0d Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41295 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 21:07:41 +00:00