Commit Graph

5397 Commits

Author SHA1 Message Date
Matthijs Kooijman
1cd8f11cc0 For all RUN lines starting with "not", redirect stderr to /dev/null so tests
don't fail when (expected) error output is produced. This fixes 17 tests.

While I was there, I also made all RUN lines of the form "not llvm-as..." a bit
more consistent, they now all redirect stderr and stdout to /dev/null and use
input redirect to read their input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:57:32 +00:00
Matthijs Kooijman
f167bc2922 Suppress the (stderr) output of -aa-eval, this fixes 5 tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:39:15 +00:00
Matthijs Kooijman
c9e00434e3 Change llvm.exp so it no longer ignores some errors when executing dejagnu
tests. This breaks 80 tests in the tree.

The interesting part here is that this no longer ignores syntax errors
in RUN command lines. Some tests have not been working all the time because of
this.

The tricky part is that it now also views any stderr output as an error. This
can be suppressed in tcl 8.5, but let's not add this dependency. Instead, all
testcases should be changed to redirect stderr if they expect stderr output.
This holds in particular for lines like:
  ; RUN: not llvm-as < %s
where an error is expected (but I think I can solve this by modifying the not
script). Also, compilations resulting in warnings will now also fail (so
the warnings should be fixed, disabled or redirected...).

I'll continue with fixing the testcases that are broken now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:28:43 +00:00
Dan Gohman
c5b822b5b6 Convert several tests to use temporary files instead of redundantly
executing the test commands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 00:36:41 +00:00
Dan Gohman
9eb698b96d Fix two more not-grep tests that were missing llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 22:36:45 +00:00
Dan Gohman
7dc1def162 Re-apply 52002, allowing the verifier to accept non-MRV struct return
types on functions, with adjustments so that it accepts both
new-style aggregate returns and old-style MRV returns, including those
with only a single member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:26:13 +00:00
Duncan Sands
eddc8f1f8b Test that prune-eh doesn't make deductions based
on bodies of functions with weak linkage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 11:28:41 +00:00
Rafael Espindola
d674b4e87d add support for PIC on linux x86-64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 09:52:31 +00:00
Chris Lattner
313f0e63f7 lower calls to abs to inline code, PR2337
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 08:26:51 +00:00
Chris Lattner
18d73c206e Fix PR2411, where ip constant prop would propagate the
result of a weak function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:58:07 +00:00
Chris Lattner
7d8ab4efbc Limit the icmp+phi merging optimization to the cases where it is profitable:
don't make i1 phis when it won't be possible to eliminate them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 20:52:11 +00:00
Anton Korobeynikov
7aa700e979 Remove invalid test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 16:59:10 +00:00
Evan Cheng
4d09efd7b8 Speculatively execute a block when the the block is the then part of a triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e.
Turn                                                                                                                                                                                                       
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    br i1 %t1, label %BB1, label %BB2                                                                                                                                                                      
BB1:                                                                                                                                                                                                       
    %t3 = add %t2, c                                                                                                                                                                                       
    br label BB2                                                                                                                                                                                           
BB2:                                                                                                                                                                                                       
=>                                                                                                                                                                                                         
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    %t4 = add %t2, c                                                                                                                                                                                       
    %t3 = select i1 %t1, %t2, %t3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 08:52:29 +00:00
Evan Cheng
cce302fded Fix run line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 08:40:16 +00:00
Anton Korobeynikov
7aa8d44429 Testcase for PR2418
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 16:08:56 +00:00
Dan Gohman
836bfcd689 Revert 52002.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 23:57:06 +00:00
Zhou Sheng
b73afcf6dc Add a test case for opt -instcombine bug fix in revision 52003.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:25:11 +00:00
Matthijs Kooijman
411e6a5efb Change the Verifier to support returning first class aggregrates.
Add a testcase for functions returning first class aggregrates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:00:36 +00:00
Zhou Sheng
b499c86331 Add a test case for APInt bug fix in r51999.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 13:42:21 +00:00
Matthijs Kooijman
02518140ac Learn ScalarReplAggregrates how stores and loads of first class aggregrates
work and how to replace them into individual values. Also, when trying to
replace an aggregrate that is used by load or store with a single (large)
integer, don't crash (but don't replace the aggregrate either).

