Commit Graph

3478 Commits

Author SHA1 Message Date
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
Owen Anderson
9528f11481 Make NonLocal and None const in the right way. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 04:42:44 +00:00
Devang Patel
c9d123dca9 Traverse loop blocks' terminators to find split candidates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 01:39:01 +00:00
Devang Patel
9704fcf505 Add cost analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 22:25:28 +00:00
Devang Patel
787a713bb2 Preserve dom info while processing one iteration loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40947 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 21:39:47 +00:00
Owen Anderson
8cad423d94 Change the None and NonLocal markers in memdep to be const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40946 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 21:39:39 +00:00
Devang Patel
9021c7001e Clear split info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40944 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 21:18:27 +00:00
Devang Patel
71554b8e3c Handle multiple split conditions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40941 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 21:02:17 +00:00
Owen Anderson
838014ee5b Global values also don't undead-ify pointers in our dead alloca's set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40936 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 19:12:31 +00:00
Owen Anderson
362bb52108 Make handleEndBlock significantly faster with one trivial improvement,
and one hack to avoid hitting a bad case when the alias analysis is imprecise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40935 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 18:38:28 +00:00
Owen Anderson
df359c264e Small improvement: if a function doesn't access memory, we don't need to scan
it for potentially undeading pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40933 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 17:58:56 +00:00
Owen Anderson
bb3abf41a8 Add some comments, remove a dead argument, and simplify some control flow.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 17:50:09 +00:00
Owen Anderson
c182f17aed A few more small cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40922 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 06:06:02 +00:00
Owen Anderson
6ca4cb3755 First round of cleanups from Chris' feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40919 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 04:52:29 +00:00
Devang Patel
6a2bfdaab6 Embrace patch review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40915 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 01:51:27 +00:00
Devang Patel
002fe25dd7 Fix new compare instruction's signness. Caught by Chris during review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40912 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 23:17:52 +00:00
Owen Anderson
a37226af81 Don't insert nearly as many redundant phi nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40909 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 23:12:31 +00:00
Devang Patel
8431a1cbcc Use eraseFromParent().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40903 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 17:45:35 +00:00
David Greene
32fe3de0fe Fix comment typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40898 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 16:52:03 +00:00
David Greene
8ff18e9c99 Fix GLIBCXX_DEBUG error triggered by incrementing erased iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 16:44:38 +00:00
Devang Patel
fee76bd9ba Begin loop index split pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40883 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 00:25:56 +00:00
Nick Lewycky
f947b3edb5 It's safe to fold not of fcmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40870 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 20:04:16 +00:00
David Greene
242be6e0ff Make this code more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40861 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 15:09:17 +00:00
Chris Lattner
3589df8013 remove some dead lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40859 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 06:21:06 +00:00
Reid Spencer
81a7572f1a Silence some warnings from doxygen about @param argument name not matching the
actual argument name of the documented function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40851 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 19:35:22 +00:00
Chris Lattner
a9ff5eb76e at the end of instcombine, explicitly clear WorklistMap.
This shrinks it down to something small.  On the testcase
from PR1432, this speeds up instcombine from 0.7959s to 0.5000s,
(59%)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 08:47:58 +00:00
Chris Lattner
f12f8def39 rewrite the code used to construct pruned SSA form with the IDF method.
In the old way, we computed and inserted phi nodes for the whole IDF of 
the definitions of the alloca, then computed which ones were dead and
removed them.

In the new method, we first compute the region where the value is live,
and use that information to only insert phi nodes that are live.  This
eliminates the need to compute liveness later, and stops the algorithm
from inserting a bunch of phis which it then later removes.

This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a
release build and 6.84s->0.50s (14x) in a debug build.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40825 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 22:50:14 +00:00
Chris Lattner
0ec8df3d5f Factor out a whole bunch of code into it's own method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40824 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 21:14:29 +00:00
Chris Lattner
127ed3c929 Use getNumPreds(BB) instead of computing them manually. This is a very small but
measurable speedup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40823 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 21:06:15 +00:00
Chris Lattner
1e76af3011 Change the rename pass to be "tail recursive", only adding N-1 successors
to the worklist, and handling the last one with a 'tail call'.  This speeds
up PR1432 from 2.0578s to 2.0012s (2.8%)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40822 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 20:40:27 +00:00
Chris Lattner
e7b653dabe cache computation of #preds for a BB. This speeds up
mem2reg from 2.0742->2.0522s on PR1432.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 20:24:50 +00:00
Chris Lattner
384c7e0436 reserve operand space for phi nodes when we insert them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40820 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 20:14:34 +00:00
Chris Lattner
6c81213b4c use continue to avoid nesting, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40819 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 20:07:06 +00:00
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