Commit Graph

1914 Commits

Author SHA1 Message Date
Jeff Cohen
5e1e5e13ff PHI nodes were incorrectly placed when more than one GEP is reduced in a loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20360 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 21:08:04 +00:00
Jeff Cohen
f465db6c6a First pass at improved Loop Strength Reduction. Still not yet ready for prime time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20358 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 19:37:07 +00:00
Chris Lattner
35c81b0b12 Teach globalopt how memset/cpy/move affect memory, to allow better optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20352 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 18:58:52 +00:00
Chris Lattner
da895d6337 Fix spelling, patch contributed by Gabor Greif!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 06:18:25 +00:00
Chris Lattner
be54dcc8a9 remove extraneous cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20334 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-26 18:33:28 +00:00
Chris Lattner
623369ac56 Implement Transforms/SimplifyCFG/switch_thread.ll
This does a simple form of "jump threading", which eliminates CFG edges that
are provably dead.  This triggers 90 times in the external tests, and
eliminating CFG edges is always always a good thing! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-24 06:17:52 +00:00
Chris Lattner
1f21ef1511 make this more efficient. Scan up to 16 nodes, not the whole list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20289 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-23 16:53:04 +00:00
Chris Lattner
cfa2f8eef4 Remove use of bind_obj
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20276 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-22 23:22:58 +00:00
Chris Lattner
1a84bd38ef Do not mark obviously unreachable blocks live when processing PHI nodes,
and handle incomplete control dependences correctly.  This fixes:

Regression/Transforms/ADCE/dead-phi-edge.ll
  -> a missed optimization

Regression/Transforms/ADCE/dead-phi-edge.ll
  -> a compiler crash distilled from QT4


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20227 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 19:28:49 +00:00
Chris Lattner
8a7980b5ea Fix the second bug attached to PR504.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20181 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-14 20:11:45 +00:00
Chris Lattner
f6249261a9 Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.ll
and PR504.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20129 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-12 03:26:49 +00:00
Alkis Evlogimenos
f64ea9d122 Localize globals if they are only used in main(). This replaces the
global with an alloca, which eventually gets promoted into a
register. This enables a lot of other optimizations later on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20109 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-10 18:36:30 +00:00
Alkis Evlogimenos
83874c9571 Fix crash on MallocInsts of unsized types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-02 04:43:37 +00:00
Chris Lattner
ac930048d6 API change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19959 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01 01:23:49 +00:00
Chris Lattner
d514d8294d Adjust to changes in APIs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19958 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01 01:23:31 +00:00
Chris Lattner
5a87447286 Hacks to make this ugly ugly code work with the new use lists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19957 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01 01:22:56 +00:00
Chris Lattner
fcfe33acda Implement InstCombine/cast.ll:test25, a case that occurs many times
in spec


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19953 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31 05:51:45 +00:00
Chris Lattner
2f503e6c27 Implement the trivial cases in InstCombine/store.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19950 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31 05:36:43 +00:00
Chris Lattner
f9527850e6 Implement Transforms/InstCombine/cast-load-gep.ll, which allows us to devirtualize
11 indirect calls in perlbmk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19947 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-31 04:50:46 +00:00
Chris Lattner
5551706b0f Adjust to changes in instruction interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19900 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:39:08 +00:00
Chris Lattner
667fdaef9f Switchinst takes a hint for the number of cases it will have.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19899 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:38:45 +00:00
Chris Lattner
378805969e switchinst ctor now takes a hint for the number of cases that it will have.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19898 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:38:26 +00:00
Chris Lattner
5598aa0328 Adjust Valuehandle to hold its operand directly in it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19897 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:37:36 +00:00
Chris Lattner
ad5fec12a0 * add some DEBUG statements
* Properly compile this:

struct a {};
int test() {
  struct a b[2];
  if (&b[0] != &b[1])
    abort ();
  return 0;
}

