3497 Commits

Author SHA1 Message Date
Devang Patel
49c4f9a889 Replace indunction variable with split value in loop body.
This fixes art miscompile.

llvm-svn: 41195
2007-08-20 20:49:01 +00:00
Devang Patel
c2e2d15f45 Do not split loops rejected by processOneIterationLoop().
llvm-svn: 41194
2007-08-20 20:24:15 +00:00
Nick Lewycky
bfa9499a88 Oops, remove assert that wasn't meant to be committed.
llvm-svn: 41170
2007-08-18 23:21:28 +00:00
Nick Lewycky
5b5b1ab9e0 Never insert duplicate edges.
llvm-svn: 41169
2007-08-18 23:18:03 +00:00
Nick Lewycky
a0d49dac26 Typo.
llvm-svn: 41168
2007-08-18 15:08:56 +00:00
Devang Patel
1282b6e181 Avoid spliting loops where two split condition branches are not independent.
llvm-svn: 41148
2007-08-18 00:00:32 +00:00
Devang Patel
d1fcfcc76c When one branch of condition is eliminated then head of the other
branch is not necessary immediate dominators of merge blcok in all cases.

llvm-svn: 41144
2007-08-17 21:59:16 +00:00
Owen Anderson
f5023a7a84 Factor out some code into a helper function.
llvm-svn: 41131
2007-08-16 22:51:56 +00:00
Owen Anderson
221a43604e Add some more comments to GVN.
llvm-svn: 41129
2007-08-16 22:02:55 +00:00
Devang Patel
3640e78057 Dominance frontier is now required.
llvm-svn: 41096
2007-08-15 03:34:53 +00:00
Devang Patel
b81bcbde09 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.

llvm-svn: 41095
2007-08-15 03:31:47 +00:00
Reid Spencer
0db035567c Remove unneeded header file.
llvm-svn: 41094
2007-08-15 03:01:04 +00:00
Devang Patel
f55b79fa71 Avoid triangle loops.
llvm-svn: 41093
2007-08-15 02:14:55 +00:00
Devang Patel
22c7993ecf Break infinite loop.
llvm-svn: 41091
2007-08-14 23:59:17 +00:00
Devang Patel
7cad917160 Avoid nested loops at the moment.
llvm-svn: 41090
2007-08-14 23:53:57 +00:00
Devang Patel
33ba97d747 Fix dominance frontier update while removing blocks.
llvm-svn: 41082
2007-08-14 18:35:57 +00:00
Owen Anderson
bc271a02fd Eliminate PHI nodes with constant values during normal GVN processing, even when
they're not related to eliminating a load.

llvm-svn: 41081
2007-08-14 18:33:27 +00:00
Owen Anderson
398602a6eb Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.
llvm-svn: 41080
2007-08-14 18:16:29 +00:00
Owen Anderson
676070d503 Make GVN iterative.
llvm-svn: 41078
2007-08-14 18:04:11 +00:00
Owen Anderson
a7b220f23a Fix a case where GVN was failing to return true when it had, in fact, modified
the function.

llvm-svn: 41077
2007-08-14 17:59:48 +00:00
Devang Patel
dbe8497d45 Handle last value assignments.
llvm-svn: 41063
2007-08-14 01:30:57 +00:00
Devang Patel
f74ccbb4e8 StartValue is already calculated.
llvm-svn: 41062
2007-08-14 00:15:45 +00:00
Devang Patel
948653915f Preserve simple analysis.
llvm-svn: 41054
2007-08-13 22:22:13 +00:00
Devang Patel
b8a41bb4f1 Preserve dominator info.
llvm-svn: 41053
2007-08-13 22:13:24 +00:00
Devang Patel
da48cf40db If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.
llvm-svn: 41051
2007-08-13 21:59:17 +00:00
Devang Patel
f258578206 Split loops and do CFG cleanup.
llvm-svn: 41029
2007-08-12 07:02:51 +00:00
Reid Spencer
9f90f965de Remove unused variables.
llvm-svn: 41028
2007-08-12 04:45:36 +00:00
Chris Lattner
99c8ee2977 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

llvm-svn: 41022
2007-08-11 18:48:48 +00:00
Devang Patel
f417c2cc34 Clone loop.
llvm-svn: 40998
2007-08-10 18:07:13 +00:00
Devang Patel
aa36a43908 Add utility to clone loops.
llvm-svn: 40997
2007-08-10 17:59:47 +00:00
Devang Patel
9a4761464f Remove unncessary duplication.
llvm-svn: 40979
2007-08-10 00:59:03 +00:00
Devang Patel
7bdf4531bb Calculate exit and start value of true loop and false loop respectively.
llvm-svn: 40978
2007-08-10 00:53:35 +00:00
Devang Patel
67af6cd7ea ExitCondition and Induction variable are loop constraints
not split condition constraints.

llvm-svn: 40977
2007-08-10 00:33:50 +00:00
Chris Lattner
a8e4b4bc7b 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

llvm-svn: 40971
2007-08-09 19:05:49 +00:00
Owen Anderson
9b1cc8cac0 Make NonLocal and None const in the right way. :-)
llvm-svn: 40961
2007-08-09 04:42:44 +00:00
Devang Patel
42e3e5bec1 Traverse loop blocks' terminators to find split candidates.
llvm-svn: 40960
2007-08-09 01:39:01 +00:00
Devang Patel
0183c797c4 Add cost analysis.
llvm-svn: 40952
2007-08-08 22:25:28 +00:00
Devang Patel
0e34ee25ab Preserve dom info while processing one iteration loop.
llvm-svn: 40947
2007-08-08 21:39:47 +00:00
Owen Anderson
b84d3b1c92 Change the None and NonLocal markers in memdep to be const.
llvm-svn: 40946
2007-08-08 21:39:39 +00:00
Devang Patel
8abc5c82b7 Clear split info.
llvm-svn: 40944
2007-08-08 21:18:27 +00:00
Devang Patel
593bf9ceb3 Handle multiple split conditions.
llvm-svn: 40941
2007-08-08 21:02:17 +00:00
Owen Anderson
680862880d Global values also don't undead-ify pointers in our dead alloca's set.
llvm-svn: 40936
2007-08-08 19:12:31 +00:00
Owen Anderson
ddf4aee543 Make handleEndBlock significantly faster with one trivial improvement,
and one hack to avoid hitting a bad case when the alias analysis is imprecise.

llvm-svn: 40935
2007-08-08 18:38:28 +00:00
Owen Anderson
50df9685b0 Small improvement: if a function doesn't access memory, we don't need to scan
it for potentially undeading pointers.

llvm-svn: 40933
2007-08-08 17:58:56 +00:00
Owen Anderson
52aaabf74d Add some comments, remove a dead argument, and simplify some control flow.
No functionality change.

llvm-svn: 40932
2007-08-08 17:50:09 +00:00
Owen Anderson
b17ab03081 A few more small cleanups.
llvm-svn: 40922
2007-08-08 06:06:02 +00:00
Owen Anderson
0aecf0ebef First round of cleanups from Chris' feedback.
llvm-svn: 40919
2007-08-08 04:52:29 +00:00
Devang Patel
68de1ae816 Embrace patch review feedback.
llvm-svn: 40915
2007-08-08 01:51:27 +00:00
Devang Patel
c7e53bdcfd Fix new compare instruction's signness. Caught by Chris during review.
llvm-svn: 40912
2007-08-07 23:17:52 +00:00
Owen Anderson
0cc1a76283 Don't insert nearly as many redundant phi nodes.
llvm-svn: 40909
2007-08-07 23:12:31 +00:00