Commit Graph

911 Commits

Author SHA1 Message Date
Fariborz Jahanian 6e81492151 Empty enum in c is now error to match gcc's behavior.
(radar 8040068).

llvm-svn: 105011
2010-05-28 22:23:22 +00:00
Fariborz Jahanian 93bef10131 Fix a miscompile of wchar pascal strings.
(radar 8020384)

llvm-svn: 104996
2010-05-28 19:40:48 +00:00
John McCall 02269a66b3 Enable the implementation of __builtin_setjmp and __builtin_longjmp. Not all
LLVM backends support these yet.

llvm-svn: 104867
2010-05-27 18:47:06 +00:00
Douglas Gregor aab11ede6e Fix testsuite for blocks mangling change
llvm-svn: 104618
2010-05-25 17:46:21 +00:00
Benjamin Kramer fdb61d78e9 Implement codegen for __builtin_isnormal.
llvm-svn: 104118
2010-05-19 11:24:26 +00:00
Douglas Gregor 162b419a02 Add missing test case, provided by Steven Watanabe.
llvm-svn: 104037
2010-05-18 17:43:51 +00:00
Douglas Gregor a941dcae16 Add support for Microsoft's __thiscall, from Steven Watanabe!
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Eli Friedman b41ad0fbea PR7117: Make sure we don't lose the calling convention for K&R-style
definitions.
 

llvm-svn: 103932
2010-05-17 02:50:18 +00:00
John McCall b1fb0d3610 The FP constant evaluator was missing a few cases of unary operators that return floats
but whose operand isn't a float:  specifically, __real__ and __imag__.  Instead
of filtering these out, just implement them.

Fixes <rdar://problem/7958272>.

llvm-svn: 103307
2010-05-07 22:08:54 +00:00
Chris Lattner dbff4bf5f4 implement codegen support for __builtin_isfinite, part of PR6083
llvm-svn: 103168
2010-05-06 06:04:13 +00:00
Chris Lattner 68784efaf6 optimize builtin_isnan/isinf to not do an extraneous extension from
float -> double (which happens because they are modelled as int(...)
functions), and add a testcase for isinf.

llvm-svn: 103167
2010-05-06 05:50:07 +00:00
John McCall 4a39ab8078 Emit the globals, metadata, etc. associated with static variables even when
they're unreachable.  This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't.  Fixes PR7044.

llvm-svn: 103052
2010-05-04 20:45:42 +00:00
Devang Patel dfcd0661a1 Use clang::VarDecl name instead of llvm::GlobalVariable name.
llvm::GLobalVariable name may not match user visibile name for function static variables.

llvm-svn: 102644
2010-04-29 17:48:37 +00:00
Mon P Wang 75c645c6d7 A not equal for an unordered relation should return true as specified in IEEE-754, e.g.,
NAN != NAN ? 1 : 0 should return 1.  Also fix the case for complex.

llvm-svn: 102598
2010-04-29 05:53:29 +00:00
John McCall d06fb865eb Properly pass the address of a lazily-generated function declaration with
incomplete type.  Fixes PR6911.

llvm-svn: 102473
2010-04-28 00:00:30 +00:00
Chris Lattner db6d5cb892 Implement PR6845. We allow matching constraints to have different
input and output types when the smaller value isn't mentioned in the
asm string.  Extend this support from integers to also allowing 
fp values to be mismatched (if not mentioned in the asm string).

llvm-svn: 102188
2010-04-23 17:27:29 +00:00
Chris Lattner 6bcf2d81e8 rename test
llvm-svn: 102182
2010-04-23 16:30:17 +00:00
Chris Lattner 1a8f394a1f david conrad points out that {|} in inline assembly on arm are not asm
variants.  This fixes neon inline asm which my patch for PR6780 broke.

llvm-svn: 102181
2010-04-23 16:29:58 +00:00
Daniel Dunbar f812506912 ARM/APCS: Don't respect bit-field types when laying out structures.
- This fixes the last known ABI issues with ARM/APCS.

 - I've run the first 1k ABITests with '--no-unsigned --no-vector --no-complex'
   on {armv6, armv7} x {-mno-thumb, -mthumb}, and the first 10k tests for armv7
   -mthumb, for both function return types and single argument calls. These all
   pass now (they failed horribly before without --no-bitfield).

