Commit Graph

14887 Commits

Author SHA1 Message Date
Chris Lattner 8ba9ec9bbb Turn things with obviously undefined semantics into 'store -> null'
llvm-svn: 17110
2004-10-18 02:59:09 +00:00
Chris Lattner 3b92f17165 My friend the invoke instruction does not dominate all basic blocks if it
occurs in the entry node of a function

llvm-svn: 17109
2004-10-18 01:48:31 +00:00
Chris Lattner 34ae670706 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.

llvm-svn: 17108
2004-10-18 01:21:17 +00:00
Chris Lattner 53058663aa Print a semicolon for the unreacahble instruction. This fixes problems
where C requires semicolons in some cases to indicate null statements.

llvm-svn: 17107
2004-10-17 23:49:11 +00:00
Chris Lattner 6a792feb02 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

llvm-svn: 17106
2004-10-17 23:45:06 +00:00
Chris Lattner 61011accfd New testcase that ADCE shouldn't crash on
llvm-svn: 17105
2004-10-17 23:44:02 +00:00
Chris Lattner 6e79e55aea 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.

llvm-svn: 17104
2004-10-17 23:21:07 +00:00
Chris Lattner 5f8becb224 New testcase that crashes the inliner
llvm-svn: 17103
2004-10-17 23:20:29 +00:00
Nate Begeman e5e5b37b79 Pass -single_module option to gcc when linking dynamic libraries for use with bugpoint, so that we can bugpoint multiple .cp files
llvm-svn: 17102
2004-10-17 23:03:32 +00:00
Nate Begeman 844186b8b4 Generate correct stubs for weak-linked symbols
llvm-svn: 17101
2004-10-17 23:01:34 +00:00
Chris Lattner f60137501f fold gep undef, ... -> undef
This comes up many times in perlbmk and probably others.

llvm-svn: 17100
2004-10-17 21:54:55 +00:00
Chris Lattner 107c15c33d Remove printout, realize that instructions in the entry block dominate all
other blocks.

llvm-svn: 17099
2004-10-17 21:31:34 +00:00
Chris Lattner 215c7ebaa6 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

llvm-svn: 17098
2004-10-17 21:25:56 +00:00
Chris Lattner d047673192 New testcase, no PHI should be inserted.
llvm-svn: 17097
2004-10-17 21:25:32 +00:00
Chris Lattner 96db59e48a Enhance hasConstantValue to ignore undef values in phi nodes. This allows it
to think that PHI[4, undef] == 4.

llvm-svn: 17096
2004-10-17 21:23:26 +00:00
Chris Lattner e29d634a94 hasConstantValue will soon return instructions that don't dominate the PHI node,
so prepare for this.

llvm-svn: 17095
2004-10-17 21:22:38 +00:00
Chris Lattner 621c413a1b 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.

llvm-svn: 17094
2004-10-17 17:48:59 +00:00
Chris Lattner 068555314b Don't print stuff out from the code generator. This broke the JIT horribly
last night. :)  bork!

llvm-svn: 17093
2004-10-17 17:40:50 +00:00
Reid Spencer cb13f6e51f Add HAVE_BZLIB_H and HAVE_ZLIB_H tests.
llvm-svn: 17092
2004-10-17 17:07:29 +00:00
Reid Spencer c1f295a66c Update to reflect building zlib for LLVM
llvm-svn: 17091
2004-10-17 15:02:47 +00:00
Reid Spencer 6889cc2d74 Add missing targets for install/clean
llvm-svn: 17090
2004-10-17 15:01:59 +00:00
Reid Spencer f476d84b69 Make the library name SparcV9 specific
llvm-svn: 17089
2004-10-17 15:01:12 +00:00
Reid Spencer b7c9d5444b Consolidate the definitions
llvm-svn: 17088
2004-10-17 15:00:26 +00:00
Reid Spencer de028a4a69 PPC32GenCodeEmitter instead of PowerPCGenCodeEmitter
llvm-svn: 17087
2004-10-17 14:59:38 +00:00
Reid Spencer 85f1cd7893 Add runtime directories
llvm-svn: 17086
2004-10-17 14:58:49 +00:00
Reid Spencer 60be648481 Support bytecode generation, GenCodeEmitter, etc.
llvm-svn: 17085
2004-10-17 14:57:12 +00:00
Reid Spencer c833b76f00 Add runtime directory, include Makefile_rules
llvm-svn: 17084
2004-10-17 14:56:15 +00:00
Chris Lattner 839abf57a6 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.

