Commit Graph

1303 Commits

Author SHA1 Message Date
Bruno Cardoso Lopes 98154a76fd Reapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.
llvm-svn: 135091
2011-07-13 21:58:55 +00:00
Devang Patel f0335ce632 Emit debug info for extended vectors.
llvm-svn: 135083
2011-07-13 21:23:30 +00:00
Chris Lattner 3517f14219 PR10337 reminds me that calls return values, lets handle them just
like arguments.  Thanks PR10337! :)

llvm-svn: 135030
2011-07-13 03:59:32 +00:00
Bruno Cardoso Lopes 0aadf83f80 Revert r134946
llvm-svn: 135004
2011-07-12 22:30:58 +00:00
Chris Lattner 73e3004e75 fix an unintended behavior change in the type system rewrite, which caused us to compile
stuff like this:

typedef struct {
 int x, y, z; 
} foo_t;

foo_t g;

into:
%"struct.<anonymous>" = type { i32, i32, i32 }
we now get:
%struct.foo_t = type { i32, i32, i32 }

This doesn't change the behavior of the compiler, but makes the IR much easier to read.

llvm-svn: 134969
2011-07-12 05:53:08 +00:00
Chris Lattner 3ce8668273 fix PR10335 by watching out for IR type compatibility in call argument lists.
llvm-svn: 134966
2011-07-12 04:53:39 +00:00
Chris Lattner 5e3ef09f20 make test name less specific
llvm-svn: 134964
2011-07-12 04:51:05 +00:00
Bruno Cardoso Lopes 75541d00e0 Do the same as r134946 for arrays. Add more testcases for avx x86_64 arg
passing.

llvm-svn: 134951
2011-07-12 01:27:38 +00:00
Bruno Cardoso Lopes 7a26681092 Fix one x86_64 abi issue and the test to actually look for the right thing,
which is: { <4 x float>, <4 x float> } should continue to go through memory.

llvm-svn: 134946
2011-07-12 00:30:27 +00:00
Bruno Cardoso Lopes 21a41bb5ec Reapply r134754, which turns out to be working correctly and also
add one more testcase.

llvm-svn: 134934
2011-07-11 22:41:29 +00:00
Chris Lattner d1f1158203 Fix the clang bootstrap and Jay's testcase from llvm-dev by being completely
conservative when converting a functiontype to IR when in a "pointer within
a struct" context.  This has the unfortunate sideeffect of compiling all 
function pointers inside of structs into "{}*" which, though correct, is
ugly.  This has the positive side effect of being correct, and it is pretty
straight-forward to improve on this.

llvm-svn: 134861
2011-07-10 03:47:27 +00:00
Chris Lattner 8806e32f16 Rename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
it is a predicate, not an action.  Change the return type to be a bool,
not the incomplete member.  Enhace it to detect the recursive compilation
case, allowing us to compile Eli's testcase on llvmdev:

struct T {
 struct T (*p)(void);
} t;

into:

%struct.T = type { {}* }

@t = common global %struct.T zeroinitializer, align 8

llvm-svn: 134853
2011-07-10 00:18:59 +00:00
Chris Lattner a5f58b05e8 clang side to match the LLVM IR type system rewrite patch.
llvm-svn: 134831
2011-07-09 17:41:47 +00:00
Evan Cheng 7b15d1885f cc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c
llvm-svn: 134811
2011-07-09 07:32:07 +00:00
Chris Lattner 380667d520 disable this test to get the botz green again.
llvm-svn: 134808
2011-07-09 07:14:54 +00:00
Eli Friedman a7c9411818 Silly typo in test for r134770.
llvm-svn: 134774
2011-07-08 23:57:18 +00:00
Eli Friedman 3346582bca Change -mno-mmx to be more compatible with gcc. Specifically, -mno-mmx should not imply -mno-sse.
Note that because we don't usually touch the MMX registers anyway, all -mno-mmx needs to do is tweak the x86-32 calling convention a little for vectors that look like MMX vectors, and prevent the definition of __MMX__.

clang doesn't actually stop the user from using MMX inline asm operands or MMX builtins in -mno-mmx mode; as a QOI issue, it would be nice to diagnose, but I doubt it really matters much.

<rdar://problem/9694837>

