1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

69 Commits

Author SHA1 Message Date
Chris Lattner
a106725fc5 Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM.  One way to look at it
is through diffstat:
 109 files changed, 3005 insertions(+), 5906 deletions(-)

Removing almost 3K lines of code is a good thing.  Other advantages
include:

1. Value::getType() is a simple load that can be CSE'd, not a mutating
   union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
   uniques them.  This means that the compiler doesn't merge them structurally
   which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
   struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
   in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead 
   "const Type *" everywhere.

Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.  
"LLVM 3.0" is the right time to do this.

There are still some cleanups pending after this, this patch is large enough
as-is.

llvm-svn: 134829
2011-07-09 17:41:24 +00:00
Chris Lattner
78663aa9f5 implement PR9315, constant folding exp2 in terms of pow (since hosts without
C99 runtimes don't have exp2).

llvm-svn: 131872
2011-05-22 22:22:35 +00:00
Chris Lattner
0304b82f80 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Frits van Bommel
c234349939 Constant folding support for calls to umul.with.overflow(), basically identical to the smul.with.overflow() code.
llvm-svn: 128379
2011-03-27 14:26:13 +00:00
Anders Carlsson
1eeebf1c22 When loading from a constant, fold inttoptr if the integer type and the resulting pointer type both have the same size.
llvm-svn: 124987
2011-02-06 20:11:56 +00:00
Nick Lewycky
5259b6a6e2 Add the select optimization recently added to instcombine to constant folding.
This is the one where one of the branches of the select is another select on
the same condition.

llvm-svn: 124547
2011-01-29 20:35:06 +00:00
Nick Lewycky
50f86f3414 Add a constant folding of casts from zero to zero. Fixes PR9011!
While here, I'd like to complain about how vector is not an aggregate type
according to llvm::Type::isAggregateType(), but they're listed under aggregate
types in the LangRef and zero vectors are stored as ConstantAggregateZero.

llvm-svn: 123956
2011-01-21 01:12:09 +00:00
Chandler Carruth
250dce460c Teach constant folding to perform conversions from constant floating
point values to their integer representation through the SSE intrinsic
calls. This is the last part of a README.txt entry for which I have real
world examples.

llvm-svn: 123206
2011-01-11 01:07:24 +00:00
Chandler Carruth
acb82e863d FileCheck-ize a test, and move a no-longer calling test case to another
file and make it actually test something...

llvm-svn: 123205
2011-01-11 01:07:20 +00:00
NAKAMURA Takumi
68063487b1 test/Transforms/ConstProp/logicaltest.ll: FileCheck-ize.
llvm-svn: 122620
2010-12-29 03:58:56 +00:00
Frits van Bommel
6610b43890 Teach ConstantFoldInstruction() how to fold insertvalue and extractvalue.
llvm-svn: 120316
2010-11-29 20:36:52 +00:00
Chris Lattner
7ade54ed02 rename test.
llvm-svn: 119033
2010-11-14 07:03:49 +00:00
Chris Lattner
9b45357c09 filecheckize, remove an old and useless test
llvm-svn: 119032
2010-11-14 07:03:38 +00:00
Chris Lattner
449c3bd7b5 this test is pretty pointless and "propogation" isn't a word (or so Misha claims).
llvm-svn: 119031
2010-11-14 07:02:03 +00:00
Chris Lattner
27d8b68afa fix a bug I introduced, no idea how this didn't repro right.
llvm-svn: 116462
2010-10-14 00:30:00 +00:00
Chris Lattner
7c5912d186 hack to unbreak buildbots
llvm-svn: 116461
2010-10-14 00:26:10 +00:00
Chris Lattner
451a0accb5 add uadd_ov/usub_ov to apint, consolidate constant folding
logic to use the new APInt methods.  Among other things this
implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold

which comes from "clang -ftrapv", originally brought to my attention from PR8221.

llvm-svn: 116457
2010-10-14 00:05:07 +00:00
Chris Lattner
238f46d92e remove some noise from tests.
llvm-svn: 112889
2010-09-02 22:35:33 +00:00
Chris Lattner
8e4042108e fix PR6197 - infinite recursion in ipsccp due to block addresses
evaluateICmpRelation wasn't handling blockaddress.

llvm-svn: 94993
2010-02-01 19:35:08 +00:00
Nick Lewycky
938b8b195c Fix a crasher trying to fold each element in a comparison between two vectors
if one of the vectors didn't have elements (such as undef). Fixes PR 6096.

Fix an issue in the constant folder where fcmp (<2 x %ty>, <2 x %ty>) would
have <2 x i1> type if constant folding was successful and i1 type if it wasn't.
This exposed a related issue in the bitcode reader.

llvm-svn: 94069
2010-01-21 07:03:21 +00:00
Chris Lattner
0dc48180de fix PR5978 by peeling the loop so that we avoid shifting the
result int by 8 for the first byte.  While normally harmless,
if the result is smaller than a byte, this shift is invalid.

llvm-svn: 93018
2010-01-08 19:02:23 +00:00
Chris Lattner
107fc93d48 Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant.

llvm-svn: 90545
2009-12-04 06:29:29 +00:00
Edward O'Callaghan
e9e8913261 Convert a few tests to FileCheck for PR5307.
llvm-svn: 85171
2009-10-26 22:52:03 +00:00
Chris Lattner
9a1f5c9f90 fix PR5287, a serious regression from my previous patches. Thanks to
Duncan for the nice tiny testcase.

llvm-svn: 84992
2009-10-24 05:22:15 +00:00
Chris Lattner
4874f5bce5 teach libanalysis to simplify vector loads with bitcast sources. This
implements something out of Target/README.txt producing:

_foo:                                                       ## @foo
	movl	4(%esp), %eax
	movapd	LCPI1_0, %xmm0
	movapd	%xmm0, (%eax)
	ret	$4

instead of:

_foo:                                                       ## @foo
	movl	4(%esp), %eax
	movapd	_b, %xmm0
	mulpd	LCPI1_0, %xmm0
	addpd	_a, %xmm0
	movapd	%xmm0, (%eax)
	ret	$4

llvm-svn: 84942
2009-10-23 06:57:37 +00:00
Chris Lattner
2ee1f0f0b5 enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32
bytes (i256).

llvm-svn: 84941
2009-10-23 06:50:36 +00:00
Chris Lattner
b1d2706a4c teach libanalysis to fold int and fp loads from almost arbitrary
non-type-safe constant initializers.  This sort of thing happens
quite a bit for 4-byte loads out of string constants, unions, 
bitfields, and an interesting endianness check from sqlite, which
is something like this:

const int sqlite3one = 1;
# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)

all of these macros now constant fold away.

This implements PR3152 and is based on a patch started by Eli, but heavily
modified and extended.

llvm-svn: 84936
2009-10-23 06:23:49 +00:00
Chris Lattner
2c890dc2b4 Teach vm core to more aggressively fold 'trunc' constantexprs,
allowing it to simplify the crazy constantexprs in the testcases
down to something sensible.  This allows -std-compile-opts to
completely "devirtualize" the pointers to member functions in
the testcase from PR5176.

llvm-svn: 84368
2009-10-17 21:53:27 +00:00
Chris Lattner
ebc645ca40 remove # uses from FileCheck lines.
llvm-svn: 84367
2009-10-17 21:51:19 +00:00
Chris Lattner
270ab44108 rename test
llvm-svn: 84364
2009-10-17 21:31:19 +00:00
Evan Phoenix
1b803795c7 Extend ConstantFolding to understand signed overflow variants
llvm-svn: 83338
2009-10-05 22:53:52 +00:00
Chris Lattner
7d19c8841c teach the optimizer how to constant fold uadd/usub intrinsics.
llvm-svn: 83295
2009-10-05 05:26:04 +00:00
Nick Lewycky
ecb17d4648 Peer through zext and sext to eliminate them when it is safe to do so.
llvm-svn: 82389
2009-09-20 07:31:25 +00:00
Nick Lewycky
991c5185bb Fold 'icmp eq (icmp), true' into an xor(icmp).
llvm-svn: 82386
2009-09-20 07:21:39 +00:00
Nick Lewycky
c09c2772d5 Rewrite this check so that it checks what it's supposed to and doesn't use
CHECK-NOT.

llvm-svn: 82383
2009-09-20 07:00:24 +00:00
Nick Lewycky
5cbc7c4ae9 Teach the constant folder how to not a cmpinst.
llvm-svn: 82378
2009-09-20 06:24:51 +00:00
Nick Lewycky
93d1111b1c Try turning icmp(bitcast(x), bitcast(y)) into icmp(bitcast(bitcast(x)), y) in
the hopes that the two bitcasts will merge.

llvm-svn: 82371
2009-09-20 05:48:50 +00:00
Nick Lewycky
6ad3b51864 Teach the constant folder how to handle a few simple i1 cases.
llvm-svn: 82340
2009-09-20 00:04:02 +00:00
Chris Lattner
37129ec8fc convert to filecheck
llvm-svn: 81848
2009-09-15 06:34:29 +00:00
Dan Gohman
205b641954 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.

llvm-svn: 81537
2009-09-11 18:01:28 +00:00
Dan Gohman
c95df8b6d8 Use opt -S instead of piping bitcode output through llvm-dis.
llvm-svn: 81257
2009-09-08 22:34:10 +00:00
Dan Gohman
8d84372836 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.

llvm-svn: 81226
2009-09-08 16:50:01 +00:00
Daniel Dunbar
214f0db25c Eliminate some Tclisms.
llvm-svn: 81081
2009-09-05 11:34:46 +00:00
Chris Lattner
6bcf9e8095 Fix month.
llvm-svn: 80769
2009-09-02 06:34:22 +00:00
Chris Lattner
1f08c79edc fix PR4848 an infinite loop when indexing down through a recursive gep
and we get the original pointer type.  This doesn't mean that we're
at the first pointer being indexed.  Correct the predicate.

llvm-svn: 80762
2009-09-02 05:35:45 +00:00
Nick Lewycky
d46a7b2d22 Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.

llvm-svn: 74991
2009-07-08 03:04:38 +00:00
Nick Lewycky
4020821885 Expand this test to handle more cases (remainder and shifts) of zero.
llvm-svn: 73839
2009-06-21 01:56:41 +00:00
Chris Lattner
affcc71da2 implement PR4424: 0/x is always 0 for integer division.
llvm-svn: 73835
2009-06-21 01:15:55 +00:00
Dan Gohman
5f6f8101d5 Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Chris Lattner
3048ccc1f9 apply Eli's patch for PR2165 and provide a testcase.
llvm-svn: 57625
2008-10-16 05:26:51 +00:00