llvm-svn: 17083
2004-10-17 08:01:28 +00:00
Chris Lattner 112fd88a05 Unify handling of constant pool indexes with the other code paths, allowing
us to use index registers for CPI's

llvm-svn: 17082
2004-10-17 07:49:45 +00:00
Chris Lattner af19d396ac Give the asmprinter the ability to print memrefs with a constant pool index,
index reg and scale

llvm-svn: 17081
2004-10-17 07:16:32 +00:00
Chris Lattner 653d8663fe 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.

llvm-svn: 17080
2004-10-17 06:10:40 +00:00
Chris Lattner e234a21488 All of these labels are off by one now that the unreachable instruction exists
llvm-svn: 17079
2004-10-17 05:37:47 +00:00
Nate Begeman 2c873ca365 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

llvm-svn: 17078
2004-10-17 05:19:20 +00:00
Chris Lattner 192eaccc1a Fix constant folding relational operators with undef operands.
llvm-svn: 17077
2004-10-17 04:01:51 +00:00
Chris Lattner 0e4818c99a Reid added --version to the CommandLine lib. Don't conflict with it.
llvm-svn: 17076
2004-10-17 02:49:08 +00:00
Chris Lattner f6666db032 I forgot that sparc no longer uses the shared asmwriter. Give it support
for undef.

llvm-svn: 17075
2004-10-17 02:44:45 +00:00
Chris Lattner 37b138a00b Add support for unreachable and undef
llvm-svn: 17074
2004-10-17 02:42:42 +00:00
Reid Spencer 94ffa656eb Initial Makefile.am for building with automake
llvm-svn: 17073
2004-10-17 00:24:24 +00:00
Reid Spencer 3d99608cc4 Initial Makefile.am for building with automake.
llvm-svn: 17072
2004-10-17 00:20:42 +00:00
Reid Spencer c0ec7a65a6 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.

llvm-svn: 17071
2004-10-17 00:17:54 +00:00
Chris Lattner fd7bf724d3 Implement constant folding of undef values.
llvm-svn: 17070
2004-10-16 23:31:32 +00:00
Chris Lattner 67f0545daf Fix a type violation
llvm-svn: 17069
2004-10-16 23:28:04 +00:00
Nate Begeman 29dc5f2a3e 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.

llvm-svn: 17068
2004-10-16 20:43:38 +00:00
Chris Lattner 684c5c6587 Kill the bogon that slipped into my buffer before I committed.
llvm-svn: 17067
2004-10-16 19:46:33 +00:00
Chris Lattner 6580e09fef Implement InstCombine/getelementptr.ll:test9, which is the source of many
ugly and giant constnat exprs in some programs.

llvm-svn: 17066
2004-10-16 19:44:59 +00:00
Chris Lattner d2c8ed1170 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.

llvm-svn: 17065
2004-10-16 19:44:23 +00:00
Misha Brukman bbd150eaa7 * Add a space between words
* Wrap at 80 cols

llvm-svn: 17064
2004-10-16 19:13:58 +00:00
Chris Lattner eba3f46b2f Do not erroneously accept revision 6 bytecode files when the format hasn't
been defined yet!

llvm-svn: 17063
2004-10-16 18:56:02 +00:00
Chris Lattner 552663387b Update release notes
llvm-svn: 17062
2004-10-16 18:35:57 +00:00
Chris Lattner 17ce82f71d New testcase
llvm-svn: 17061
2004-10-16 18:28:01 +00:00