llvm-svn: 134770
2011-07-08 23:31:17 +00:00
Bruno Cardoso Lopes 129b4cc9ec Revert x86_64 ABI changes until I have time to check the items raised by Eli.
llvm-svn: 134765
2011-07-08 22:57:35 +00:00
Jakub Staszak d2cf2cbae9 Introduce __builtin_expect() intrinsic support.
llvm-svn: 134761
2011-07-08 22:45:14 +00:00
Bruno Cardoso Lopes 308d7423a9 Add support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)
llvm-svn: 134754
2011-07-08 22:18:40 +00:00
Cameron Zwarich ae7bc98710 Add codegen support for the fma/fmal/fmaf builtins.
llvm-svn: 134743
2011-07-08 21:39:34 +00:00
Eric Christopher f7d303c541 Add a testcase for the previous commit and update an existing test for an
extra register.

Part of PR10299 and rdar://9740322

llvm-svn: 134657
2011-07-07 23:11:01 +00:00
Cameron Zwarich be652e6a24 r134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,
so roll it out.

llvm-svn: 134638
2011-07-07 21:03:28 +00:00
Nick Lewycky d755e6ac48 A redeclaration of an inline method in C99 mode should trigger emission of that
function. Fixes PR10233!

llvm-svn: 134634
2011-07-07 20:25:10 +00:00
Fariborz Jahanian 134f4587e7 revert patch for // rdar://9227352
llvm-svn: 134536
2011-07-06 21:05:11 +00:00
Devang Patel 2f5297901d Testcase for r134441.
llvm-svn: 134442
2011-07-05 21:48:46 +00:00
Eli Friedman 1310c68bb0 Don't use x86_mmx where it isn't necessary.
The start of some work on getting -mno-mmx working the way we want it to.

llvm-svn: 134300
2011-07-02 00:57:27 +00:00
Eric Christopher dba0288cbf Add a testcase for r134292.
Part of rdar://9714064

llvm-svn: 134295
2011-07-02 00:28:30 +00:00
Fariborz Jahanian 25e61c58bf Use existing -fcatch-undefined-behavior option,
replacing -freset-local-blocks. // rdar://9227352

llvm-svn: 134082
2011-06-29 18:41:17 +00:00
Fariborz Jahanian fc510bdd94 Under a compiler flag, -freset-local-blocks,
wipe out stack blocks when they go out of scope.
// rdar://9227352

llvm-svn: 134045
2011-06-28 23:51:26 +00:00
John McCall e25bf38d94 Merge this test into another.
llvm-svn: 133957
2011-06-27 22:57:05 +00:00
Nico Weber 8aba2d8014 Revert parts of r133860 to fix a crash. Add a test.
llvm-svn: 133931
2011-06-27 19:46:54 +00:00
John McCall 77527a8e65 Mark the multiply which occurs as part of performing pointer
arithmetic on a VLA as 'nsw', per discussion with djg, and
implement pointer arithmetic (other than array accesses) and
pointer subtraction for VLA types.

llvm-svn: 133855
2011-06-25 01:32:37 +00:00
Devang Patel 15013e78c3 Fix struct member's scope. Patch by Xi Wang.
llvm-svn: 133829
2011-06-24 22:00:59 +00:00
John McCall 23c29fea92 Change the IR-generation of VLAs so that we capture bounds,
not sizes;  so that we use well-typed allocas;  and so that we
properly recurse through the full set of variably-modified types.

llvm-svn: 133827
2011-06-24 21:55:10 +00:00
Fariborz Jahanian 33e022650a Issue warning if weak_import attribute is added to an already
declared variable and ignore it. // rdar://9538608

llvm-svn: 133654
2011-06-22 22:08:50 +00:00
Eric Christopher b4a791f7bc Canonicalize register names properly.
Fixes rdar://9425559

llvm-svn: 133486
2011-06-21 00:07:10 +00:00
Eric Christopher cdd3635b09 Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers.

Fixes part of rdar://9425559

llvm-svn: 133485
2011-06-21 00:05:20 +00:00
Fariborz Jahanian ab578bf355 llvm-gcc treats a tentative definition with a previous
(or follow up) extern declaration with weak_import as 
an actual definition. make clang follows this behavior. 
// rdar://9538608
llvm-gcc treats an extern declaration with weak_import

llvm-svn: 133450
2011-06-20 17:50:03 +00:00
Chris Lattner e64d7ba153 Update to match mainline ConstantStruct::get API change. Also, use
ConvertType on InitListExprs as they are being converted.  This is
needed for a forthcoming patch, and improves the IR generated anyway
(see additional type names in testcases). 