llvm-svn: 102070
2010-04-22 16:14:54 +00:00
Daniel Dunbar 5981377698 IRgen: Fix another case where we generated an invalid access component when we
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.

llvm-svn: 102068
2010-04-22 15:22:33 +00:00
Daniel Dunbar 5d6c07e0e9 IRgen: Fix case where we might generate an access component with width == 0, if
we have to narrow the access side immediately (can happen with packed,
-fno-bitfield-type-align).

llvm-svn: 102067
2010-04-22 14:56:10 +00:00
Daniel Dunbar fc66e0ed87 IRgen: Set alignment correctly on bit-field accesses.
llvm-svn: 102046
2010-04-22 03:17:04 +00:00
Daniel Dunbar 488f55c271 IRgen: Rewrite bit-field access policy to not access data beyond the bounds of the structure, which we also now verify as part of the post-layout consistency checks.
- This fixes some pedantic bugs with packed structures, as well as major problems with -fno-bitfield-type-align.

 - Fixes PR5591, PR5567, and all known -fno-bitfield-type-align issues.

 - Review appreciated.

llvm-svn: 102045
2010-04-22 02:35:46 +00:00
Daniel Dunbar 53fac692fa ABI/x86-32 & x86-64: Alignment on 'byval' must be set when when the alignment
exceeds the minimum ABI alignment.

llvm-svn: 102019
2010-04-21 19:49:55 +00:00
Daniel Dunbar f5dbc072a6 Convert test to FileCheck.
llvm-svn: 102018
2010-04-21 19:34:17 +00:00
Daniel Dunbar 14ec60024c Convert test to FileCheck.
llvm-svn: 102016
2010-04-21 19:10:54 +00:00
Daniel Dunbar 20b551a443 IRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
matches how we currently handle structs, and this correctly handles
-fno-bitfield-type-align.

llvm-svn: 101918
2010-04-20 17:52:30 +00:00
Chris Lattner 9cffdf1331 don't slap noalias attribute on stret result arguments.
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525.  There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.

llvm-svn: 101877
2010-04-20 05:44:43 +00:00
Nuno Lopes 247a138ec6 recommit r101568 to fix PR6766
as a side-effect, remove two FIXMEs now fixed

llvm-svn: 101726
2010-04-18 19:06:43 +00:00
Anders Carlsson 8345a70c67 Fix an assert when assigning a boolean value to a bitfield of type _Bool.
llvm-svn: 101678
2010-04-17 21:52:22 +00:00
Chris Lattner b714a4b4a0 revert r101568, which miscompiles this testcase, distilled from ldecod:
void exit_picture()
{
  char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};
  foo(yuv_types);
}

llvm-svn: 101623
2010-04-17 06:53:44 +00:00
Nuno Lopes 74b595256a fix PR6766: codegen of var initialized with wide char
llvm-svn: 101568
2010-04-16 23:19:41 +00:00
Nuno Lopes 1c5c30fdd3 add another test for the undef patch just for to have peace of mind :)
this follows from C99 6.7.8p10: if it is a union, the first named member is initialized

llvm-svn: 101539
2010-04-16 21:19:39 +00:00
Chris Lattner 3cff64ab58 fix a bogus assertion exposed by a recent change: packing the
struct may cause it to shrink more than one byte.  Before
my recent changes we compiled the new test into:

