Commit Graph

14890 Commits

Author SHA1 Message Date
Reid Spencer
0bade7e5e7 Remove extra comma.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17113 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 03:26:21 +00:00
Reid Spencer
7b32daa4c1 Actually link in all the analysis passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17112 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 03:22:48 +00:00
Chris Lattner
fc5c1bb000 Turn store -> null/undef into the LLVM unreachable instruction! This simple
change hacks off 10K of bytecode from perlbmk (.5%) even though the front-end
is not generating them yet and we are not optimizing the resultant code.
This isn't too bad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17111 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 03:00:50 +00:00
Chris Lattner
17be63552a Turn things with obviously undefined semantics into 'store -> null'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17110 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 02:59:09 +00:00
Chris Lattner
77bcee74da My friend the invoke instruction does not dominate all basic blocks if it
occurs in the entry node of a function


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 01:48:31 +00:00
Chris Lattner
28e792c232 Fix a bug that occurs when the constant value is the result of an invoke. In
particular, invoke ret values are only live in the normal dest of the invoke
not in the unwind dest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17108 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 01:21:17 +00:00
Chris Lattner
963869e41a Print a semicolon for the unreacahble instruction. This fixes problems
where C requires semicolons in some cases to indicate null statements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17107 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:49:11 +00:00
Chris Lattner
c7ff6c8029 Getting ADCE to interact well with unreachable instructions seems like a nontrivial
exercise that I'm not interested in tackling right now.  Just punt and treat them
like unwind's.

This 'fixes' test/Regression/Transforms/ADCE/unreachable-function.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17106 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:45:06 +00:00
Chris Lattner
559069d46d New testcase that ADCE shouldn't crash on
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17105 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:44:02 +00:00
Chris Lattner
3787e765fa Fix Regression/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll
If a function had no return instruction in it, and the result of the inlined
call instruction was used, we would crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17104 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:21:07 +00:00
Chris Lattner
58f8bdc6c6 New testcase that crashes the inliner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17103 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:20:29 +00:00
Nate Begeman
792558898f Pass -single_module option to gcc when linking dynamic libraries for use with bugpoint, so that we can bugpoint multiple .cp files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17102 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:03:32 +00:00
Nate Begeman
fcf4a42cdf Generate correct stubs for weak-linked symbols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17101 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 23:01:34 +00:00
Chris Lattner
cfbf9faaa4 fold gep undef, ... -> undef
This comes up many times in perlbmk and probably others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17100 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 21:54:55 +00:00
Chris Lattner
ca45930548 Remove printout, realize that instructions in the entry block dominate all
other blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17099 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 21:31:34 +00:00
Chris Lattner
7e40f63428 When inserting PHI nodes, don't insert any phi nodes that are obviously
unneccesary.  This allows us to delete several hundred phi nodes of the
form PHI(x,x,x,undef) from 253.perlbmk and probably other programs as well.

This implements Mem2Reg/UndefValuesMerge.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17098 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 21:25:56 +00:00
Chris Lattner
41b2dc4133 New testcase, no PHI should be inserted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17097 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 21:25:32 +00:00
Chris Lattner
8143c2bc0d Enhance hasConstantValue to ignore undef values in phi nodes. This allows it
to think that PHI[4, undef] == 4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17096 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 21:23:26 +00:00
Chris Lattner
c30bda7540 hasConstantValue will soon return instructions that don't dominate the PHI node,
so prepare for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17095 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 21:22:38 +00:00
Chris Lattner
665825e58e The first hunk corrects a bug when printing undef null values. We would print
0->field, which is illegal.  Now we print ((foo*)0)->field.