This patch also converts a bunch of std::vector's in CGObjCMac to use
C arrays.  There are a ton more that should be converted as well.

llvm-svn: 133413
2011-06-20 04:01:35 +00:00
Douglas Gregor 2486d6632a Loosen up the IR matching slightly
llvm-svn: 133263
2011-06-17 17:23:28 +00:00
Eric Christopher c2e40c64a0 Remove another variable.
llvm-svn: 133262
2011-06-17 17:04:30 +00:00
Douglas Gregor 6c9d31eb25 When emitting a compound literal of POD type, continue to emit a
separate aggregate temporary and then memcpy it over to the
destination. This fixes a regression I introduced with r133235, where
the compound literal on the RHS of an assignment makes use of the
structure on the LHS of the assignment.

I'm deeply suspicious of AggExprEmitter::VisitBinAssign()'s
optimization where it emits the RHS of an aggregate assignment
directly into the LHS lvalue without checking whether there is any
aliasing between the LHS/RHS. However, I'm not in a position to
revisit this now.

Big thanks to Eli for finding the regression!

llvm-svn: 133261
2011-06-17 16:37:20 +00:00
Eric Christopher f067526adb Clean up test to avoid using standard headers and remove an unneeded
#define.

llvm-svn: 133241
2011-06-17 06:16:34 +00:00
Eric Christopher c8d6afe1d8 Make this test suitable for optimized builds by avoiding the name.
llvm-svn: 133238
2011-06-17 05:24:17 +00:00
Eric Christopher e9544258ef Check the specific target to figure out if a constraint is a valid
register constraint. Note that we're not checking if the register itself
is valid for the constraint.

Fixes rdar://9382985

llvm-svn: 133226
2011-06-17 01:53:34 +00:00
Fariborz Jahanian a27070db0c Set the visibility to 'hidden' when previous
declaration of global var is __private_extern__.
// rdar://9609649

llvm-svn: 133157
2011-06-16 14:49:42 +00:00
Eli Friedman e4ff968f56 Test for r133070.
llvm-svn: 133079
2011-06-15 20:17:07 +00:00
Eli Friedman 7e68c88bf7 Fix a regression from r132957 involving complex integers. (Fixes failures on gcc-testsuite bot.)
llvm-svn: 133069
2011-06-15 18:26:32 +00:00
Eli Friedman eb7fab61bd The LLVM IR representation of byval arguments has a rather strange property: if the alignment of an argument to a call is less than the specified byval alignment for that argument, there is no way to specify the alignment of the implied copy. Therefore, we must ensure that the alignment of the argument is at least the byval alignment. To do this, we have to mess with the alignment of relevant alloca's in some cases, and insert a copy that conceptually shouldn't be necessary in some cases.
This patch tries relatively hard to avoid creating an extra copy if it can be avoided (see test3 in the included testcase), but it is not possible to avoid in some cases (like test2 in the included testcase).

rdar://9483886

llvm-svn: 132957
2011-06-14 01:37:52 +00:00
Stuart Hastings 7fdc6707ac Clang support for ARM Uv/Uy/Uq inline-asm constraints.
rdar://problem/9037836

llvm-svn: 132737
2011-06-07 23:45:05 +00:00
Galina Kistanova f56b4f6fdd These tests require particular registered targets. Declared as such.
llvm-svn: 132600
2011-06-03 22:24:54 +00:00
Galina Kistanova b38fd263bd Added registered targets for in-test dependency declarations.
llvm-svn: 132571
2011-06-03 18:36:30 +00:00
John McCall 77bdccd9bc Test case for some AVX builtins. Patch by Syoyo Fujita!
llvm-svn: 132518
2011-06-03 00:02:45 +00:00
Galina Kistanova 123363cf10 Reverted r132330, r132321, r132320, r132319 as per discussion. Will try in-test requirement declarations instead.
llvm-svn: 132491
2011-06-02 21:55:39 +00:00
Rafael Espindola fb2af643e4 Implement -fgnu89-inline. Fixes PR10041.
llvm-svn: 132460
2011-06-02 16:13:27 +00:00
Galina Kistanova 4503e20ae6 Just one for now to see how it will fly.
llvm-svn: 132321
2011-05-31 00:34:37 +00:00
Eli Friedman b857842c48 Add unnamed_addr to internal globals which are only used as an operand to memcpy. (Spotted by looking at IR.)
llvm-svn: 132226
2011-05-27 22:32:55 +00:00
Eli Friedman 6ffb623a52 Match llvm-gcc's string literals alignment by forcing alignment on string literals to 1. This can significantly impact the size of the string data, and as far as I know, the alignment doesn't help performance. rdar://9078969 .
llvm-svn: 132223
2011-05-27 22:13:20 +00:00
Eli Friedman df96819daf Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.
Originally r130717, but was backed out due to an ObjC regression.