%0 = type { [6 x i8] }
@x = global %0 { [6 x i8] undef }, align 2        ; <%0*> [#uses=0]

which is obviously bogus.  Now we compile it into:

%0 = type <{ i32, i8, i8 }>
@x = global %0 zeroinitializer, align 2           ; <%0*> [#uses=0]

Where the last byte only is tail padding.

llvm-svn: 101536
2010-04-16 21:02:32 +00:00
Nuno Lopes 5863c999e7 emit padding as undef values, take 2
merge also a few tests I had here for this feature, and FileCheck'ize one file

llvm-svn: 101535
2010-04-16 20:56:35 +00:00
Daniel Dunbar 67aba79b74 IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

 - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

The new fixes from r101222 are:

 1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.

 2. Swap the order of arguments to OR, to get a tad more constant folding.

llvm-svn: 101339
2010-04-15 03:47:33 +00:00
Eric Christopher 1bbc7086ff Rewrite handling of 64-bit palignr intrinsics to be vector shuffles.
Stop multiplying constant by 8 accordingly in the header and change
intrinsic definition for what types we expect.

Add to existing palignr test to check that we're emitting the correct things.

llvm-svn: 101332
2010-04-15 01:43:08 +00:00
Chris Lattner dd6697b4fa improve altivec c++ support by adding casts, patch by
Anton Yartsev!

llvm-svn: 101281
2010-04-14 20:35:39 +00:00
Daniel Dunbar 91ea6ac3e9 Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.
llvm-svn: 101235
2010-04-14 05:48:35 +00:00
Daniel Dunbar 230e1541b3 IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

 - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

llvm-svn: 101222
2010-04-14 04:08:03 +00:00
Chris Lattner dad4062b4d implement altivec.h and a bunch of support code, patch by Anton Yartsev!
llvm-svn: 101215
2010-04-14 03:54:58 +00:00
Chris Lattner ff0e2a36e2 Rework the ConstStructBuilder code to emit missing initializer
elements with explicit zero values instead of with tail padding.
On an example like this:

struct foo { int a; int b; };

struct foo fooarray[] = {
    {1, 2},
    {4},
};

We now lay this out as:

@fooarray = global [2 x %struct.foo] [%struct.foo { i32 1, i32 2 }, %struct.foo { i32 4, i32 0 }]

instead of as:

@fooarray = global %0 <{ %struct.foo { i32 1, i32 2 }, %1 { i32 4, [4 x i8] zeroinitializer } }>

Preserving both the struct type of the second element, but also the array type of the entire thing.

llvm-svn: 101155
2010-04-13 18:16:19 +00:00
Chris Lattner 933f67887f fix PR6660/6168: emit padding as zeros instead of undef. Because
trailing fields may not be represented in initializer lists, they
are being handled as padding and those fields *must* be zero 
initialized.

llvm-svn: 101067
2010-04-12 21:10:05 +00:00
Benjamin Kramer 249f50ca04 Fix run line so this test actually tests something.
llvm-svn: 100962
2010-04-11 09:39:39 +00:00
Chris Lattner bc3be65d2e fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
llvm-svn: 100938
2010-04-10 18:34:14 +00:00
John McCall 8586bfd85d @llvm.sqrt isn't really close enough to C's sqrt to justify emitting calls
to the intrinsic, even when math-errno is off.

Fixes rdar://problem/7828230 by falling back on the library function.

llvm-svn: 100613
2010-04-07 08:20:20 +00:00
Chris Lattner e6485c5873 add a testcase that the integrated assembler rejects, this verifies
that the integrated assembler is working.

llvm-svn: 100545
2010-04-06 18:46:25 +00:00
Chris Lattner da081a8e1f fix PR6780, properly handling the IR {|} escapes in inline asm strings.
llvm-svn: 100449
2010-04-05 18:44:00 +00:00
Mon P Wang cc2ab0cdc9 Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100305
2010-04-04 03:10:52 +00:00
Daniel Dunbar 8f0be43669 Avoid unneeded calls to opt/llvm-dis.
llvm-svn: 100236
2010-04-02 22:29:38 +00:00
Daniel Dunbar 87c1991bb4 Merge several tests into switch.c.
llvm-svn: 100235
2010-04-02 22:29:35 +00:00
Mon P Wang f7f3bff646 Revert r100193 since it causes failures in objc in clang
llvm-svn: 100200
2010-04-02 18:43:42 +00:00
Mon P Wang 4b82a88764 Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100193
2010-04-02 18:04:30 +00:00
Jakob Stoklund Olesen 4d2972d793 Slightly relax test case. An upcoming LLVM commit will change the xor instruction.
llvm-svn: 99962
2010-03-30 23:57:49 +00:00
Daniel Dunbar c4d551b6ff Fix test in -Asserts build.
llvm-svn: 99960
2010-03-30 23:50:00 +00:00
Bob Wilson adb58e32cc Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
llvm-svn: 99949
2010-03-30 22:28:46 +00:00
Rafael Espindola 49b85ab6e6 Remember the regparm attribute in FunctionType::ExtInfo.
Fixes PR3782.

llvm-svn: 99940
2010-03-30 22:15:11 +00:00
Rafael Espindola 5c61cbeb58 Fix this test on windows. When running on windows we print
double 0.000000e+000
instead of
double 0.000000e+00

llvm-svn: 99932
2010-03-30 21:19:02 +00:00
Mon P Wang 231e99743a Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
llvm-svn: 99930
2010-03-30 21:02:45 +00:00
Rafael Espindola c50c27cca8 the big refactoring bits of PR3782.
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.

llvm-svn: 99920
2010-03-30 20:24:48 +00:00
John McCall 39ec71f2e9 When mapping restrict to noalias, look for 'restrict' on the parameter variable
instead of the canonical parameter type (which has correctly dropped all such
direct qualifiers).  Fixes PR6695.

llvm-svn: 99688
2010-03-27 00:47:27 +00:00
Nick Lewycky 3cfe6af8b5 Implement new mangling for vectors.
llvm-svn: 99616
2010-03-26 07:18:04 +00:00
Daniel Dunbar 3f540c0d7d Remove support for nand atomic builtins. They are inconsistently implemented in
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.

llvm-svn: 99522
2010-03-25 17:13:09 +00:00
Daniel Dunbar 4ff562d557 IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
- This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.

llvm-svn: 99050
2010-03-20 07:04:11 +00:00
Daniel Dunbar 4c43e31d21 Evaluate: Fix a subtle bug in the pointer evaluator in which we would do an
expression computation in the wrong bit-width, and end up generating a totally
bogus array reference (_g0+8589934546).
 - This showed up on Prolangs/cdecl.

llvm-svn: 99042
2010-03-20 05:53:45 +00:00
Chris Lattner 9723d6c699 fix PR6433, crash on va_arg of typedef.
llvm-svn: 98264
2010-03-11 18:19:55 +00:00
Devang Patel 93f274c161 Fix file reference for derived and composite types. Now, dwarf writer uses strict verifier that ignores debug info for such types if their file info is unknown.
llvm-svn: 98096
2010-03-09 22:49:11 +00:00
Chris Lattner e18aaf2c4b add a codegen hack to work around an AST bug, allowing us to compile the
code in PR6537.  This should be reverted when the ast bug is fixed.

llvm-svn: 97981
2010-03-08 21:08:07 +00:00
Eli Friedman 99d20f83ba PR6515: Implement __builtin_signbit and friends.
I'm reasonably sure my implementation is correct, but it would be nice if
someone could double-check.

llvm-svn: 97864
2010-03-06 02:17:52 +00:00
Fariborz Jahanian 2574577828 Remove header file dependencies in block patch
test case.

llvm-svn: 97777
2010-03-05 01:49:18 +00:00
Blaine Garst f27ab71d9f add support for a 1<<29 bit in the block flags field to mark blocks using alternate struct return ABI
llvm-svn: 97775
2010-03-05 01:29:59 +00:00
Rafael Espindola bef98689ad really fix 6473 by handling weakref in constant expressions.
llvm-svn: 97750
2010-03-04 21:26:03 +00:00
Rafael Espindola 2e42fec3a0 Fix PR6473.
Clang's support for weakref is now better than llvm-gcc's :-)

We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.

llvm-svn: 97733
2010-03-04 18:17:24 +00:00
John McCall 731be6620c Revert changes r97693, r97700, and r97718.
Our testing framework can't deal with disabled targets yet.

llvm-svn: 97719
2010-03-04 04:29:44 +00:00
John McCall 61076e1d87 XFAIL these tests on win32, since the win32 buildbot apparently disables all
targets except X86.

llvm-svn: 97718
2010-03-04 04:14:44 +00:00
Eric Christopher 45fa7e60fb Fix __builtin_ia32_roundss and __builtin_ia32_roundsd definitions.
Re-enable test.

llvm-svn: 97707
2010-03-04 01:34:19 +00:00
John McCall 81d4d12504 Implement __builtin_dwarf_sp_column().
llvm-svn: 97700
2010-03-04 00:44:01 +00:00
Chris Lattner eaa2778f27 fix a buildbot failure, this was passing for me because the
'%t' file was left around on my disk.  doh.

llvm-svn: 97699
2010-03-04 00:38:16 +00:00
Chris Lattner aabec2fb84 merge asm-2.c into asm.c, remove asm-inout.c because it is
XFAIL and already tracked in bugzilla.

llvm-svn: 97671
2010-03-03 21:56:57 +00:00
Chris Lattner 576def7fbe fix PR6475, we were doing side-effecting stuff in an assert.
llvm-svn: 97669
2010-03-03 21:52:23 +00:00
Chris Lattner 5cc15e058b add framework for ARM builtins, Patch by Edmund Grimley Evans!
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
John McCall 1629149103 Support constant-evaluation of __builtin_nans* as well as the correct constant
evaluation of __builtin_nan*.  Most of the work to make this work is in LLVM.

Fixes <rdar://problem/7696712> and part of PR 5255.

llvm-svn: 97383
2010-02-28 13:00:19 +00:00
John McCall 8bf8ac0775 Make this test portable to ABIs that use sret.
llvm-svn: 97035
2010-02-24 08:14:27 +00:00
John McCall 1826980fc8 Fix test case and convert fully to FileCheck.
llvm-svn: 97032
2010-02-24 07:33:39 +00:00
John McCall 8ee376f08a Canonicalize parameter and return types before computing ABI info. Eliminates
a common source of oddities and, in theory, removes some redundant ABI
computations.  Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization;  this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.

llvm-svn: 97030
2010-02-24 07:14:12 +00:00
Devang Patel b407338fe2 Emit debug info for VectorType.
llvm-svn: 96999
2010-02-23 22:59:39 +00:00
Blaine Garst dffb51bac8 fix buildbot failure on windows by slightly trimming test output to ignore temporary name
llvm-svn: 96998
2010-02-23 22:59:01 +00:00
Rafael Espindola c18086ae17 Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.
llvm-svn: 96992
2010-02-23 22:00:30 +00:00
Blaine Garst fc83aa04db Unconditionally support block introspection data in a new field at the end
of the block descriptor field.  This field is the ObjC style @encode
signature of the implementation function, and was to this point
conditionally provided in the block literal data structure.  That
provisional support is removed.

Additionally, eliminate unused enumerations for the block literal flags field.
The first shipping ABI unconditionally set (1<<29) but this bit is unused
by the runtime, so the second ABI will unconditionally have (1<<30) set so
that the runtime can in fact distinguish whether the additional data is
present or not.

llvm-svn: 96989
2010-02-23 21:51:17 +00:00
Eli Friedman d2c0de6b44 PR6386: Fix a recent regression in IRGen of cast-to-union constructs.
llvm-svn: 96958
2010-02-23 17:58:35 +00:00
Charles Davis fea4845609 Allow redefinitions of extern inline functions in GNU89 mode, just as GCC
does. Fixes PR5253.

llvm-svn: 96553
2010-02-18 02:00:42 +00:00
Devang Patel 7585580ccc Distinguish two lexical blocks at the same level.
llvm-svn: 96397
2010-02-16 21:41:20 +00:00
Charles Davis 163855f46d dllimport and dllexport are declspec attributes, too. They're also
Win32-specific.

Also, fix a test to use FileCheck instead of grepping LLVM IR.

llvm-svn: 96364
2010-02-16 18:27:26 +00:00
Devang Patel e8814ce0a6 Use getLocStart(), instead of getLocEnd(), to record starting location of objc method. :)
llvm-svn: 96245
2010-02-15 18:08:38 +00:00
Charles Davis 4ea31ab369 Emit the 'alignstack' LLVM function attribute when we encounter a function
marked 'force_align_arg_pointer'. Almost there; now all I need to do is finish
up the backend.