Also adds a testcase for both structs and arrays.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 12:51:53 +00:00
Matthijs Kooijman
47c6fd7317 Let StructRetPromotion check if all if its users are really calls or invokesn,
not other instructions. This fixes a crash with the added testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:57:20 +00:00
Matthijs Kooijman
257da0a7fc Let StructRetPromotion check if it's users are really calling it and not
passing its pointer. Fixes test with added testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:48:32 +00:00
Evan Cheng
fb4db316d8 Fix a memcpy lowering bug. Even though the memcpy alignment is smaller than the desired alignment, the frame destination alignment may still be larger than the desired alignment. Don't change its alignment to something smaller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 23:37:54 +00:00
Chris Lattner
67f631dfd5 Rewrite a bunch of the CBE's inline asm code, giving it the
ability to handle indirect input operands.  This fixes PR2407.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51952 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 18:03:28 +00:00
Duncan Sands
a0fcc08e65 Change packed struct layout so that field sizes
are the same as in unpacked structs, only field
positions differ.  This only matters for structs
containing x86 long double or an apint; it may
cause backwards compatibility problems if someone
has bitcode containing a packed struct with a
field of one of those types.
The issue is that only 10 bytes are needed to
hold an x86 long double: the store size is 10
bytes, but the ABI size is 12 or 16 bytes (linux/
darwin) which comes from rounding the store size
up by the alignment.  Because it seemed silly not
to pack an x86 long double into 10 bytes in a
packed struct, this is what was done.  I now
think this was a mistake.  Reserving the ABI size
for an x86 long double field even in a packed
struct makes things more uniform: the ABI size is
now always used when reserving space for a type.
This means that developers are less likely to
make mistakes.  It also makes life easier for the
CBE which otherwise could not represent all LLVM
packed structs (PR2402).
Front-end people might need to adjust the way
they create LLVM structs - see following change
to llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51928 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 08:21:45 +00:00
Owen Anderson
3637981050 Testcase for LoopIndexSplit and DomFrontier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51916 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 18:32:27 +00:00
Dan Gohman
6d9861120e nounwindify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 01:21:11 +00:00
Dan Gohman
6e68f59b78 Constant folding for insertvalue and extractvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 00:15:20 +00:00
Devang Patel
2f170997b5 Update dom tree. Fix PR 2372.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 22:52:56 +00:00
Scott Michel
8bf61e8c2a Add necessary 64-bit support so that gcc frontend compiles (mostly). Current
issue is operand promotion for setcc/select... but looks like the fundamental
stuff is implemented for CellSPU.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 22:18:03 +00:00
Dan Gohman
193c235850 Implement CBE support for first-class structs and array values,
and insertvalue and extractvalue instructions.

First-class array values are not trivial because C doesn't
support them. The approach I took here is to wrap all arrays
in structs. Feedback is welcome.

The 2007-01-15-NamedArrayType.ll test needed to be modified
because it has a "not grep" for a string that now exists,
because array types now have associated struct types, and
those struct types have names.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 21:30:49 +00:00
Dan Gohman
37cdad3e59 Fix the position of MemOperands in nodes that use variadic_ops
in DAGISelEmitter output. This bug was recently uncovered by the
addition of patterns for CALL32m and CALL64m, which are nodes
that now have both MemOperands and variadic_ops.

This bug was especially visible with PIC in various configurations,
because the new patterns are matching the indirect call code used
in many PIC configurations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:40:38 +00:00
Wojciech Matyjewicz
98e3a6829a Fixes PR2395. Looking for a constant in a GEP tail (when the first GEP
is longer than the second one) should stop after finding one. Added break 
instruction guarantees it. It also changes difference between offsets to 
absolute value of this difference in the condition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:26:12 +00:00
Owen Anderson
009e4f7609 Fix two issues that Eli Friedman pointed out, where would misoptimized code like:
char a[200];
init(a, a+200);

OR