llvm-svn: 132102
2011-05-26 00:10:27 +00:00
Chris Lattner e76b95ae15 make the x86-32 backend specify a byval alignment, even when the
code generator will do it.  With this patch, clang compiles the example
in PR9794 to not have an alloca temporary.

llvm-svn: 131881
2011-05-22 23:35:00 +00:00
Chris Lattner 44c2b90556 Fix x86-64 byval passing to specify the alignment even when the code
generator will give it something sufficient.  This is important because
the mid-level optimizer doesn't know what alignment is required otherwise.

llvm-svn: 131879
2011-05-22 23:21:23 +00:00
Nick Lewycky 2e83c4c4c3 Fix fallout from r131838.
llvm-svn: 131844
2011-05-22 06:50:05 +00:00
Eli Friedman 2f1e9e618c Make __builtin_shufflevector and -ftrapv work correctly together. PR9945.
llvm-svn: 131611
2011-05-19 00:37:32 +00:00
Joerg Sonnenberger caf8ffd8e3 Bug 8765: Honor assembler labels for builtins. Ensure that the label is
mangled to avoid doing it twice for platforms that use prefixes like
Darwin.

llvm-svn: 131311
2011-05-13 21:12:10 +00:00
Bill Wendling bb455154a1 Remove the 'unaligned load' builtins now that they're no longer used in the *mmintrin.h files.
llvm-svn: 131300
2011-05-13 18:52:28 +00:00
Bill Wendling e106c34817 LLVM doesn't always optimize away the four loads from this:
(__m128){ p[0], p[1], p[2], p[3] }

which produces really bad code. This could be done in instcombine, but it's
probably better to do it in the front-end instead.
<rdar://problem/9424836>

llvm-svn: 131237
2011-05-12 19:02:15 +00:00
Fariborz Jahanian b0c0cdc509 Clean up consequences of cut and paste.
llvm-svn: 131190
2011-05-11 17:07:02 +00:00
Fariborz Jahanian 783243b3ca Implenment #pack pragma and ms_struct attribute layout.
Concludes // radar://8823265.

llvm-svn: 131188
2011-05-11 16:58:31 +00:00
Fariborz Jahanian 07ceb0a1a4 Support pack pragma and ms_struct attributes. // rdar://8823265
llvm-svn: 131142
2011-05-10 19:00:50 +00:00
Fariborz Jahanian 7adbed6b4d 'long long' requires special treatment in ms_struct
structs (impacts 32-bit only though).

llvm-svn: 131103
2011-05-09 22:03:17 +00:00
Douglas Gregor 9ca5465500 Revert r130717, which caused a regression (<rdar://problem/9402621>).
llvm-svn: 131057
2011-05-07 20:12:26 +00:00
Fariborz Jahanian 307eace474 In ms_struct structs, Establish a new alignment for a
non-bitfield following a bitfield if size of their types differ.

llvm-svn: 131032
2011-05-06 22:42:22 +00:00
Fariborz Jahanian b7a2879677 Establish a new alignment for an ms_struct bitfield following
a non-bitfield if size of their types differ.

llvm-svn: 131023
2011-05-06 21:56:12 +00:00
Eli Friedman 409943efcb Don't emit nsw flags for vector operations; there's basically no benefit, and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32).
llvm-svn: 131000
2011-05-06 18:04:18 +00:00
Fariborz Jahanian 9f1071831f __alignof attribute on the field must consider
packed attribute on the field. //rdar://9217290