The second hunk is an optimization to not print undefined phi values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17094 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 17:48:59 +00:00
Chris Lattner
611fb259ba Don't print stuff out from the code generator. This broke the JIT horribly
last night. :)  bork!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17093 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 17:40:50 +00:00
Reid Spencer
394855a87d Add HAVE_BZLIB_H and HAVE_ZLIB_H tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17092 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 17:07:29 +00:00
Reid Spencer
1d91accc4b Update to reflect building zlib for LLVM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17091 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 15:02:47 +00:00
Reid Spencer
fa4cf331ed Add missing targets for install/clean
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17090 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 15:01:59 +00:00
Reid Spencer
ec660ae754 Make the library name SparcV9 specific
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17089 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 15:01:12 +00:00
Reid Spencer
26dde42381 Consolidate the definitions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17088 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 15:00:26 +00:00
Reid Spencer
761920301d PPC32GenCodeEmitter instead of PowerPCGenCodeEmitter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:59:38 +00:00
Reid Spencer
e6ffb3eda1 Add runtime directories
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:58:49 +00:00
Reid Spencer
952ba29d33 Support bytecode generation, GenCodeEmitter, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17085 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:57:12 +00:00
Reid Spencer
900aa65a91 Add runtime directory, include Makefile_rules
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17084 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:56:15 +00:00
Chris Lattner
56a31c69c8 Rewrite support for cast uint -> FP. In particular, we used to compile this:
double %test(uint %X) {
        %tmp.1 = cast uint %X to double         ; <double> [#uses=1]
        ret double %tmp.1
}

into:

test:
        sub %ESP, 8
        mov %EAX, DWORD PTR [%ESP + 12]
        mov %ECX, 0
        mov DWORD PTR [%ESP], %EAX
        mov DWORD PTR [%ESP + 4], %ECX
        fild QWORD PTR [%ESP]
        add %ESP, 8
        ret

... which basically zero extends to 8 bytes, then does an fild for an
8-byte signed int.

Now we generate this:


test:
        sub %ESP, 4
        mov %EAX, DWORD PTR [%ESP + 8]
        mov DWORD PTR [%ESP], %EAX
        fild DWORD PTR [%ESP]
        shr %EAX, 31
        fadd DWORD PTR [.CPItest_0 + 4*%EAX]
        add %ESP, 4
        ret

        .section .rodata
        .align  4
.CPItest_0:
        .quad   5728578726015270912

This does a 32-bit signed integer load, then adds in an offset if the sign
bit of the integer was set.

It turns out that this is substantially faster than the preceeding sequence.
Consider this testcase:

unsigned a[2]={1,2};
volatile double G;

void main() {
    int i;
    for (i=0; i<100000000; ++i )
        G += a[i&1];
}

On zion (a P4 Xeon, 3Ghz), this patch speeds up the testcase from 2.140s
to 0.94s.

On apoc, an athlon MP 2100+, this patch speeds up the testcase from 1.72s
to 1.34s.

Note that the program takes 2.5s/1.97s on zion/apoc with GCC 3.3 -O3
-fomit-frame-pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17083 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 08:01:28 +00:00
Chris Lattner
07306de06e Unify handling of constant pool indexes with the other code paths, allowing
us to use index registers for CPI's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17082 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 07:49:45 +00:00
Chris Lattner
0e0ed85697 Give the asmprinter the ability to print memrefs with a constant pool index,
index reg and scale


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 07:16:32 +00:00
Chris Lattner
de95c9e0bb fold:
%X = and Y, constantint
  %Z = setcc %X, 0

instead of emitting:

        and %EAX, 3
        test %EAX, %EAX
        je .LBBfoo2_2   # UnifiedReturnBlock

We now emit:

        test %EAX, 3
        je .LBBfoo2_2   # UnifiedReturnBlock

This triggers 581 times on 176.gcc for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17080 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 06:10:40 +00:00
Chris Lattner
9894cd300e All of these labels are off by one now that the unreachable instruction exists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17079 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:37:47 +00:00
Nate Begeman
1b75022cd3 Implement bitfield insert by recognizing the following pattern:
1. optional shift left
2. and x, immX
3. and y, immY
4. or z, x, y
==> rlwimi z, x, y, shift, mask begin, mask end

where immX == ~immY and immX is a run of set bits. This transformation
fires 32 times on voronoi, once on espresso, and probably several
dozen times on external benchmarks such as gcc.

To put this in terms of actual code generated for
struct B { unsigned a : 3; unsigned b : 2; };
void storeA (struct B *b, int v) { b->a = v;}
void storeB (struct B *b, int v) { b->b = v;}

Old:
_storeA:
        rlwinm r2, r4, 0, 29, 31
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 0, 28
        or r2, r4, r2
        stw r2, 0(r3)
        blr

_storeB:
        rlwinm r2, r4, 3, 0, 28
        rlwinm r2, r2, 0, 27, 28
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 29, 26
        or r2, r2, r4
        stw r2, 0(r3)
        blr

New:
_storeA:
        lwz r2, 0(r3)
        rlwimi r2, r4, 0, 29, 31
        stw r2, 0(r3)
        blr

_storeB:
        lwz r2, 0(r3)
        rlwimi r2, r4, 3, 27, 28
        stw r2, 0(r3)
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:19:20 +00:00
Chris Lattner
35f92ae3af Fix constant folding relational operators with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17077 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 04:01:51 +00:00
Chris Lattner
a78a9027f5 Reid added --version to the CommandLine lib. Don't conflict with it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17076 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:49:08 +00:00
Chris Lattner
7ff5a32a48 I forgot that sparc no longer uses the shared asmwriter. Give it support
for undef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17075 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:44:45 +00:00
Chris Lattner
d14d5b4223 Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17074 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:42:42 +00:00
Reid Spencer
da0a22b7ac Initial Makefile.am for building with automake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17073 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 00:24:24 +00:00
Reid Spencer
aa717415bf Initial Makefile.am for building with automake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17072 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 00:20:42 +00:00
Reid Spencer
2bf0292432 Make sure that for systems where the string functions are actually macros
that we undefine the macro before using its name in the definition. This
can happen on Linux if _GNU_SOURCE is defined.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17071 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 00:17:54 +00:00
Chris Lattner
71d3778c0b Implement constant folding of undef values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17070 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 23:31:32 +00:00
Chris Lattner
79a564caa7 Fix a type violation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17069 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 23:28:04 +00:00
Nate Begeman
2d4c98d79b Finally fix one of the oldest FIXMEs in the PowerPC backend: correctly
flag rotate left word immediate then mask insert (rlwimi) as a two-address
instruction, and update the ISel usage of the instruction accordingly.

This will allow us to properly schedule rlwimi, and use it to efficiently
codegen bitfield operations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17068 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 20:43:38 +00:00
Chris Lattner
6e758aee74 Kill the bogon that slipped into my buffer before I committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17067 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:46:33 +00:00
Chris Lattner
061718cba8 Implement InstCombine/getelementptr.ll:test9, which is the source of many
ugly and giant constnat exprs in some programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17066 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:44:59 +00:00
Chris Lattner
51a2c5aebf New testcase, rework testcases to fail if there are any gep's other than those
involving %B instead of allowing any geps except %A's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17065 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:44:23 +00:00
Misha Brukman
a04d0a19e3 * Add a space between words
* Wrap at 80 cols


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:13:58 +00:00