Commit Graph

33946 Commits

Author SHA1 Message Date
Chris Lattner
fe9d82a71b Constant fold: getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1)
Into: inttoptr (i64 0 to i8*)  -> null

This occurs in the example in PR1602.  With this fixed, we now compile
the example in PR1602 into fully "devirtualized" code:

define void @_Z1g1S(%struct.S* noalias  %s) {
entry:        %tmp131415 = getelementptr %struct.S* %s, i32 0, i32 0          ; <i32 (...)***> [#uses=1]        %tmp16 = load i32 (...)*** %tmp131415, align 4          ; <i32 (...)**> [#uses=1]
        %tmp26277 = load i32 (...)** %tmp16             ; <i32 (...)*> [#uses=1]
        %tmp2829 = bitcast i32 (...)* %tmp26277 to void (%struct.S*)*           ; <void (%struct.S*)*> [#uses=1]
        tail call void %tmp2829( %struct.S* %s )
        ret void
}

This still has the vtable dispatch (as required) but does not have any pointer
to method cruft left.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41046 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 17:09:08 +00:00
Evan Cheng
6047dd9280 Kill info update bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41043 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 07:12:23 +00:00
Reid Spencer
f6101ac7bc Make use of the llvm-ld tool's new ability to read input from stdin to extract
the list of link time passes to be run, just as for opt, with the
-debug-pass=Arguments option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41040 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 06:19:51 +00:00
Reid Spencer
5c1b53399f Don't build llvm-stub twice.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41039 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-13 00:25:47 +00:00
Chris Lattner
ce7c40cf4b oops, forgot to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41034 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 16:55:14 +00:00
Reid Spencer
276222a5ae Change casts from old style to new style. This helps document the details
better, gives the compiler a chance to validate the cast and reduces warnings
if the user turns on -Wold-style-cast option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 08:12:35 +00:00
Devang Patel
98147a306e Split loops and do CFG cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41029 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 07:02:51 +00:00
Reid Spencer
9626a9c700 Remove unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41028 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 04:45:36 +00:00
Evan Cheng
ccb36a4f1b No need to remove dead range from soon-to-be-dead live interval. Its val# may be out of whack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41024 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 01:26:19 +00:00
Chris Lattner
001f7534e0 constant fold ptrtoint(inttoptr) with target data when available. This allows
us to fold the entry block of PR1602 to false instead of:

br i1 icmp eq (i32 and (i32 ptrtoint (void (%struct.S*)* inttoptr (i64
1 to void (%struct.S*)*) to i32), i32 1), i32 0), label %cond_next, label
%cond_true



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 23:49:01 +00:00
Chris Lattner
8d2e88806b Transform a load from an undef/zero global into an undef/global even if we
have complex pointer manipulation going on.  This allows us to compile
stuff like this:

__m128i foo(__m128i x){
                static const unsigned int c_0[4] = { 0, 0, 0, 0 };
                __m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
                x  = _mm_unpacklo_epi8(x,  v_Zero);
                return x;
}

into:

_foo:
        xorps   %xmm1, %xmm1
        punpcklbw       %xmm1, %xmm0
        ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41022 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 18:48:48 +00:00
Chris Lattner
ace2e8ad0c expand a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41021 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 18:19:07 +00:00
Chris Lattner
384f4a94f8 With evan's explicit flag representation, hopefully we will finally be
able to 3-addressify away stuff like this:

        movl    %ecx, %eax
        decl    %eax



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41020 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 18:16:46 +00:00
Reid Spencer
3c5b57c884 Now that llvm-ld can accept - as input from stdin, use this feature to extract
the pass arguments that it supports.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41019 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 16:11:22 +00:00
Reid Spencer
ba28cb91c9 Fix a comment typo noticed by Sandro Magi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41018 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 15:57:56 +00:00
Bill Wendling
01284b4d55 64-bit SSSE3 ops that use MMX registers don't require 16-byte alignment.
Make a 'memop' pattern just for them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41017 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 09:52:53 +00:00
Evan Cheng
4f8ff168de Code to maintain kill information during register coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41016 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-11 00:59:19 +00:00
Christopher Lamb
a1eb155e52 Use subregs to improve any_extend code generation when feasible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41013 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 22:22:41 +00:00
Christopher Lamb
8441157f6e Fix test so it passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41012 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 22:20:57 +00:00
Christopher Lamb
c59e52108b Increase efficiency of sign_extend_inreg by using subregisters for truncation. As the README suggests sign_extend_subreg is selected to (sext(trunc)).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41010 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 21:48:46 +00:00
Christopher Lamb
6f41435879 Edit README in light of previous LEA16 commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41009 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 21:29:05 +00:00
Christopher Lamb
b81337117c Add 2-addr to 3-addr promotion code that allows 32-bit LEA to be used via subregisters when 16-bit LEA is disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41007 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 21:18:25 +00:00
Christopher Lamb
8b165731bc Move isSubRegOf into MRegisterInfo. Fix a missed move elimination in LowerSubregs and add more debugging output there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41005 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 21:11:55 +00:00
Devang Patel
6b4af744b8 Do not overuse std::string. Pass around char * directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41001 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 18:29:32 +00:00
Devang Patel
423c8b29b8 Clone loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40998 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 18:07:13 +00:00
Devang Patel
4bc2a0b420 Add utility to clone loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40997 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 17:59:47 +00:00
Devang Patel
5ae563aaf9 Add #ifndef guard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40991 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 15:58:23 +00:00
Chris Lattner
942c55bcfe add #ifndef guards
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40990 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 15:53:08 +00:00
Chris Lattner
71996e73d8 add Value::getNameStart/getNameLen() accessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 15:34:35 +00:00
Dan Gohman
57a6f30125 Add a test script for counting lines. This can be used instead of the
"| grep foo | wc -l | grep 2" idiom used by many tests, so that, for
example, tests don't mistakenly accept a count of 12 when 2 is
expected. Also, the new form is more consice: "| grep foo | count 2".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40988 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 15:07:05 +00:00
Dan Gohman
25ac7e8364 Fix EXTRACT_ELEMENT, EXTRACT_SUBVECTOR, and EXTRACT_VECTOR_ELT to
use an intptr ValueType instead of i32 for the index operand in
getCopyToParts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40987 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 14:59:38 +00:00
Rafael Espindola
594d37e21a propagate struct size and alignment of byval arguments to the DAG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40986 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 14:44:42 +00:00
Bill Wendling
ae9671b838 For kicks, I though it would be fun to use the correct opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40985 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 09:00:17 +00:00
Chris Lattner
4f155b4c85 memcpy with zero length is hugely expensive, so avoid it. This speeds up coallescing from 1.17s to 0.88s on siod.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40984 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 07:02:50 +00:00
Chris Lattner
02cee38647 small speedup in the case where a smallvector is default ctor'd from
an empty vector.  This speeds up llc slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40983 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 06:54:38 +00:00
Bill Wendling
76d708b76f Adding SSSE3 intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40982 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 06:22:27 +00:00
Chris Lattner
fc23bc799d minor simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 06:22:25 +00:00
Chris Lattner
417efc897b avoid copying strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40980 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 06:17:04 +00:00
Devang Patel
acb8c09e27 Remove unncessary duplication.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40979 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 00:59:03 +00:00
Devang Patel
23a19f82a7 Calculate exit and start value of true loop and false loop respectively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40978 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 00:53:35 +00:00
Devang Patel
bacf5193cf ExitCondition and Induction variable are loop constraints
not split condition constraints.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40977 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 00:33:50 +00:00
Chris Lattner
b31e91cb16 unbreak the build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40976 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 23:55:17 +00:00
Evan Cheng
a86e347f02 Bug fix. ~1U marks the val# dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40975 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 23:14:39 +00:00
Dale Johannesen
ebbc95da49 Patch 10 for long double. Doing constants right needs expanding ConstantFP
to handle values bigger than double.  If we assume host==target and host
long double works correctly, this is not too bad, but we don't want to
have that limitation longterm.  I could implement accepting double
constants as long double or something like that, which would lead to
incorrect codegen with no errors; the more I think about that the worse
it seems.  Rather than do such a hack that would be backed out later,
I'm settling for giving reasonable error messages, for now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 22:51:36 +00:00
Evan Cheng
a3231ba237 Temporarily backing out this change until we know why some dejagnu tests are failing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40973 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 22:25:35 +00:00
Evan Cheng
f7ef26e701 divb / mulb outputs to ah. Under x86-64 it's not legal to read ah if the instruction requires a rex prefix (i.e. outputs to r8b, etc.). So issue shift right by 8 on AX and then truncate it to 8 bits instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40972 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 21:59:35 +00:00
Chris Lattner
f2369f2042 when we see a unaligned load from an insufficiently aligned global or
alloca, increase the alignment of the load, turning it into an aligned load.

This allows us to compile:

#include <xmmintrin.h>
__m128i foo(__m128i x){
 static const unsigned int c_0[4] = { 0, 0, 0, 0 };
	  __m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
  x  = _mm_unpacklo_epi8(x,  v_Zero);
  return x;
}

into:

_foo:
	punpcklbw	_c_0.5944, %xmm0
	ret
	.data
	.lcomm	_c_0.5944,16,4		# c_0.5944

instead of:

_foo:
	movdqu	_c_0.5944, %xmm1
	punpcklbw	%xmm1, %xmm0
	ret
	.data
	.lcomm	_c_0.5944,16,2		# c_0.5944



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 19:05:49 +00:00
Evan Cheng
a333b41af9 GR16_ sub-register class should be GR8_, not GR8. That is, it should only be 8-bit registers in 32-bit mode. Ditto for GR32_.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40970 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 18:05:17 +00:00
Dale Johannesen
ab081c7195 Update per review comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40965 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 17:27:48 +00:00
Owen Anderson
9528f11481 Make NonLocal and None const in the right way. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 04:42:44 +00:00