llvm-svn: 130948
2011-05-05 21:19:14 +00:00
Daniel Dunbar 6cb7f64e8b tests: Force a triple in this test (so uint128 is present).
llvm-svn: 130941
2011-05-05 18:54:06 +00:00
Devang Patel 979aba5d09 Do not drop uint128 on the floor.
llvm-svn: 130929
2011-05-05 17:06:30 +00:00
Fariborz Jahanian 9d82fea378 And a test case for my last patch.
llvm-svn: 130853
2011-05-04 18:58:27 +00:00
Fariborz Jahanian 84335f7c8e More ms_struct bitfield stuff:
Adjacent bit fields are packed into the same 1-, 2-, or
4-byte allocation unit if the integral types are the same
size. // rdar://8823265.

llvm-svn: 130851
2011-05-04 18:51:37 +00:00
Fariborz Jahanian 759e4a1add Only the first zero-length bitfield decides alignment of
the followup data member in an ms_struct struct.
// rdar:// 8823265

llvm-svn: 130795
2011-05-03 22:07:14 +00:00
Fariborz Jahanian fc0fe6eb52 Finish off rules for z-length bitfields in ms_struct
structs. // rdar://8823265

llvm-svn: 130783
2011-05-03 20:21:04 +00:00
Chad Rosier f897d3b88b Fixed test case asserts due to checkin of r130710.
llvm-svn: 130720
2011-05-02 20:39:21 +00:00
Eli Friedman 30458b51e3 Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.
llvm-svn: 130717
2011-05-02 20:24:29 +00:00
Fariborz Jahanian eb39741c0b More rule enforcement of zero bitfields for ms_struct.
llvm-svn: 130696
2011-05-02 17:20:56 +00:00
Fariborz Jahanian 99514b9168 block variables on lhs need be ir-gen'ed after the
rhs when its 'forwarding' pointer may be modified 
in rhs evaluation as result of call to Block_copy.
// rdar://9309454

llvm-svn: 130545
2011-04-29 21:53:21 +00:00
Fariborz Jahanian 8409bce4ac ms_struct patch for initialization and field access irgen.
// rdar://8823265 - wip.

llvm-svn: 130451
2011-04-28 22:49:46 +00:00
Fariborz Jahanian bcb23a180b With ms_struct attribut, Zero-length bitfields following
non-bitfield members are ignore. // rdar://8823265 wip

llvm-svn: 130257
2011-04-26 23:52:16 +00:00
Fariborz Jahanian 5a866c0bf2 Ir-gen the side-effect(s) when __builtin_expect is
constant-folded. // rdar://9330105

llvm-svn: 130163
2011-04-25 22:30:02 +00:00
Bob Wilson ee674fb73d Workaround buildbot failure by hacking up this test to emit llvm IR.
This is not a real fix.  It needs some checks to make sure the IR is correct.

llvm-svn: 130012
2011-04-22 20:42:46 +00:00
Justin Holewinski bd4a3c03ff PTX: Add default PTX calling conventions
llvm-svn: 129987
2011-04-22 11:10:38 +00:00
Bob Wilson bf0cd6b83d Add a testcase for svn r129964 (Neon load/store intrinsic alignments).
llvm-svn: 129979
2011-04-22 04:06:49 +00:00
John McCall e0fda7377e The 0.98 revision of the x86-64 ABI clarified a lot of things, some
of which break strict compatibility with previous compilers.  Implement
one of them and then immediately opt out on Darwin.

llvm-svn: 129899
2011-04-21 01:20:55 +00:00
Chris Lattner 54fd1a1ad3 fix a crash on code that uses the result value of __builtin___memcpy_chk.
llvm-svn: 129892
2011-04-20 23:14:50 +00:00
Justin Holewinski 514cce8e43 PTX: Add PTX intrinsics as builtins and add ptx32 and ptx64 as valid architectures for triples, e.g. ptx32-unknown-unknown
llvm-svn: 129870
2011-04-20 19:34:15 +00:00
Chris Lattner 97bbee2fb4 Fix a miscompilation I introduced in r129652, thanks for Eli for tracking
it down.  we effectively were compile the testcase into:

void test14(int x) {
  switch (x) {
    case 11: break;
    case 42: test14(97);  // fallthrough
    default: test14(42); break;

which is not the same thing at all.  This fixes a miscompilation of 
MallocBench/gs seen on the clang-x86_64-linux-fnt buildbot.

llvm-svn: 129679
2011-04-17 23:21:26 +00:00
Chris Lattner 38b6057a93 when assertions are disabled, labels go away. Hopefully fixes the windows build.
llvm-svn: 129660
2011-04-17 16:19:57 +00:00
Chris Lattner bc204c8043 implement rdar://9289524 - case followed immediately by break results in empty IR block,
a -O0 code quality issue.

llvm-svn: 129652
2011-04-17 00:54:30 +00:00
Chris Lattner 30107ed600 fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizes
are trivial.  This exposes opportunities earlier, and allows fastisel
to do good things with these at -O0.

This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0

llvm-svn: 129651
2011-04-17 00:40:24 +00:00
Chris Lattner 56784f9de6 fix rdar://9289603 - clang should fold trivial ?: for enums as well as integer constants into select at -O0
by making the isCheapEnoughToEvaluateUnconditionally predicate handle anything that folds to a constant.  In particular, we now fold enums.

llvm-svn: 129649
2011-04-16 23:15:35 +00:00
Michael J. Spencer 6826eb816a Add 3DNow! Intrinsics.
llvm-svn: 129570
2011-04-15 15:07:13 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Anton Korobeynikov 231e875b5c Implement ARM pcs attribute. Basically it's another way of calling convention selection (AAPCS or
AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86.

In particular, all library functions should always be AAPCS regardless of floating point ABI used.

llvm-svn: 129534
2011-04-14 20:06:49 +00:00
Bill Wendling a865185ad6 Removing the unaligned load tests from builtins-x86.c since they're generated by a regular 'load' now.
llvm-svn: 129464
2011-04-13 20:17:22 +00:00
Eli Friedman 493c34a86c PR9580: Handle vectors correctly in ScalarExprEmitter::EmitRem.
While I'm here, FileCheck-ize the ext-vector test, so we actually check
what it is generating.

llvm-svn: 129241
2011-04-10 04:44:11 +00:00
Eli Friedman c5b20b5283 PR8369: make __attribute((regparm(0))) work correctly. Original patch by
pageexec@freemail.hu, tweaks by me.

llvm-svn: 129206
2011-04-09 08:18:08 +00:00
Chris Lattner 9cb59fa834 add a __sync_swap builtin to fill out the rest of the __sync builtins.
Patch by Dave Zarzycki!

llvm-svn: 129189
2011-04-09 03:57:26 +00:00
John McCall 26d365e149 I can't figure out any reasonable way to make this test non-host-dependent,
so I'm killing it.

llvm-svn: 129026
2011-04-06 20:46:42 +00:00
Peter Collingbourne ba3e6667cc Do not use IR marker for LLVM intrinsics
llvm-svn: 129001
2011-04-06 12:29:09 +00:00
John McCall b1915d62a7 Make this a -cc1 test with a triple and a target feature.
llvm-svn: 128993
2011-04-06 06:48:04 +00:00
John McCall 3cacdf5dbb Anonymify this test.
llvm-svn: 128987
2011-04-06 04:29:52 +00:00
John McCall 91a528841b Implement the AVX cmp builtins as macros instead of static inlines.
Patch by Syoyo Fujita!  Reviewed by Chris Lattner!  Checked in by me!

llvm-svn: 128984
2011-04-06 03:37:51 +00:00
Daniel Dunbar 826342774e IRgen: Reapply r128691 with a fix to ensure we don't increase alignment past
that of the array element type.

llvm-svn: 128698
2011-04-01 00:49:43 +00:00
Daniel Dunbar ea6b81a2ad Revert r128691, "IRgen: Improve GCC compatibility when dealing with packed
arrays by propagating", it's breaking test in ways I don't understand yet.

llvm-svn: 128693
2011-04-01 00:13:33 +00:00
Daniel Dunbar 417bf0f147 IRgen: Improve GCC compatibility when dealing with packed arrays by propagating
the array alignment to the array access.
 - This is more or less the best we can do without having alignment present in
   the type system, but is a long way from truly matching how GCC handles this.

llvm-svn: 128691
2011-03-31 23:32:15 +00:00
Devang Patel adc35e28fc Robustify test string.
llvm-svn: 128486
2011-03-29 21:06:43 +00:00
Devang Patel 298ecb3aaf Add target triple.
llvm-svn: 128480
2011-03-29 20:00:06 +00:00
Devang Patel 6f2e41e0d4 Do not line number entry for unconditional branches. Usually, users do not want to stop at closing '}'.
llvm-svn: 128471
2011-03-29 18:35:54 +00:00
Anton Yartsev 28ccef788b supported: AltiVec vector initialization with a single literal according to PIM section 2.5.1 - after initialization all elements have the value specified by the literal
llvm-svn: 128375
2011-03-27 09:32:40 +00:00
Douglas Gregor 1baf38f5a6 On Mac OS X, the presence of an 'availability' attribute for that
platform implies default visibility. To achieve these, refactor our
lookup of explicit visibility so that we search for both an explicit
VisibilityAttr and an appropriate AvailabilityAttr, favoring the
VisibilityAttr if it is present.

llvm-svn: 128336
2011-03-26 12:10:19 +00:00
John Thompson 88903beaf5 Fixed some of the incompatibilities with gcc.
llvm-svn: 128228
2011-03-24 18:51:57 +00:00
Eli Friedman b4d3c99929 Make sure we aggressively attach nounwind (etc.) to calls to library
functions of the form __builtin_XXX.

llvm-svn: 128198
2011-03-24 05:09:45 +00:00
Rafael Espindola 0c1f098284 Switch from internal to linker_private linkage, it is sufficient to please the new linker.
llvm-svn: 127622
2011-03-14 21:08:19 +00:00
Eric Christopher cf5e83b471 __clear_cache() is varargs and people will occasionally write it without
arguments. Process only the arguments that people write, but process
all of them.

Fixes rdar://8900346

llvm-svn: 127616
2011-03-14 20:30:34 +00:00
Rafael Espindola 7a6cf01895 Fix link of libxul with LTO and the linker in xcode4. It is not clear if this
is working around a bug in ld or if the new linker has a reasonable reason
for wanting the string constant to be linker visible.

llvm-svn: 127594
2011-03-14 17:55:00 +00:00
Bill Wendling ec9d2633f1 When we adjust the inline ASM type, we need to take into account an early
clobber with the 'y' constraint. Otherwise, we get the wrong return type and an
assert, because it created a '<1 x i64>' vector type instead of the x86_mmx
type.

llvm-svn: 127185
2011-03-07 22:47:14 +00:00
Douglas Gregor 19da4e4397 Revert r126422 "Use private linkage to avoid symbol conflicts in
corner cases like the one in PR9301." which caused PR9416. 

llvm-svn: 127136
2011-03-06 23:28:21 +00:00
NAKAMURA Takumi 98835748e3 test/CodeGen/2008-07-17-no-emit-on-error.c: Use LLVM's opt instead of "test(1)" for Mingw MSYS.
Mingw MSYS does not have test.exe (only shell built-in test), and is not capable to invoke test(1) from utils/not.

llvm-svn: 127078
2011-03-05 11:15:55 +00:00
Benjamin Kramer 0f074df979 Only emit string initializers in-place if types match. Fixes PR9373.
llvm-svn: 126883
2011-03-02 21:27:44 +00:00
Eli Friedman 846ded2e53 PR9350: increment/decrement of char (and anything else narrower than int)
can't overflow due to promotion rules; emit a wrapping add for those cases.

llvm-svn: 126816
2011-03-02 01:49:12 +00:00
Douglas Gregor 1bbd2d2ece Kill off more names to fix this test
llvm-svn: 126775
2011-03-01 19:55:40 +00:00
Roman Divacky 5e1af659e9 Fix the test.
llvm-svn: 126768
2011-03-01 18:50:59 +00:00
Roman Divacky 65b88cdb3b Implement -mrtd which sets the StdCall calling convention to be the default
one.

llvm-svn: 126756
2011-03-01 17:40:53 +00:00
Chris Lattner 2e72da947c -fwrapv should turn off the inbounds markers from geps used for pointer
arithmetic.  This is part of PR9256, it would be great if someone else
wired up -fno-strict-overflow in the driver to -fwrapv.

llvm-svn: 126718
2011-03-01 00:03:48 +00:00
Chris Lattner 35d3ac5e9e Make skipping of vardecls more precise: it's ok to skip a decl if the entire
compound stmt containing the decl is skipped.

llvm-svn: 126639
2011-02-28 07:22:44 +00:00
Chris Lattner 62208c395a make switch constant folding a bit stronger, handling a missed case.
llvm-svn: 126638
2011-02-28 07:16:14 +00:00
Ken Dyck 1b4420ed42 Retry r126357. Use CharUnits for the Size and DataSize calculations when
they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.

llvm-svn: 126628
2011-02-28 02:01:38 +00:00
Chris Lattner dc2cc67e57 remove a bogus assertion, add a comment.
llvm-svn: 126603
2011-02-28 01:06:02 +00:00
Chris Lattner 0709542628 make switch condition constant folding much more aggressive, handling
compound statements and break statements.  This implements enough to 
handle PR9322 and rdar://6970405.

llvm-svn: 126602
2011-02-28 01:02:29 +00:00
Chris Lattner 0725a8b653 First tiny step to implementing PR9322: build infrastructure for only emitting the
live case of a switch statement when switching on a constant.  This is terribly
limited, but enough to handle the trivial example included.  Before we would 
emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  switch i32 1, label %sw.epilog [
    i32 1, label %sw.bb
  ]

sw.bb:                                            ; preds = %entry
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  br label %sw.epilog

sw.epilog:                                        ; preds = %sw.bb, %entry
  switch i32 0, label %sw.epilog3 [
    i32 1, label %sw.bb1
  ]

sw.bb1:                                           ; preds = %sw.epilog
  %tmp2 = load i32* %i.addr, align 4
  %add = add nsw i32 %tmp2, 2
  store i32 %add, i32* %i.addr, align 4
  br label %sw.epilog3

sw.epilog3:                                       ; preds = %sw.bb1, %sw.epilog
  ret void
}

now we emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  ret void
}