llvm-svn: 96100
2010-02-13 15:54:06 +00:00
Devang Patel 1b5330afe9 Use current location as the location of compiler generated arguments, e.g. self, _cmd etc.
llvm-svn: 95743
2010-02-10 01:09:50 +00:00
Daniel Dunbar a7566f163a IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!

PR6240.

llvm-svn: 95648
2010-02-09 02:48:28 +00:00
John McCall ab26cfa58d Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior:  attributes
written on return types that don't apply there are applied to the function
instead, etc.  Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks).  Consistently consume CC/noreturn
information throughout codegen;  enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().

llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Charles Davis 2b2864c436 Convert this test to FileCheck instead of grepping LLVM IR.
llvm-svn: 95428
2010-02-05 20:45:48 +00:00
Charles Davis 5a5473f0f8 Now that we store calling conventions in the types, use them instead of
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.

llvm-svn: 95399
2010-02-05 18:13:10 +00:00
Douglas Gregor a71cc15361 Implement promotion for enumeration types.
WHAT!?!

It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despite having properly computed the promotion type when the
enum was defined. Various operations on values of enum type just
"worked" because we could still compute the integer rank of an enum
type; the oddity, however, is that operations such as "add an enum and
an unsigned" would often have an enum result type (!). The bug
actually showed up as a spurious -Wformat diagnostic
(<rdar://problem/7595366>), but in theory it could cause miscompiles.

In this commit:
  - Enum types with a promotion type of "int" or "unsigned int" are
  promotable.
  - Tweaked the computation of promotable types for enums
  - For all of the ABIs, treat enum types the same way as their
  underlying types (*not* their promotion types) for argument passing
  and return values
  - Extend the ABI tester with support for enumeration types

llvm-svn: 95117
2010-02-02 20:10:50 +00:00
Daniel Dunbar 96ebba5770 ARM/APCS: Fix classification of small complex integer types as "integer like".
llvm-svn: 95030
2010-02-01 23:31:26 +00:00
Daniel Dunbar eedf151cb1 ARM/APCS: Pass Complex types following llvm-gcc.
llvm-svn: 95029
2010-02-01 23:31:19 +00:00
Chris Lattner 5b5d2db3f6 Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850

llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Devang Patel 156b11368a New test case.
llvm-svn: 94821
2010-01-29 18:32:33 +00:00
Daniel Dunbar 45c7ff1d79 ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.

llvm-svn: 94796
2010-01-29 03:22:29 +00:00
Anders Carlsson b1ef991097 Fix an incorrect union layout assert. Fixes PR6164.
llvm-svn: 94754
2010-01-28 18:22:03 +00:00
Benjamin Kramer b2abc13f28 Adjust testcase for recent DWARF printer changes.
llvm-svn: 94306
2010-01-23 10:14:58 +00:00
Mike Stump 92d487712e Fix for Release-Asserts.
llvm-svn: 93340
2010-01-13 19:40:37 +00:00
Dan Gohman d1e76b957b Use -fno-math-errno by default, and remove the IsMathErrnoDefault
targethook, which is no longer being used. This fixes PR5971.

llvm-svn: 92987
2010-01-08 02:20:44 +00:00
Benjamin Kramer 0128f668a9 __builtin_object_size(ptr, type) returns -1 for type = {0,1} if there are any side-effects.
llvm-svn: 92453
2010-01-03 18:18:37 +00:00
Eli Friedman 906be1b580 Add test for annotate attribute for coverage.
llvm-svn: 92435
2010-01-03 00:51:58 +00:00
Eli Friedman 090adddf15 Fix minor oversight for increment/decrement of complex int. Add tests for
coverage.

llvm-svn: 92433
2010-01-03 00:20:48 +00:00
Eli Friedman bb333722c1 Add a couple more tests for coverage.
llvm-svn: 92430
2010-01-02 23:21:40 +00:00
Eli Friedman e14b1997db Don't look through casts when looking for the underlying decl for a function
call; the standard doesn't expect us to, and the program could be doing
something crazy.  Fixes PR5882.

llvm-svn: 92166
2009-12-26 03:35:45 +00:00
Chris Lattner 9ac2b586c7 fix typo
llvm-svn: 92065
2009-12-23 22:06:12 +00:00
Chris Lattner 4e1a323b85 fix opencl extvector element extraction on rvalues. We previously
error_unsupported on test10 and crashed on test11.

llvm-svn: 92056
2009-12-23 21:31:11 +00:00
Eric Christopher c87915629b Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.

llvm-svn: 91983
2009-12-23 03:49:37 +00:00
Daniel Dunbar a7d0231b66 clang -cc1: Rename -mcpu to -target-cpu to match other target options and not alias driver/backend option.
llvm-svn: 91671
2009-12-18 06:30:12 +00:00
Daniel Dunbar 5618e98f33 Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Fariborz Jahanian a01b67d7b0 Make tests use the new clang -cc1 flag.
llvm-svn: 91303
2009-12-14 18:00:56 +00:00
Nate Begeman 67dfd4236a Revert mmx palignr to use an intrinsic, since mmx shuffle patterns are missing.
llvm-svn: 91269
2009-12-14 05:15:02 +00:00
Nate Begeman 72ec6bc6f4 Support x86's PALIGNR instruction without the use of a palignr intrinsic.
llvm-svn: 91264
2009-12-14 04:57:03 +00:00
Eli Friedman 4f678f3de1 Fix for PR5709: use the computed type of the declaration instead of the
type of the builtin when generating the function declaration for a builtin
library call.

llvm-svn: 90936
2009-12-09 03:05:59 +00:00
Daniel Dunbar f51087656d Remove include of system header.
llvm-svn: 90883
2009-12-08 21:52:24 +00:00
Daniel Dunbar 888a89ccf2 Use clang-cc in this test.
llvm-svn: 90872
2009-12-08 19:49:40 +00:00
Mike Stump b2a568d9e5 Switch over to checking .ll files instead of .s files.
llvm-svn: 90786
2009-12-07 19:22:29 +00:00
Chris Lattner 0f3a228e73 add 'F' to a bunch of libm builtins so that codegen doesn't die on them,
pointed out by Charles Davis.

llvm-svn: 90736
2009-12-07 02:09:14 +00:00
Chris Lattner 2da786f794 fix comment.
llvm-svn: 90660
2009-12-05 08:33:21 +00:00
Chris Lattner ded98d4172 consolidate some tests.
llvm-svn: 90659
2009-12-05 08:30:04 +00:00
Chris Lattner e99c110d06 implement rdar://7346691 by codegen'ing struct/array initializers
to a memset or a memcpy from a global when possible.

llvm-svn: 90658
2009-12-05 08:22:11 +00:00
Chris Lattner ffcd06ea7c simplify a condition and add a testcase.
llvm-svn: 90652
2009-12-05 06:49:57 +00:00
Daniel Dunbar e97582406b Use '-FOO' 'BAR' instead of '-FOO=BAR' for FOO in -stack-protector, -fvisibility, and -fconstant-string-class.
llvm-svn: 90072
2009-11-29 09:33:20 +00:00
Daniel Dunbar 4e7596cc3a Normalize options to use '-FOO' instead of '--FOO'.
llvm-svn: 90071
2009-11-29 09:33:10 +00:00
Anders Carlsson 1299f36af1 Update a test to FileCheck.
llvm-svn: 89610
2009-11-22 18:56:40 +00:00
Ken Dyck 65da2db736 Use intptr_t from stdint.h (in freestanding mode) instead of redefining it here
with __INTPTR_TYPE__.

llvm-svn: 89609
2009-11-22 18:29:06 +00:00
Daniel Dunbar c2588c3bd9 Convert test to FileCheck.
llvm-svn: 89514
2009-11-20 23:46:56 +00:00
Daniel Dunbar 32164f4bdb Driver: Use '-target-abi' 'FOO' instead of '-target-abi=FOO'.
llvm-svn: 89501
2009-11-20 22:32:30 +00:00
Daniel Dunbar 4274685b63 Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Daniel Dunbar 9c7efbb996 Fix some codegen tests to include positive checks.
llvm-svn: 89465
2009-11-20 17:23:39 +00:00
Daniel Dunbar 484afa2d3b Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm:🆑:init(true) arguments.
llvm-svn: 89315
2009-11-19 04:55:23 +00:00
Daniel Dunbar ba0c9e8685 Remove unnecessary &&s.
llvm-svn: 89153
2009-11-17 22:25:07 +00:00
David Chisnall 950a9518b1 Added block type introspection support.
As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple.

llvm-svn: 89134
2009-11-17 19:33:30 +00:00
Daniel Dunbar feedba68b5 Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.
llvm-svn: 89070
2009-11-17 08:57:36 +00:00
Daniel Dunbar f85fabec35 Remove some redundant tests.
llvm-svn: 89069
2009-11-17 08:57:06 +00:00
Daniel Dunbar 4930e3357b Add -fblocks, -stack-protector, and -fobjc-nonfragile-abi defaulting to driver,
instead of using getDefaultLangOptions.
 - Remove unused -fobjc-tight-layout while at it.

llvm-svn: 89065
2009-11-17 08:07:36 +00:00
Jakob Stoklund Olesen 4359796e52 Fix tests after enabling -split-phi-edges.
object-size.c aws simply too fragile.

constructor-default-arg.cpp triggers an issue when LiveVariables is run before RALocal.

llvm-svn: 89025
2009-11-17 01:47:01 +00:00
Eli Friedman b0bc559b19 PR5526: Make sure to set the right cast kinds for the inserted implicit casts.
llvm-svn: 89023
2009-11-17 01:22:05 +00:00
Eli Friedman b210fc598f Make __func__ and friends work correctly within the initializer for a static
local variable.

llvm-svn: 88766
2009-11-14 08:37:13 +00:00