Commit Graph

3511 Commits

Author SHA1 Message Date
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
Chris Lattner
9132a2b818 rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41309 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 05:15:32 +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
Devang Patel
a24d918063 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41292 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 20:55:18 +00:00
Devang Patel
a8644e306d Cosmetic change
"True Loop" and "False Loop" naming terminology to refer two loops
after loop cloning is confusing. Instead just use A_Loop and B_Loop.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 19:33:29 +00:00
Devang Patel
dc52395353 Refactor loop condition check in a separate function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41282 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 18:27:01 +00:00
Devang Patel
ea0fa97334 Fix thinko.
Starting value of second loop's induction variable can not be lower 
then starting value of original loop's induction variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 18:07:47 +00:00
Devang Patel
0b8e02b704 Rename bunch of variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41250 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 21:12:02 +00:00
Devang Patel
60cbab4252 Preserve LCSSA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41246 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 19:47:46 +00:00
Devang Patel
b7211a2ce1 Use SmallVector instead of std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41207 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 00:31:24 +00:00
Devang Patel
1cc2ec8d20 s/ExitBlock/ExitingBlock/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 23:51:18 +00:00
Devang Patel
ebc5fea695 Replace indunction variable with split value in loop body.
This fixes art miscompile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41195 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 20:49:01 +00:00
Devang Patel
d651f657f2 Do not split loops rejected by processOneIterationLoop().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41194 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 20:24:15 +00:00
Nick Lewycky
6694e31c49 Oops, remove assert that wasn't meant to be committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41170 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-18 23:21:28 +00:00
Nick Lewycky
c721223f73 Never insert duplicate edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41169 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-18 23:18:03 +00:00
Nick Lewycky
af5cbc82bb Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41168 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-18 15:08:56 +00:00
Devang Patel
20d260a193 Avoid spliting loops where two split condition branches are not independent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41148 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-18 00:00:32 +00:00
Devang Patel
96bf524b53 When one branch of condition is eliminated then head of the other
branch is not necessary immediate dominators of merge blcok in all cases.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41144 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-17 21:59:16 +00:00
Owen Anderson
1defe2df5d Factor out some code into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41131 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 22:51:56 +00:00
Owen Anderson
62bc33c954 Add some more comments to GVN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41129 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 22:02:55 +00:00
Devang Patel
7375bb9c8c Dominance frontier is now required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41096 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-15 03:34:53 +00:00
Devang Patel
5b8ec614f5 Cleanup removeBlocks.
Use dominance frontier to fixup incoming edges of successor blocks not domianted by DeadBB.
Use df_iterator to walk and delete basic blocks dominated by DeadBB.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41095 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-15 03:31:47 +00:00
Reid Spencer
e9dd95ad9c Remove unneeded header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41094 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-15 03:01:04 +00:00
Devang Patel
3fe4f2135a Avoid triangle loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41093 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-15 02:14:55 +00:00
Devang Patel
4f5d78e9c1 Break infinite loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41091 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 23:59:17 +00:00
Devang Patel
4e8061cbda Avoid nested loops at the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41090 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 23:53:57 +00:00
Devang Patel
a6a8663894 Fix dominance frontier update while removing blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:35:57 +00:00
Owen Anderson
31f496755a Eliminate PHI nodes with constant values during normal GVN processing, even when
they're not related to eliminating a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41081 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:33:27 +00:00
Owen Anderson
36057c7834 Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41080 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:16:29 +00:00
Owen Anderson
3e75a42ee2 Make GVN iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41078 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:04:11 +00:00
Owen Anderson
8e8278e7fe Fix a case where GVN was failing to return true when it had, in fact, modified
the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41077 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 17:59:48 +00:00
Devang Patel
ada054a9ea Handle last value assignments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41063 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 01:30:57 +00:00
Devang Patel
ebcb52aa89 StartValue is already calculated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41062 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 00:15:45 +00:00
Devang Patel
21eca2a9cf Preserve simple analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41054 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 22:22:13 +00:00
Devang Patel
fc4c5f82f8 Preserve dominator info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41053 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 22:13:24 +00:00
Devang Patel
6acc9e6b7b If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41051 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 21:59:17 +00:00
Devang Patel
98147a306e Split loops and do CFG cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41029 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 07:02:51 +00:00
Reid Spencer
9626a9c700 Remove unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41028 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 04:45:36 +00:00
Chris Lattner
8d2e88806b Transform a load from an undef/zero global into an undef/global even if we
have complex pointer manipulation going on.  This allows us to compile
stuff like this:

__m128i foo(__m128i x){
                static const unsigned int c_0[4] = { 0, 0, 0, 0 };
                __m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
                x  = _mm_unpacklo_epi8(x,  v_Zero);
                return x;
}

into:

_foo:
        xorps   %xmm1, %xmm1
        punpcklbw       %xmm1, %xmm0
        ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41022 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 18:48:48 +00:00
Devang Patel
423c8b29b8 Clone loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40998 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 18:07:13 +00:00
Devang Patel
4bc2a0b420 Add utility to clone loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40997 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 17:59:47 +00:00
Devang Patel
acb8c09e27 Remove unncessary duplication.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40979 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 00:59:03 +00:00
Devang Patel
23a19f82a7 Calculate exit and start value of true loop and false loop respectively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40978 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 00:53:35 +00:00
Devang Patel
bacf5193cf ExitCondition and Induction variable are loop constraints
not split condition constraints.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40977 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 00:33:50 +00:00
Chris Lattner
f2369f2042 when we see a unaligned load from an insufficiently aligned global or
alloca, increase the alignment of the load, turning it into an aligned load.

This allows us to compile:

#include <xmmintrin.h>
__m128i foo(__m128i x){
 static const unsigned int c_0[4] = { 0, 0, 0, 0 };
	  __m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
  x  = _mm_unpacklo_epi8(x,  v_Zero);
  return x;
}

into:

_foo:
	punpcklbw	_c_0.5944, %xmm0
	ret
	.data
	.lcomm	_c_0.5944,16,4		# c_0.5944

instead of:

_foo:
	movdqu	_c_0.5944, %xmm1
	punpcklbw	%xmm1, %xmm0
	ret
	.data
	.lcomm	_c_0.5944,16,2		# c_0.5944



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 19:05:49 +00:00