This improves -O0 compile time (less IR to generate and shove through the code 
generator) and the clever linux kernel people found a way to fail to build if we 
don't do this optimization.  This step isn't enough to handle the kernel case
though.

llvm-svn: 126597
2011-02-28 00:22:07 +00:00
John McCall 53fcbd2718 Pretty up the emission of field l-values and use volatile and TBAA when
loading references as part of that.  Use 'char' TBAA when accessing
(immediate!) fields of a may_alias struct;  fixes PR9307.

llvm-svn: 126540
2011-02-26 08:07:02 +00:00
Rafael Espindola eb4fd01f7a Use private linkage to avoid symbol conflicts in corner cases like the one
in PR9301.

llvm-svn: 126422
2011-02-24 20:31:44 +00:00
Anders Carlsson 4fc229ef69 Move some Objective-C tests to SemaObjC and CodeGenObjC.
llvm-svn: 126175
2011-02-22 01:23:29 +00:00
Chris Lattner 93ede02045 add one more case of mismatched input/output constraints.
When the mismatch is due to a larger input operand that is
a constant, truncate it down to the size of the output.  This
allows us to accept some cases in the linux kernel and elsewhere.
Pedantically speaking, we generate different code than GCC, though
I can't imagine how it would matter:

Clang:
	movb	$-1, %al
	frob %al