int a[200];
char* b = (char*)a;
char* c = (char*)a;
foo(b, c);


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 22:26:26 +00:00
Owen Anderson
19d4d12ee0 Test for PR2401
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 21:55:55 +00:00
Duncan Sands
f413cdfb0b When simplifying a call to a bitcast function, tighten up
the conditions for performing the transform when only the
function declaration is available: no longer allow turning
i32 into i64 for example.  Only allow changing between
pointer types, and between pointer types and integers of
the same size.  For return values ptr -> intptr was already
allowed; I added ptr -> ptr and intptr -> ptr while there.
As shown by a recent objc testcase, changing the way
parameters/return values are passed can be fatal when calling
code written in assembler that directly manipulates call
arguments and return values unless the transform has no
impact on the way they are passed at the codegen level.
While it is possible to imagine an ABI that treats integers
of pointer size differently to pointers, I don't think LLVM
supports any so the transform should now be safe while still
being useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51834 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 07:38:42 +00:00
Chris Lattner
76931954f8 update this patch to handle an extraneous &1. This should be pulled
into the 2.3 release branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 19:50:53 +00:00
Nick Lewycky
517e1f5cd7 Peer through sext/zext when looking for not(cmp).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 19:01:33 +00:00
Nick Lewycky
9419ddb289 Add more i1 optimizations. add, sub, mul, s/udiv on i1 are now simplified away.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 17:59:52 +00:00
Nick Lewycky
fd12a0b20b Adding i1 is always Xor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51816 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 17:10:28 +00:00
Chris Lattner
e56d946a38 Fix the CBE's handling of instructions whose result is an i1. Previously,
we did not truncate the value down to i1 with (x&1).  This caused a problem
when the computation of x was nontrivial, for example, "add i1 1, 1" would 
return 2 instead of 0.

This makes the testcase compile into:

...
  llvm_cbe_t = (((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u))&1);
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

instead of:

...
  llvm_cbe_t = ((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u));
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

This fixes a miscompilation of mediabench/adpcm/rawdaudio/rawdaudio and
403.gcc with the CBE, regressions from LLVM 2.2. Tanya, please pull 
this into the release branch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51813 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 09:23:55 +00:00
Dan Gohman
81a0c0b44e IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

There's definately more to come here, but I'm checking this 
basic support in now to make it available to people who are
interested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 00:58:22 +00:00
Mikhail Glushenkov
74a0c28fba Fix the -opt switch and add a test case for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 19:56:27 +00:00
Mikhail Glushenkov
34f376281f Fix: 'sink' handling was broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 06:23:29 +00:00
Nick Lewycky
61435195ce Unbreak this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51726 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 05:02:37 +00:00
Dan Gohman
b4106170dd Add patterns for CALL32m and CALL64m. They aren't matched in most
cases due to an isel deficiency already noted in
lib/Target/X86/README.txt, but they can be matched in this fold-call.ll
testcase, for example.

This is interesting mainly because it exposes a tricky tblgen bug;
tblgen was incorrectly computing the starting index for variable_ops
in the case of a complex pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:50:34 +00:00
Dan Gohman
21323f3a82 Expand small memmovs using inline code. Set the X86 threshold for expanding
memmove to a more plausible value, now that it's actually being used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 19:42:22 +00:00
Anton Korobeynikov
0b85642898 For PR1338: Rename test dirs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 19:17:15 +00:00
Owen Anderson
8cacfebb8e Move these tests into the proper directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 16:30:29 +00:00
Owen Anderson
038a8746c9 Replace the old ADCE implementation with a new one that more simply solves
the one case that ADCE catches that normal DCE doesn't: non-induction variable
loop computations.

This implementation handles this problem without using postdominators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 08:45:13 +00:00
Evan Cheng
f26ffe987c Implement vector shift up / down and insert zero with ps{rl}lq / ps{rl}ldq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 08:22:04 +00:00
Evan Cheng
e65b9a48e3 Add nounwind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 07:09:24 +00:00
Evan Cheng
d77d4f98fb Fix PR2289: vr defined by multiple implicit_def as result of coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 17:40:10 +00:00
Evan Cheng
33d3d4ad40 Teach local register allocator to deal with landing pad MBB's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 17:22:32 +00:00
Chris Lattner
a935db8ea2 Implement PR2370: memmove(x,x,size) -> noop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 05:30:41 +00:00
Dan Gohman
caa98d3ab9 Specify a target so that this tests tests what it's intended to test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 17:55:57 +00:00
Dan Gohman
95628cd44a Make this test independent of the target-triple; the stack alignment
is specifically what this test depends on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 17:44:23 +00:00
Nick Lewycky
aadc6b68c7 Whoops -- forgot PR reference on this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 20:23:33 +00:00
Nick Lewycky
3978927dfa The Linux ABI emits an extra "movl %esp, %ebp" in function prologue and
sometimes a "mov %ebp, %esp" in the epilogue.

