Commit Graph

799 Commits

Author SHA1 Message Date
Chuck Rose III
d4af306aec Added default parameters to GetElementPtrInstr constructor call. Visual Studio 2k5 was getting confused and was unable to compile it. Suspected compiler error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41721 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05 16:54:38 +00:00
David Greene
b8f74793b9 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04 15:46:09 +00:00
Chris Lattner
92103de8ce Cut off crazy computation. This helps PR1622 slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41522 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 04:23:55 +00:00
David Greene
f1355a55f8 Update InvokeInst to work like CallInst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41506 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27 19:04:21 +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
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
Nick Lewycky
f947b3edb5 It's safe to fold not of fcmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40870 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 20:04:16 +00:00
Chris Lattner
a9ff5eb76e at the end of instcombine, explicitly clear WorklistMap.
This shrinks it down to something small.  On the testcase
from PR1432, this speeds up instcombine from 0.7959s to 0.5000s,
(59%)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 08:47:58 +00:00
Chandler Carruth
6994040a95 This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40807 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:51:18 +00:00
Chris Lattner
5543a856ff Replacing a cast with another one does not reduce the number of
casts in the input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40741 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 17:23:38 +00:00
Chris Lattner
b014678eb3 Disable an xform that causes an infinite loop. This fixes PR1594
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40739 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 16:56:32 +00:00
Chris Lattner
684b22df79 wrap some long lines. Major offenders that are left include
gvn, gvnpre, dse, and predsimplify.  To see these, use:

  make check-line-length



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40738 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 16:53:43 +00:00
Chris Lattner
951626b437 Enhance instcombine to be more aggressive about folding casts of
operations of casts.  This implements InstCombine/zext-fold.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40726 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 06:11:14 +00:00
David Greene
52eec54820 New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 03:43:44 +00:00
Lauro Ramos Venancio
c7d1114ade Fix a bug in GetKnownAlignment of packed structs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 20:13:21 +00:00
Reid Spencer
ed3fa8552a Fix a typo/thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40599 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 19:53:57 +00:00
Chris Lattner
410ce1c49a completely remove a transformation that is unsafe in the face of
undefs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40439 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 17:10:17 +00:00
Devang Patel
00ae1a2f02 Apply temporary work around to fix llvm mis-compilation
reported in PR 1556.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40133 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 00:34:29 +00:00
Chris Lattner
3ccc6bc61c this xform is already done by the constant folder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40124 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 22:06:41 +00:00
Dan Gohman
9941f7426d Optimize alignment of loads and stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40102 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 16:34:21 +00:00
Dan Gohman
07a96765da Fix comments about vectors to use the current wording.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 14:29:03 +00:00
Chris Lattner
cb7122bb7d Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39896 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 04:15:34 +00:00
Chris Lattner
4241e4da85 Implement shift-simplify.ll:test[45].
First teach instcombine that sign bit checks only demand the 
sign bit, this allows simplify demanded bits to hack on 
expressions better.

Second, teach instcombine that ashr is useless if only the
sign bit is demanded.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39880 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 20:54:51 +00:00
Chris Lattner
a0141b90a3 Implement shift-simplify.ll:test3, turning:
(X << 31) <s 0  --> (X&1) != 0

This happens dozens of times in the CFE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39879 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 20:42:37 +00:00
Chris Lattner
1dbfd48fa2 Significantly improve the documentation of the instcombine divide/compare
transformation.  Also, keep track of which end of the integer interval overflows
occur on.  This fixes Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll
and rdar://5278853, a miscompilation of perl.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 18:11:19 +00:00
Chris Lattner
562ef78df2 refactor a bunch of code out of visitICmpInstWithInstAndIntCst into its own
routine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37679 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-20 23:46:26 +00:00
Chris Lattner
2384d7b179 silence a bogus warning Duraid ran into.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 05:43:49 +00:00
Chris Lattner
7cbe2ebb21 Generalize many transforms to work on ~ of vectors in addition to ~ of
integer ops.  This implements Transforms/InstCombine/and-or-not.ll
test3/test4, and finishes off PR1510


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 06:23:19 +00:00
Chris Lattner
003b6200df Implement two xforms:
1. ~(~X | Y) === (X & ~Y)
2. (A|B) & ~(A&B) -> A^B

This allows us to transform  ~(~(a|b) | (a&b)) -> a^b.

This implements PR1510 for scalar values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 05:58:24 +00:00
Chris Lattner
041a6c9048 delete some obviously dead vector operations, which deletes a few thousand
operations from Duraids example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 05:26:55 +00:00
Lauro Ramos Venancio
d0499af703 Fix PR1499.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 17:08:48 +00:00
Chris Lattner
2b7e0ade62 fix a miscompilation when passing a float through varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37297 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-23 01:17:04 +00:00
Chris Lattner
a2b18de4ba Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates
objc code due to the way the FE lowers objc message sends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37256 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-19 06:51:32 +00:00
Chris Lattner
6b6aef8efc Fix Transforms/InstCombine/2007-05-14-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37057 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-15 00:16:00 +00:00
Dan Gohman
23d9d27c26 Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36994 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 21:10:54 +00:00
Chris Lattner
3aea1bdca5 fix regressions from my previous checking, including
Transforms/InstCombine/2006-12-08-ICmp-Combining.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 16:58:45 +00:00
Chris Lattner
8885887b9c fix Transforms/InstCombine/2007-05-10-icmp-or.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36984 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 05:55:56 +00:00
Nick Lewycky
ecd94c804a Fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36873 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 13:37:16 +00:00
Chris Lattner
6f6f5125e2 Fix a bug in my previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 07:24:03 +00:00
Chris Lattner
8c756c1fff Implement Transforms/InstCombine/cast_ptr.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36809 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 22:41:33 +00:00
Chris Lattner
d717c1859a wrap long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36807 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 22:32:24 +00:00
Chris Lattner
c42e226f08 Fix InstCombine/2007-05-04-Crash.ll and PR1384
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36775 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 01:59:31 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Chris Lattner
7f3c4d49df fix a bug triggered by 403.gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36527 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 05:27:36 +00:00
Chris Lattner
e62f021c8c Fix several latent bugs in EmitGEPOffset that didn't manifest with its
previous clients.  This fixes MallocBench/gs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36525 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 04:52:43 +00:00
Chris Lattner
53c22fc7c6 uhn zap cvs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36523 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 03:50:56 +00:00
Chris Lattner
9bc1464094 Implement PR1345 and Transforms/InstCombine/bitcast-gep.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36521 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 00:57:34 +00:00
Chris Lattner
d3e28347e5 refactor some code relating to pointer cast xforms, pulling it out of the codepath
for unrelated casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-27 17:44:50 +00:00