GCC:

	movl	$255, %eax
	frob %al

llvm-svn: 126148
2011-02-21 22:09:29 +00:00
Stuart Hastings b6a4d3ebd2 Test case for r126127 and r126141. Radar 9012638.
llvm-svn: 126142
2011-02-21 21:08:21 +00:00
Chris Lattner b0ed51da10 implement a tiny amount of codegen support for gnu array range
designators: allowing codegen when the element initializer is a
constant or something else without a side effect.  This unblocks
enough to let process.c in the linux kernel build, PR9257.

llvm-svn: 126056
2011-02-19 22:28:58 +00:00
John McCall 8377967543 Warn about code that uses variables and functions with internal linkage
without defining them.  This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition.  I'll revisit later.

Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake.  Doing so produces an invalid module
if the variable is not ultimately defined.

Also, fix several places in the test suite where we were using internal
functions without definitions.

llvm-svn: 126016
2011-02-19 02:53:41 +00:00
Devang Patel 1728c232d5 If preprocessed token introduced empty filename then use main translation unit's filename for debug info entries.
llvm-svn: 125672
2011-02-16 18:40:36 +00:00
Rafael Espindola d62acb569c Add a hack to avoid adding '\01' to asm names when possible. It would be
better for clang to always compute the right name, but for now this hack
fixes PR9177 and lets us build firefox with LTO :-)

llvm-svn: 125607
2011-02-15 22:23:51 +00:00
Peter Collingbourne e91b2dbdf1 OpenCL: standardise naming of test cases
llvm-svn: 125590
2011-02-15 19:46:41 +00:00