Force these tests that rely on counting 'mov' to use i686-apple-darwin8.8.0
where they were written.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51568 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 20:18:56 +00:00
Nick Lewycky
505242f9b6 Use {} instead of "" in RUN lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 01:27:08 +00:00
Nick Lewycky
04b35e8532 Don't treat values as signed when looking at loop steppings in HowForToNonZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 23:43:32 +00:00
Nick Lewycky
3dfd7bf511 "ret (constexpr)" can't be folded into a Constant. Add a method to
Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it
to try to use targetdata to fold constant expressions on void instructions.

Also extend the icmp(inttoptr, inttoptr) folding to handle the case where
int size != ptr size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 20:56:15 +00:00
Chris Lattner
393f7eb60a Fix a serious brain-o. Obviously no-one reviewed my patch :(
This fixes PR2359


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51536 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 04:06:28 +00:00
Chris Lattner
60301608f8 Fix PR2358 by resolving calls with undef arguments to overdefined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 03:59:33 +00:00
Evan Cheng
a31593901d Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 02:56:30 +00:00
Evan Cheng
e716bb1c59 Eliminate x86.sse2.movs.d, x86.sse2.shuf.pd, x86.sse2.unpckh.pd, and x86.sse2.unpckl.pd intrinsics. These will be lowered into shuffles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 02:14:05 +00:00
Evan Cheng
ef1ba3844d New loadl_pd and loadh_pd tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:10:02 +00:00
Evan Cheng
4797f61657 Autoupgrade x86.sse2.loadh.pd and x86.sse2.loadl.pd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:08:39 +00:00
Dan Gohman
80f0f616e8 Don't silently truncate array extents to 32 bits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:40:55 +00:00
Evan Cheng
cd0baf21a1 Use movlps / movhps to modify low / high half of 16-byet memory location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:23:16 +00:00
Dan Gohman
3bf19e4c42 Remove lingering references to .llx and .tr in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:15:35 +00:00
Dan Gohman
0b924dcef8 Use PMULDQ for v2i64 multiplies when SSE4.1 is available. And add
load-folding table entries for PMULDQ and PMULLD.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 17:49:40 +00:00
Matthijs Kooijman
5e179a23e3 Restucture a part of the SimplifyCFG pass and include a testcase.
The SimplifyCFG pass looks at basic blocks that contain only phi nodes,
followed by an unconditional branch. In a lot of cases, such a block (BB) can
be merged into their successor (Succ).

This merging is performed by TryToSimplifyUncondBranchFromEmptyBlock. It does
this by taking all phi nodes in the succesor block Succ and expanding them to
include the predecessors of BB. Furthermore, any phi nodes in BB are moved to
Succ and expanded to include the predecessors of Succ as well.

Before attempting this merge, CanPropagatePredecessorsForPHIs checks to see if
all phi nodes can be properly merged. All functional changes are made to
this function, only comments were updated in
TryToSimplifyUncondBranchFromEmptyBlock.

In the original code, CanPropagatePredecessorsForPHIs looks quite convoluted
and more like stack of checks added to handle different kinds of situations
than a comprehensive check. In particular the first check in the function did
some value checking for the case that BB and Succ have a common predecessor,
while the last check in the function simply rejected all cases where BB and
Succ have a common predecessor. The first check was still useful in the case
that BB did not contain any phi nodes at all, though, so it was not completely
useless.

Now, CanPropagatePredecessorsForPHIs is restructured to to look a lot more
similar to the code that actually performs the merge. Both functions now look
at the same phi nodes in about the same order.  Any conflicts (phi nodes with
different values for the same source) that could arise from merging or moving
phi nodes are detected. If no conflicts are found, the merge can happen.

Apart from only restructuring the checks, two main changes in functionality
happened.

Firstly, the old code rejected blocks with common predecessors in most cases.
The new code performs some extra checks so common predecessors can be handled
in a lot of cases. Wherever common predecessors still pose problems, the
blocks are left untouched.

Secondly, the old code rejected the merge when values (phi nodes) from BB were
used in any other place than Succ. However, it does not seem that there is any
situation that would require this check. Even more, this can be proven.

Consider that BB is a block containing of a single phi node "%a" and a branch
to Succ. Now, since the definition of %a will dominate all of its uses, BB
will dominate all blocks that use %a. Furthermore, since the branch from BB to
Succ is unconditional, Succ will also dominate all uses of %a.

Now, assume that one predecessor of Succ is not dominated by BB (and thus not
dominated by Succ). Since at least one use of %a (but in reality all of them)
is reachable from Succ, you could end up at a use of %a without passing
through it's definition in BB (by coming from X through Succ). This is a
contradiction, meaning that our original assumption is wrong. Thus, all
predecessors of Succ must also be dominated by BB (and thus also by Succ).

This means that moving the phi node %a from BB to Succ does not pose any
problems when the two blocks are merged, and any use checks are not needed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51478 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 09:09:41 +00:00
Nick Lewycky
18b3da6c34 Constant integer vectors may also be negated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:54:45 +00:00
Nick Lewycky
02d639fcc0 Revert X + X --> X * 2 optz'n which pessimizes heavily on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:34:58 +00:00
Nick Lewycky
8539fe26b7 Implement X + X for vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:14:51 +00:00
Nick Lewycky
39ac3b57bc Fix a recently added optimization to not crash on vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 03:26:47 +00:00
Dan Gohman
a332f17c8c Generalize the new code in instcombine's ComputeNumSignBits for handling
and/or to handle more cases (such as this add-sitofp.ll testcase), and
port it to selectiondag's ComputeNumSignBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 02:28:01 +00:00
Dan Gohman
e4977cf750 Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 01:55:30 +00:00
Evan Cheng
b1938263c7 Bug: rcpps can only folds a load if the address is 16-byte aligned. Fixed many 'ps' load folding patterns in X86InstrSSE.td which are missing the proper alignment checks.
Also fixed some 80 col. violations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:37:07 +00:00
Evan Cheng
d86323efc9 Add a couple of test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 21:19:19 +00:00
Evan Cheng
c36c0ab44b Add missing patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51435 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 18:56:56 +00:00
Chris Lattner
f6a048c3a8 Add support for multiple-return values in inline asm. This should
get inline asm working as well as it did previously with the CBE
with the new MRV support for inline asm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 06:19:37 +00:00
Chris Lattner
9c287c2ab4 testcase for PR2267
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 04:45:22 +00:00
Evan Cheng
f4ea510371 Fix PR2343. An *interesting* coalescer bug.
BB1:                                                                                                                                                  
  vr1025 = copy vr1024                                                                                                                                
  ..                                                                                                                                                  
BB2:                                                                                                                                                  
  vr1024 = op                                                                                                                                         
         = op vr1025                                                                                                                                     
  <loop eventually branch back to BB1>

Even though vr1025 is copied from vr1024, it's not safe to coalesced them since live range of vr1025 intersects the def of vr1024. This happens when vr1025 is assigned the value of the previous iteration of vr1024 in the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 22:34:12 +00:00
Gabor Greif
a3f334362f resurrect lost tests by renaming them to not end with .tr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 14:48:24 +00:00
Gabor Greif
5edf210bdf Eliminate questionable syntax for stdin redirection. This probably also speeds things up a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 22:07:21 +00:00
Chris Lattner
eb0fdc150a Fix PR2346 by marking vaarg as volatile so that licm doesn't try to
hoist them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 22:05:28 +00:00
Dan Gohman
7a9708b984 Oops, commit the version of this test that actually works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 21:19:36 +00:00
Dan Gohman
f35c8822a3 Port SelectionDAG's ComputeNumSignBits-using code to instcombine,
now that instcombine also has ComputeNumSignBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 21:01:12 +00:00
Gabor Greif
f6cadc440c sabre brings to my attention that the 'tr' suffix is also obsolete
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 21:00:03 +00:00
Gabor Greif
722243bd40 Rename the last test with .llx extension to .ll, resolve duplicate test by renaming to isnan2. Now that no test has llx ending there is no need to search for them from dg.exp too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 19:52:04 +00:00
Evan Cheng
7a0f1851ec More local spiller complexity!
If local spiller optimization turns some instruction into an identity copy, it will be removed. If the output register happens to be dead (and source is obviously killed), transfer the kill / dead information to last use / def in the same MBB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 08:13:21 +00:00
Evan Cheng
b0a6f62c9b Don't spill dead def.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 08:10:37 +00:00
Chris Lattner
3d28b1b35b Teach instcombine 4 new xforms:
(add (sext x), cst) --> (sext (add x, cst'))
  (add (sext x), (sext y)) --> (sext (add int x, y))
  (add double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
  (add double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))

This generally reduces conversions.  For example MiBench/telecomm-gsm
gets these simplifications:

HACK2: 	%tmp67.i142.i.i = sext i16 %tmp6.i141.i.i to i32		; <i32> [#uses=1]
	%tmp23.i139.i.i = sext i16 %tmp2.i138.i.i to i32		; <i32> [#uses=1]
	%tmp8.i143.i.i = add i32 %tmp67.i142.i.i, %tmp23.i139.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i121.i.i = sext i16 %tmp6.i120.i.i to i32		; <i32> [#uses=1]
	%tmp23.i118.i.i = sext i16 %tmp2.i117.i.i to i32		; <i32> [#uses=1]
	%tmp8.i122.i.i = add i32 %tmp67.i121.i.i, %tmp23.i118.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i.i190.i = sext i16 %tmp6.i.i189.i to i32		; <i32> [#uses=1]
	%tmp23.i.i187.i = sext i16 %tmp2.i.i186.i to i32		; <i32> [#uses=1]
	%tmp8.i.i191.i = add i32 %tmp67.i.i190.i, %tmp23.i.i187.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i173.i.i.i = sext i16 %tmp6.i172.i.i.i to i32		; <i32> [#uses=1]
	%tmp23.i170.i.i.i = sext i16 %tmp2.i169.i.i.i to i32		; <i32> [#uses=1]
	%tmp8.i174.i.i.i = add i32 %tmp67.i173.i.i.i, %tmp23.i170.i.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i152.i.i.i = sext i16 %tmp6.i151.i.i.i to i32		; <i32> [#uses=1]
	%tmp23.i149.i.i.i = sext i16 %tmp2.i148.i.i.i to i32		; <i32> [#uses=1]
	%tmp8.i153.i.i.i = add i32 %tmp67.i152.i.i.i, %tmp23.i149.i.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i.i.i.i = sext i16 %tmp6.i.i.i.i to i32		; <i32> [#uses=1]
	%tmp23.i.i5.i.i = sext i16 %tmp2.i.i.i.i to i32		; <i32> [#uses=1]
	%tmp8.i.i7.i.i = add i32 %tmp67.i.i.i.i, %tmp23.i.i5.i.i		; <i32> [#uses=3]


This also fixes a bug in ComputeNumSignBits handling select and
makes it more aggressive with and/or.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51302 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 05:46:13 +00:00
Dan Gohman
ad2ef21c76 Run vortex-bug as x86-64, which is what the original bug was triggered on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 00:54:39 +00:00
Devang Patel
52abbf5d8a Do not erase induction variable increment if it is used outside the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 22:23:55 +00:00
Chris Lattner
0c7a9a04e7 convert fptosi(sitofp x) -> x if the fp value has enough bits in its mantissa
to accurately represent the integer.  This triggers 9 times in 471.omnetpp,
though 8 of those seem to be inlined from the same place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 20:25:04 +00:00
Chris Lattner
a540623ab1 Fold FP comparisons where one operand is converted from an integer
type and the other operand is a constant into integer comparisons.
This happens surprisingly frequently (e.g. 10 times in 471.omnetpp),
which are things like this:

	%tmp8283 = sitofp i32 %tmp82 to double	
	%tmp1013 = fcmp ult double %tmp8283, 0.0

Clearly comparing tmp82 against i32 0 is cheaper here.

this also triggers 8 times in gobmk, including this one:

	%tmp375376 = sitofp i32 %tmp375 to double
	%tmp377 = fcmp ogt double %tmp375376, 8.150000e+01

which is comparing an integer against 81.5 :).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 20:18:56 +00:00
Chris Lattner
5e0d71877c be more aggressive about transforming add -> or when the operands have no
intersecting bits.  This triggers all over the place, for example in lencode,
with adds of stuff like:

	%tmp580 = mul i32 %tmp579, 2	
	%tmp582 = and i32 %b8, 1
and

	%tmp28 = shl i32 %abs.i, 1		
	%sign.0 = select i1 %tmp23, i32 1, i32 0
and
	%tmp344 = shl i32 %tmp343, 2	
	%tmp346 = and i32 %tmp96, 3

etc.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 20:01:56 +00:00