to 'return 0', not abort().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19875 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 19:32:01 +00:00
Alkis Evlogimenos
193904a663 Add a dependency to the trace library so that it gets pulled in
automatically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19828 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-25 16:23:57 +00:00
Chris Lattner
ad1e302723 Get rid of a several dozen more and instructions in specint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19786 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 20:26:55 +00:00
Chris Lattner
45f57b8ee3 Handle comparisons of gep instructions that have different typed indices
as long as they are the same size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19734 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 23:06:49 +00:00
Chris Lattner
6fb5a4a5f8 Add two optimizations. The first folds (X+Y)-X -> Y
The second folds operations into selects, e.g. (select C, (X+Y), (Y+Z))
-> (Y+(select C, X, Z)

This occurs a few times across spec, e.g.

         select    add/sub
mesa:    83        0
povray:  5         2
gcc      4         2
parser   0         22
perlbmk  13        30
twolf    0         3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19706 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 21:50:18 +00:00
Chris Lattner
7d719c3cd8 Fix 'raise' to work with packed types. Patch by Morten Ofstad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19693 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 16:16:35 +00:00
Chris Lattner
a3fd1c569c Delete PHI nodes that are not dead but are locked in a cycle of single
useness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19629 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 05:10:15 +00:00
Chris Lattner
b352fa5853 Move code out of indentation one level to make it easier to read.
Disable the xform for < > cases.  It turns out that the following is being
miscompiled:

bool %test(sbyte %S) {
        %T = cast sbyte %S to uint
        %V = setgt uint %T, 255
        ret bool %V
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19628 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 03:20:02 +00:00
Chris Lattner
906ab50acf Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19553 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 17:35:12 +00:00
Chris Lattner
6f7f02fdec Fix a compile crash on spiff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19552 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 17:17:59 +00:00
Chris Lattner
4401c9cabe if two gep comparisons only differ by one index, compare that index directly.
This allows us to better optimize begin() -> end() comparisons in common cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19542 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 00:20:05 +00:00
Chris Lattner
0b84c80c08 Do not overrun iterators. This fixes a 176.gcc crash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19541 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 23:26:48 +00:00
Chris Lattner
87875dac89 Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs in
the 'sim' program and probably elsewhere.  In sim, it comes up for cases
like this:

#define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5)
double G;
void T(double X) { G = round(X); }

(it uses the round macro a lot).  This changes the LLVM code from:

        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %tmp.4 = add double %X, 5.000000e-01            ; <double> [#uses=1]
        %tmp.6 = sub double %X, 5.000000e-01            ; <double> [#uses=1]
        %mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6
        store double %mem_tmp.0, double* %G

to:

        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01
        %mem_tmp.0 = add double %mem_tmp.0.p, %X
        store double %mem_tmp.0, double* %G
        ret void


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19537 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 22:52:24 +00:00
Chris Lattner
e9d782b7be Implement an optimization for == and != comparisons like this:
_Bool test2(int X, int Y) {
  return &arr[X][Y] == arr;
}

instead of generating this:

bool %test2(int %X, int %Y) {
        %tmp.3.idx = mul int %X, 160            ; <int> [#uses=1]
        %tmp.3.idx1 = shl int %Y, ubyte 2               ; <int> [#uses=1]
        %tmp.3.offs2 = sub int 0, %tmp.3.idx            ; <int> [#uses=1]
        %tmp.7 = seteq int %tmp.3.idx1, %tmp.3.offs2            ; <bool> [#uses=1]
        ret bool %tmp.7
}


generate this:

bool %test2(int %X, int %Y) {
        seteq int %X, 0         ; <bool>:0 [#uses=1]
        seteq int %Y, 0         ; <bool>:1 [#uses=1]
        %tmp.7 = and bool %0, %1                ; <bool> [#uses=1]
        ret bool %tmp.7
}

This idiom occurs in C++ programs when iterating from begin() to end(),
in a vector or array.  For example, we now compile this:

void test(int X, int Y) {
  for (int *i = arr; i != arr+100; ++i)
    foo(*i);
}

to this:

no_exit:                ; preds = %entry, %no_exit
	...
        %exitcond = seteq uint %indvar.next, 100                ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit



instead of this:

no_exit:                ; preds = %entry, %no_exit
	...
        %inc5 = getelementptr [100 x [40 x int]]* %arr, int 0, int 0, int %inc.rec              ; <int*> [#uses=1]
        %tmp.8 = seteq int* %inc5, getelementptr ([100 x [40 x int]]* %arr, int 0, int 100, int 0)              ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
        br bool %tmp.8, label %return, label %no_exit


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 22:25:21 +00:00
Chris Lattner
5bdf04cc8e Fix some bugs in code I didn't mean to check in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19534 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 20:40:58 +00:00
Chris Lattner
574da9ba0b Fix a crash compiling 129.compress
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19533 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 20:14:25 +00:00
Reid Spencer
99f997d2c1 Add the LOADABLE_MODULE=1 directive to indicate that this shared library is
intended to be a dlopenable module and not a "plain" shared library.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19456 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11 04:33:32 +00:00
Jeff Cohen
ecc1cef8bf Apply feedback from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19432 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-10 04:23:32 +00:00
Chris Lattner
22bc934720 Fix VS warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19383 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:48:40 +00:00
Chris Lattner
4d0801b243 Fix VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19382 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:45:31 +00:00
Chris Lattner
652f3cf76f Fix uint64_t -> unsigned VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19381 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:42:22 +00:00
Chris Lattner
d4bc564531 Silence VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19380 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:37:20 +00:00
Chris Lattner
2cc34627bb Silence warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19379 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:34:41 +00:00
Jeff Cohen
bf65268def Add more missing createXxxPass functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 17:21:40 +00:00
Misha Brukman
60766f7d41 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19320 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 07:05:34 +00:00
Jeff Cohen
d9ed8c8880 Add missing createXxxPass functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19319 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 06:57:28 +00:00
Jeff Cohen
30becbda10 Add missing include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19315 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 05:42:13 +00:00
Jeff Cohen
f5e58f8f43 Put createLoopUnswitchPass() into proper namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19306 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-06 05:47:18 +00:00
Jeff Cohen
8ca7191599 Add missing include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19305 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-06 05:46:44 +00:00
Chris Lattner
6e7ba45460 This is a bulk commit that implements the following primary improvements:
* We can now fold cast instructions into select instructions that
    have at least one constant operand.
  * We now optimize expressions more aggressively based on bits that are
    known to be zero.  These optimizations occur a lot in code that uses
    bitfields even in simple ways.
  * We now turn more cast-cast sequences into AND instructions.  Before we
    would only do this if it if all types were unsigned.  Now only the
    middle type needs to be unsigned (guaranteeing a zero extend).
  * We transform sign extensions into zero extensions in several cases.

This corresponds to these test/Regression/Transforms/InstCombine testcases:
  2004-11-22-Missed-and-fold.ll
  and.ll: test28-29
  cast.ll: test21-24
  and-or-and.ll
  cast-cast-to-and.ll
  zeroext-and-reduce.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19220 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 16:22:27 +00:00
Chris Lattner
13b2f764c0 Implement SimplifyCFG/DeadSetCC.ll
SimplifyCFG is one of those passes that we use for final cleanup: it should
not rely on other passes to clean up its garbage.  This fixes the "why are
trivially dead setcc's in the output of gccas" problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19212 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 16:02:12 +00:00
Chris Lattner
da16d8c00b Fix PR491 and testcase Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19180 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-29 04:36:02 +00:00
Chris Lattner
68a9d3eb38 Adjust to new interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18958 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 07:22:25 +00:00
Chris Lattner
0ce8580fcd Constant exprs are not efficiently negatable in practice. This disables
turning X - (constantexpr) into X + (-constantexpr) among other things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18935 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-14 20:08:06 +00:00
Brian Gaeke
9d97547680 Fix link error in PPC optimized build of 'opt'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18913 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 21:28:39 +00:00
Chris Lattner
de97b5788c Get rid of getSizeOf, using ConstantExpr::getSizeOf instead.
do not insert a prototype for malloc of: void* malloc(uint): on 64-bit u
targets this is not correct.  Instead of prototype it as void *malloc(...),
and pass the correct intptr_t through the "...".

Finally, fix Regression/CodeGen/SparcV9/2004-12-13-MallocCrash.ll, by not
forming constantexpr casts from pointer to uint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18908 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 20:00:02 +00:00
Chris Lattner
6b8efcd697 Change indentation of a whole bunch of code, no real changes here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18843 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 23:49:37 +00:00
Chris Lattner
387bc13575 More substantial simplifications and speedups. This makes ADCE about 20% faster
in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18842 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 23:40:17 +00:00
Chris Lattner
46356794ab More minor microoptimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18841 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 22:44:30 +00:00
Chris Lattner
4e51ccdd38 Remove some more set operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18840 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 22:22:18 +00:00
Chris Lattner
188839a219 Reduce number of set operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18839 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 22:16:13 +00:00
Chris Lattner
857e8cdd65 Optimize div/rem + select combinations more.
In particular, implement div.ll:test10 and rem.ll:test4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18838 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 21:48:58 +00:00
Chris Lattner
38c2556d0c Properly implement copying of a global, fixing the 255.vortex & povray
failures from last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18832 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 19:34:41 +00:00
Chris Lattner
fb851ab281 Simplify code and do not invalidate iterators.
This fixes a crash compiling TimberWolfMC that was exposed due to recent
optimizer changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18831 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 18:23:20 +00:00
Chris Lattner
077f1a8292 Though the previous xform applies to literally dozens (hundreds?) of variables
in SPEC, the subsequent optimziations that we are after don't play with
with FP values, so disable this xform for them.  Really we just don't want
stuff like:

double G;   (always 0 or 412312.312)
  = G;

turning into:

bool G_b;
  = G_b ? 412312.312 : 0;

We'd rather just do the load.

-Chris


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18819 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 06:03:06 +00:00
Chris Lattner
96a86b2993 If a variable can only hold two values, and is not already a bool, shrink it
down to actually BE a bool.  This allows simple value range propagation
stuff work harder, deleting comparisons in bzip2 in some hot loops.

This implements GlobalOpt/integer-bool.ll, which is the essence of the
loop condition distilled into a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18817 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 05:53:50 +00:00
Chris Lattner
a177c67471 If one side of and/or is known to be 0/-1, it doesn't matter
if the other side is overdefined.

This allows us to fold conditions like:  if (X < Y || Y > Z) in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 23:15:19 +00:00
Chris Lattner
2ffa47b6bf Only cound if we actually made a change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18800 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 17:00:14 +00:00
Chris Lattner
284d1b8827 The split bb is really the exit of the old function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 16:59:54 +00:00
Chris Lattner
dade2d22ba Two bug fixes:
1. Actually increment the Statistic for the GV elim optzn
 2. When resolving undef branches, only resolve branches in executable blocks,
    avoiding marking a bunch of completely dead blocks live.  This has a big
    impact on the quality of the generated code.

With this patch, we positively rip up vortex, compiling Ut_MoveBytes to a
single memcpy call. In vortex we get this:

     12 ipsccp           - Number of globals found to be constant
    986 ipsccp           - Number of arguments constant propagated
   1378 ipsccp           - Number of basic blocks unreachable
   8919 ipsccp           - Number of instructions removed


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18796 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 06:05:53 +00:00
Chris Lattner
864737bf9e Do not delete the entry block to a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 05:32:19 +00:00
Chris Lattner
dd336d196e Implement Transforms/SCCP/ipsccp-gvar.ll, by tracking values stored to
non-address-taken global variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18790 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 05:15:59 +00:00
Chris Lattner
0417feba29 Fix a bug where we could delete dead invoke instructions with uses.
In functions where we fully constant prop the return value, replace all
ret instructions with 'ret undef'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18786 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 02:53:57 +00:00
Chris Lattner
5f9e8b4c3f Implement SCCP/ipsccp-conditional.ll, by totally deleting dead blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 22:29:08 +00:00
Chris Lattner
fc6ac50619 Fix SCCP/2004-12-10-UndefBranchBug.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18776 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 20:41:50 +00:00
Chris Lattner
7613437db9 Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,
and the failure on make_dparser last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18766 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 17:42:31 +00:00
Chris Lattner
59acc7d4ef This is the initial implementation of IPSCCP, as requested by Brian.
This implements SCCP/ipsccp-basic.ll, rips apart Olden/mst (as described in
PR415), and does other nice things.

There is still more to come with this, but it's a start.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18752 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 08:02:06 +00:00
Chris Lattner
13eaf4f14d note to self: Do not check in debugging code!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18693 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 07:15:52 +00:00
Chris Lattner
96a52a6f6c Implement trivial sinking for load instructions. This causes us to sink 567 loads in spec
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18692 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 07:14:34 +00:00
Chris Lattner
ea1c45405d Do extremely simple sinking of instructions when they are only used in a
successor block.  This turns cases like this:

x = a op b
if (c) {
  use x
}

into:

if (c) {
  x = a op b
  use x
}

This triggers 3965 times in spec, and is tested by
Regression/Transforms/InstCombine/sink_instruction.ll

This appears to expose a bug in the X86 backend for 177.mesa, which I'm
looking in to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18677 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 23:43:58 +00:00
Alkis Evlogimenos
54a96a2ad6 Fix this regression and remove the XFAIL from this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18674 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 23:10:30 +00:00
Chris Lattner
2a0cd9c9b5 Fix Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18670 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 22:20:34 +00:00
Chris Lattner
17a213ad8b Add support for compilers without argument dependent name lookup, contributed
by Bjørn Wennberg


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18627 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 16:12:20 +00:00
Chris Lattner
f2fd400258 Remove unneeded class qualifier, contributed by Bjørn Wennberg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18625 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 16:05:02 +00:00
Reid Spencer
791a959e57 For PR387:\
Add doInitialization method to avoid overloaded virtuals


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18602 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 08:11:36 +00:00
Chris Lattner
dd0ecf6731 Implement stripping of debug symbols, making the --strip-debug options in
gccas/gccld more than just a noop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18456 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 16:22:08 +00:00
Chris Lattner
e3ad43c828 Initial reimplementation of the -strip pass, with a stub for implementing
-S


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18440 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 21:25:03 +00:00
Chris Lattner
6992afcdb9 This pass is moving to lib IPO
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18439 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 21:24:40 +00:00
Chris Lattner
fa07e4fc30 Implement a FIXME by checking to make sure that a malloc is not being used
in scary and unknown ways before we promote it.  This fixes the miscompilation
of 188.ammp that has been plauging us since a globalopt patch went in.

Thanks a ton to Tanya for helping me diagnose the problem!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18418 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 07:11:07 +00:00
Chris Lattner
bc965b97ad Fix a minor bug where we set a var to initialized on malloc, not on store.
This doesn't fix anything that I'm aware of, just noticed it by inspection


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18417 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 06:25:58 +00:00
Chris Lattner
6b205c3ef1 This pass is completely broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18387 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 17:09:06 +00:00
Chris Lattner
0f535c6fa8 Squelch warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18381 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:47:34 +00:00
Chris Lattner
5a85d9c664 Fix test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx
This only fails on darwin or on X86 under valgrind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18377 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:01:15 +00:00
Chris Lattner
6f9e571529 Alkis noticed that this variable is dead. Thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18369 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 04:01:44 +00:00
Chris Lattner
37dc938bbe If we have something like this:
if (x) {
    code
    ...
  } else {
    code
    ...
  }

Turn it into:

  code
  if (x) {
    ...
  } else {
    ...
  }

This reduces code size and in some common cases allows us to completely
eliminate the conditional.  This turns several if/then/else blocks in loops
into straightline code in 179.art, turning the loops into single basic blocks
(good for modsched even!).

Maybe now brg will leave me alone ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18366 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 00:29:14 +00:00
Chris Lattner
8a9193927a Allow hoisting loads of globals and alloca's in conditionals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18363 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 21:26:12 +00:00
Reid Spencer
6731d5c494 Fix for PR454:
* Make sure we handle signed to unsigned conversion correctly
* Move this visitSetCondInst case to its own method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18312 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-28 21:31:15 +00:00
Chris Lattner
8305a64dce Make DSE potentially more aggressive by being more specific about alloca sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18309 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-28 20:44:37 +00:00
Chris Lattner
646641e02c Implement Regression/Transforms/InstCombine/getelementptr_cast.ll, which
occurs many times in crafty


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18273 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-27 17:55:46 +00:00
Chris Lattner
f3e1d6977e Provide size information when checking to see if we can LICM a load, this
allows us to hoist more loads in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18265 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-26 21:20:09 +00:00
Chris Lattner
b9df9b4c88 Do not count debugger intrinsics in size estimation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18110 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 17:23:57 +00:00
Chris Lattner
8db93f18cc Ignore debugger intrinsics when doing inlining size computations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 17:21:44 +00:00
Chris Lattner
64613ea8c8 Do not consider debug intrinsics in the size computations for loop unrolling.
Patch contributed by Michael McCracken!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18108 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 17:18:36 +00:00
Misha Brukman
e74c73cf46 Allow constructor parameter to override aggregating args; fix spacing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18028 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 02:20:27 +00:00
Chris Lattner
7b73a663bc Fix the exposed prototype for the lower packed pass, thanks to
Morten Ofstad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17996 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 16:49:34 +00:00
Chris Lattner
4a389b697c CPR is dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17992 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 16:24:57 +00:00
Chris Lattner
954f66a8cd Delete stoppoints that occur for the same source line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17970 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-18 21:41:39 +00:00
Chris Lattner
56de0363e3 Check in hook that I forgot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17956 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-18 17:24:20 +00:00
Chris Lattner
73559b1f4c Do not delete dead invoke instructions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17897 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 16:32:28 +00:00
Reid Spencer
96326f9d31 Remove unused variable for compilation by VC++.
Patch contributed by Morten Ofstad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17830 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 17:29:41 +00:00
Chris Lattner
14051812ff Minor cleanups. There is no reason for SCCP to derive from instvisitor anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17825 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 07:15:04 +00:00
Chris Lattner
b77d5d8d50 Count more accurately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17824 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 07:02:42 +00:00
Chris Lattner
50e60c7026 Quiet warnings on the persephone tester
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17821 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 05:54:07 +00:00
Chris Lattner
7e529e4b3c Two minor improvements:
1. Speedup getValueState by having it not consider Arguments.  It's better
    to just add them before we start SCCP'ing.
 2. SCCP can delete the contents of dead blocks.  No really, it's ok!  This
    reduces the size of the IR for subsequent passes, even though
    simplifycfg would do the same job.  In practice, simplifycfg does not
    run until much later than sccp in gccas


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17820 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 05:45:33 +00:00
Chris Lattner
ef36dfd31a rename InstValue to LatticeValue, as it holds for more than instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17818 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 05:03:30 +00:00
Chris Lattner
82bec2cff0 Substantially refactor the SCCP class into an SCCP pass and an SCCPSolver
class.  The only changes are minor:

 * Do not try to SCCP instructions that return void in the rewrite loop.
   This is silly and fool hardy, wasting a map lookup and adding an entry
   to the map which is never used.
 * If we decide something has an undefined value, rewrite it to undef,
   potentially leading to further simplications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17816 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 04:44:20 +00:00
Chris Lattner
bd38edfe23 If a global is just loaded and restored, realize that it is not changing
value.  This allows us to turn more globals into constants and eliminate them.
This patch implements GlobalOpt/load-store-global.llx.

Note that this patch speeds up 255.vortex from:

Output/255.vortex.out-cbe.time:program 7.640000
Output/255.vortex.out-llc.time:program 9.810000

to:

Output/255.vortex.out-cbe.time:program 7.250000
Output/255.vortex.out-llc.time:program 9.490000

Which isn't bad at all!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17746 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 20:50:30 +00:00
Chris Lattner
b58934484b This optimization makes MANY phi nodes that all have the same incoming value.
If this happens, detect it early instead of relying on instcombine to notice
it later.  This can be a big speedup, because PHI nodes can have many
incoming values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17741 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 19:29:34 +00:00
Chris Lattner
bac32866a7 Implement instcombine/phi.ll:test6 - pulling operations through PHI nodes.
This exposes subsequent optimization possiblities and reduces code size.
This triggers 1423 times in spec.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17740 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 19:13:23 +00:00
Chris Lattner
711b3402aa Transform this:
%X = alloca ...
  %Y = alloca ...
    X == Y

into false.  This allows us to simplify some stuff in eon (and probably
many other C++ programs) where operator= was checking for self assignment.
Folding this allows us to SROA several additional structs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 07:33:16 +00:00
Chris Lattner
6739eae7ea Remove note to self
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17734 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 06:57:47 +00:00
Chris Lattner
a990d94330 If a function always returns a constant, replace all calls sites with that
constant value.  This makes the return value dead and allows for
simplification in the caller.

This implements IPConstantProp/return-constant.ll

This triggers several dozen times throughout SPEC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17730 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 06:10:11 +00:00
Chris Lattner
d878ecd904 Teach SROA how to promote an array index that is variable, if the dimension
of the array is just two.  This occurs 8 times in gcc, 6 times in crafty, and
12 times in 099.go.

This implements ScalarRepl/sroa_two.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17727 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 05:00:19 +00:00
Chris Lattner
f5990edc87 Rearrange some code, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17724 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 04:24:28 +00:00
Chris Lattner
4c989b6bd7 Remove debugging code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17719 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 23:32:53 +00:00
Chris Lattner
11a3d7b7dd Argument promotion transforms functions to unconditionally load their
argument pointers.  This is only valid to do if the function already
unconditionally loaded an argument or if the pointer passed in is known
to be valid.  Make sure to do the required checks.

This fixed ArgumentPromotion/control-flow.ll and the Burg program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17718 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 23:31:34 +00:00
Chris Lattner
50af16a97b Simplify handling of shifts to be the same as we do for adds. Add support
for (X * C1) + (X * C2) (where * can be mul or shl), allowing us to fold:

   Y+Y+Y+Y+Y+Y+Y+Y

into
         %tmp.8 = shl long %Y, ubyte 3           ; <long> [#uses=1]

instead of

        %tmp.4 = shl long %Y, ubyte 2           ; <long> [#uses=1]
        %tmp.12 = shl long %Y, ubyte 2          ; <long> [#uses=1]
        %tmp.8 = add long %tmp.4, %tmp.12               ; <long> [#uses=1]

This implements add.ll:test25

Also add support for (X*C1)-(X*C2) -> X*(C1-C2), implementing sub.ll:test18


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17704 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:50:12 +00:00
Chris Lattner
65aedc1a4e Fold:
(X + (X << C2)) --> X * ((1 << C2) + 1)
   ((X << C2) + X) --> X * ((1 << C2) + 1)

This means that we now canonicalize "Y+Y+Y" into:

        %tmp.2 = mul long %Y, 3         ; <long> [#uses=1]

instead of:

        %tmp.10 = shl long %Y, ubyte 1          ; <long> [#uses=1]
        %tmp.6 = add long %Y, %tmp.10               ; <long> [#uses=1]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17701 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:31:40 +00:00
Chris Lattner
0c3b390a54 Lazily create the abort message, so only translation units that use unwind
will actually get it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17700 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:07:32 +00:00
Chris Lattner
9ecc046184 Fix: CodeExtractor/2004-11-12-InvokeExtract.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17699 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 00:06:45 +00:00
Chris Lattner
68c311aac6 Fix a bug where the code extractor would get a bit confused handling invoke
instructions, setting DefBlock to a block it did not have dom info for.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17697 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 23:50:44 +00:00
Chris Lattner
44c94b9671 Simplify handling of constant initializers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17696 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 22:42:57 +00:00
Chris Lattner
d79c7b43f4 Actually, leave the check in. This prevents us from counting dead arguments
as IPCP opportunities.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17680 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-11 07:47:54 +00:00
Chris Lattner
3e062eacab Fix bug: IPConstantProp/deadarg.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17679 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-11 07:46:29 +00:00
Chris Lattner
ff1529b6cf Make IP Constant prop more aggressive about handling self recursive calls.
This implements IPConstantProp/recursion.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17666 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-10 19:43:59 +00:00
Chris Lattner
c890bfe1da Do not let dead constant expressions hanging off of functions prevent IPCP.
This allows to elimination of a bunch of global pool descriptor args from
programs being pool allocated (and is also generally useful!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17657 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 20:47:30 +00:00
Chris Lattner
a8e475093a Change this back so that I get stable numbers to reflect the change from the
nightly testers


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17646 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 08:05:23 +00:00
Chris Lattner
52f20f8308 Fix bug: 2004-11-08-FreeUseCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17642 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 05:10:56 +00:00
Chris Lattner
ae18963a70 VERY large functions that are only called from one place are not really
exciting to inline.  Only inline medium or small sized functions with a
single call site.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17588 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 21:46:47 +00:00
Chris Lattner
00a4fe48ac This is V9 specific, move it there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17545 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 00:39:26 +00:00
Chris Lattner
183f2eb860 Remove dead vars
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17482 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 04:46:22 +00:00
Chris Lattner
f158092801 Fix some warnings on VC++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17481 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 04:45:43 +00:00
Chris Lattner
d308f8a87f * Rearrange code slightly
* Disable broken transforms for simplifying (setcc (cast X to larger), CI)
  where CC is not != or ==


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17422 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-02 03:50:32 +00:00
Chris Lattner
7e54a01ddb Speed up the tail duplication pass on the testcase below from 68.2s to 1.23s:
#define CL0(a) case a: f(); goto c;
 #define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) \
 CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9)
 #define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) \
 CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9)
 #define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) \
 CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9)
 #define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) \
 CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9)

 void f();

 void a() {
     int b;
  c: switch (b) {
         CL4(1)
     }
 }

This comes from GCC PR 15524


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17390 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-01 07:05:07 +00:00
Chris Lattner
bfd3e52701 Do not compute the predecessor list for a block unless we need it.
This speeds up simplifycfg on this program, from 44.87s to 0.29s (with
a profiled build):

 #define CL0(a) case a: goto c;
 #define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) \
 CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9)
 #define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) \
 CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9)
 #define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) \
 CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9)
 #define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) \
 CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9)

 void f();

 void a() {
     int b;
  c: switch (b) {
         CL4(1)
     }
 }

This testcase is contrived to expose N^2 behavior, but this patch should speedup
simplifycfg on any programs that use large switch statements.  This testcase
comes from GCC PR17895.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17389 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-01 06:53:58 +00:00
Reid Spencer
6cb21d443e Change Library Names Not To Conflict With Others When Installed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17286 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-27 23:18:45 +00:00
Chris Lattner
1fca5ff62b Convert 'struct' to 'class' in various places to adhere to the coding standards
and work better with VC++.  Patch contributed by Morten Ofstad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17281 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-27 16:14:51 +00:00