Commit Graph

1448 Commits

Author SHA1 Message Date
Eli Friedman 9bb51adcce Tweak *mmintrin.h so that they don't make any bad assumptions about alignment (which probably has little effect in practice, but better to get it right). Make the load in _mm_loadh_pi and _mm_loadl_pi a single LLVM IR instruction to make optimizing easier for CodeGen.
rdar://10054986

llvm-svn: 139874
2011-09-15 23:15:27 +00:00
Eli Friedman 84d2812111 Re-commit r139643.
Make clang use Acquire loads and Release stores where necessary.

llvm-svn: 139650
2011-09-13 22:21:56 +00:00
Eli Friedman acca089617 Revert r139643 while I look into it; it's breaking selfhost.
llvm-svn: 139648
2011-09-13 22:08:16 +00:00
Eli Friedman f92b2e0714 Make clang use Acquire loads and Release stores where necessary.
llvm-svn: 139643
2011-09-13 21:31:32 +00:00
Julien Lerouge d25ed06c63 Make this test portable on Win32.
llvm-svn: 139464
2011-09-10 05:46:15 +00:00
John McCall 5dc5c1ea47 Missed a %local use; hopefully this clears this test up.
llvm-svn: 139462
2011-09-10 05:31:57 +00:00
Eli Friedman 5c917278fd clang part of r139458; un-XFAIL testcase.
llvm-svn: 139460
2011-09-10 02:03:28 +00:00
Richard Trieu c41773ab6a Revision 139454 fixed a broken assert in LLVM, which causes
a test failure in CodeGen/palignr.c, which has been marked
XFAIL for the time being.  A bug has been filed at PR10901
for this issue.

llvm-svn: 139457
2011-09-10 01:56:32 +00:00
John McCall e5e7e6bc84 Make this test not depend on unnecessary details and IR variable names.
llvm-svn: 139455
2011-09-10 01:37:23 +00:00
Julien Lerouge 5a6b6987dc Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.

llvm-svn: 139423
2011-09-09 22:41:49 +00:00
Eric Christopher 65c5c9132f Carry the debug information from single exit unified return block
along with the new insert point.

Fixes PR10829

llvm-svn: 139416
2011-09-09 21:53:04 +00:00
John McCall 7959fee258 Treat the weak export of block runtime symbols as a deployment-target
feature akin to the ARC runtime checks.  Removes a terrible hack where
IR gen needed to find the declarations of those symbols in the translation
unit.

llvm-svn: 139404
2011-09-09 20:41:01 +00:00
Jakob Stoklund Olesen ed2a360fd1 The frexp, modf, and remquo builtins are not 'const'.
These functions return a second value by writing to a pointer argument,
so they cannot be marked 'readnone' which implies that they don't access
memory.

<rdar://problem/10070234>

llvm-svn: 139319
2011-09-08 21:18:03 +00:00
Eli Friedman ce3e2c85b1 Make sure the FunctionDecl's created by "#pragma weak" have correct ParmVarDecl's. PR10878.
llvm-svn: 139224
2011-09-07 04:05:06 +00:00
Eli Friedman e9f8113ec4 Switch clang over to using fence/atomicrmw/cmpxchg instead of the intrinsics (which will go away). LLVM CodeGen does almost exactly the same thing with these and the old intrinsics, so I'm reasonably confident this will not break anything.
There are still a few issues which need to be resolved with code generation for atomic load and store, so I'm not converting the places which need those for now.

I'm not entirely sure what to do about __builtin_llvm_memory_barrier: the fence instruction doesn't expose all the possibilities which can be expressed by __builtin_llvm_memory_barrier.  I would appreciate hearing from anyone who is using this intrinsic.

llvm-svn: 139216
2011-09-07 01:41:24 +00:00
Fariborz Jahanian 4efb6b35f6 Revise test and see if it passes with a release-built clang.
llvm-svn: 139043
2011-09-02 21:47:51 +00:00
Fariborz Jahanian 2bb8270e6f blocks: Support capturing complex variable in block.
// rdar://10033896

llvm-svn: 139041
2011-09-02 21:33:44 +00:00
Fariborz Jahanian b74711df52 revert patch in r139020
llvm-svn: 139029
2011-09-02 20:03:16 +00:00
Fariborz Jahanian f30bc00103 blocks: Support capturing complex variable in block.
// rdar://10033896

llvm-svn: 139020
2011-09-02 18:39:40 +00:00
John McCall a5efa7386a Track whether an AggValueSlot is potentially aliased, and do not
emit call results into potentially aliased slots.  This allows us
to properly mark indirect return slots as noalias, at the cost
of requiring an extra memcpy when assigning an aggregate call
result into a l-value.  It also brings us into compliance with
the x86-64 ABI.

llvm-svn: 138599
2011-08-25 23:04:34 +00:00
Bruno Cardoso Lopes fbb8b84f5f Add testcase for r138411
llvm-svn: 138422
2011-08-24 01:35:04 +00:00
Eric Christopher b58b3e879d Make constant aggregate constant initializers private linkage.
After talking with John making this the case for all of these is
the right way to go.

Fixes rdar://9804564 and PR10414

llvm-svn: 138418
2011-08-24 00:33:55 +00:00
Fariborz Jahanian b50801f049 block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085

llvm-svn: 138314
2011-08-23 00:27:49 +00:00
Eli Friedman c55efe4fb2 Make sure we don't inline functions marked with __attribute__((naked)). <rdar://problem/9973228>
llvm-svn: 138310
2011-08-22 23:55:33 +00:00
Devang Patel 2de80d601a Add new test.
Remove one outdated test.

llvm-svn: 138144
2011-08-19 23:26:54 +00:00
Devang Patel 0e3a9f645b Robustify test, there is no need to check metadata number which can change.
llvm-svn: 137752
2011-08-16 21:01:06 +00:00
Eric Christopher bf005ecd9c 'pure' and 'const' functions should also be marked nounwind. Migrate
test over from llvm/test/FrontendC++ and update others to account for
the change.

llvm-svn: 137669
2011-08-15 22:38:22 +00:00
Eli Friedman 729ed799c7 Update clang tests for r137527.
llvm-svn: 137535
2011-08-12 23:33:52 +00:00
Craig Topper 6d64a738fa Add tests for string literal concatenation.
llvm-svn: 137302
2011-08-11 05:57:09 +00:00
Craig Topper 54edccafc5 Add support for C++0x raw string literals.
llvm-svn: 137298
2011-08-11 04:06:15 +00:00
Chad Rosier e1a6a0e05c Add support for using anonymous bitfields (e.g., int : 0) to enforce alignment.
This fixes cases where the anonymous bitfield is followed by a bitfield member.
E.g.,
struct t4
{
 char foo;
 long : 0;
 char bar : 1;
};

rdar://9859156

llvm-svn: 136991
2011-08-05 22:38:04 +00:00
Matt Beaumont-Gay b0244cf0a4 Output to /dev/null, not "0"
llvm-svn: 136955
2011-08-05 01:05:35 +00:00
Chad Rosier 2c23b27fc7 Formatting.
llvm-svn: 136924
2011-08-04 21:26:30 +00:00
Chad Rosier 18903ee2d3 Add partial support for using anonymous bitfields (e.g., int : 0) to enforce
alignment.  This fixes cases where the anonymous bitfield is followed by a 
non-bitfield member.  E.g.,

struct t4
{
  int foo : 1;
  long : 0;
  char bar;
};

Part of rdar://9859156

llvm-svn: 136858
2011-08-04 01:21:14 +00:00
John McCall 9b24df470d Emit wide string literals with the appropriate alignment.
Patch by Craig Topper and Sundeep!

llvm-svn: 136856
2011-08-04 01:03:22 +00:00
Chad Rosier 6088393248 For APCS the alignment of bitfield types is *not* respected when laying out
structures.  Alignment can be enforced with the use of anonymous bitfields 
(e.g., int :0), but this is not currently supported.  Add this test case to 
document the current state, which will hopefully be fixed shortly. 

llvm-svn: 136848
2011-08-04 00:19:13 +00:00
Chandler Carruth db4c563121 Delete one of the old tests that was ported over to Clang. The test is
designed to be executed, and its output inspected for correct values,
but we aren't executing it. We're just compiling it, and dumping it to
/dev/null. It also isn't freestanding. If there is a desire to have this
test actually stick around, complain and I'll revert this and try to add
the file checks necessary to make this actually test things.

llvm-svn: 136846
2011-08-03 23:53:42 +00:00
Bob Wilson e826a2a56b Handle "homogeneous aggregates" as required by the ARM AAPCS-VFP ABI.
A homogeneous aggregate is an aggregate data structure where after flattening
any nesting there are 1 to 4 elements of the same base type that is either a
float, double, or Neon vector.  All Neon vectors of the same size, either 64
or 128 bits, are treated as equivalent for this purpose.  When using the
AAPCS-VFP ABI, check for homogeneous aggregates and pass them as arguments by
expanding them into a sequence of their base types.  This requires extending
the existing support for expanded arguments to handle not only structs, but
also constant arrays and complex types.

llvm-svn: 136767
2011-08-03 05:58:22 +00:00
John McCall 625ed88f07 When rewriting a call to a K&R function to lead to a well-prototyped
function, be sure to drop parameter attributes when dropping their
associated arguments.  Patch by Aaron Landwehr!

llvm-svn: 136753
2011-08-03 00:43:55 +00:00
Rafael Espindola 11d994b769 Implements alignment for long long and double types in va_arg on ARM AAPCS.
Patch by Jim (Ningjie) Chen.

llvm-svn: 136734
2011-08-02 22:33:37 +00:00
Eric Christopher b081ba651c Add support for the 'Q' arm memory constraint.
Fixes rdar://9866494

llvm-svn: 136524
2011-07-29 21:20:35 +00:00
Douglas Gregor 5e6fcb108f This patch makes the string/character literal tests run in C,
C++98/03, and C++0x mode, from Craig Topper!

llvm-svn: 136443
2011-07-29 01:08:54 +00:00
Peter Collingbourne 05500ba6ec Fix assertion failure in CodeGen where the input operand to an asm
instruction is tied to an output operand which is a pointer, and
the input operand is narrower than the output operand.

llvm-svn: 136438
2011-07-29 00:24:50 +00:00
NAKAMURA Takumi 9b249eecca test/CodeGen/2004-03-16-AsmRegisterCrash.c: XTARGET should accept the part of triplet. ("x86" is not the part of triplet)
llvm-svn: 136346
2011-07-28 11:25:02 +00:00
NAKAMURA Takumi 6a662d30e4 test/CodeGen/struct-matching-constraint.c: Fixup not to emit garbage to source tree.
llvm-svn: 136333
2011-07-28 04:50:11 +00:00
NAKAMURA Takumi 449e4c0f43 test/CodeGen/struct-init.c, struct-matching-constraint.c: Tweak commandline, or they would not be recognized as armv7 on some hosts.
llvm-svn: 136330
2011-07-28 03:53:54 +00:00
Eric Christopher 7089f25dd6 Fix thinko in last checkin.
llvm-svn: 136311
2011-07-28 00:30:42 +00:00
Eric Christopher e040c27fb8 Remove the need for a header and specify a triple so that the type
sizes make sense.

llvm-svn: 136309
2011-07-28 00:28:22 +00:00
Eric Christopher 1137086e19 Fix this up for clang codegen versus llvm-gcc.
llvm-svn: 136308
2011-07-28 00:25:28 +00:00
Eric Christopher 9c8dece1b6 Fix this test to work for arm and on all platforms.
llvm-svn: 136307
2011-07-28 00:22:59 +00:00
Eric Christopher 18a53fca27 Add a triple to this test and make sure it passes on arm where it was
supposed to.

llvm-svn: 136305
2011-07-28 00:13:53 +00:00
Eric Christopher ddc29f002e Correct the triple here.
llvm-svn: 136304
2011-07-28 00:11:03 +00:00
Eric Christopher 6455d84653 This works on arm.
llvm-svn: 136303
2011-07-28 00:10:10 +00:00
Eric Christopher 1aa80a57e0 Apparently this does work on arm.
llvm-svn: 136302
2011-07-28 00:09:38 +00:00
Eric Christopher 8afab4d19e This was meant to test arm anyhow, make the registers agree with the
instruction and the architecture for which the instruction exists.

llvm-svn: 136301
2011-07-28 00:08:06 +00:00
Eric Christopher f65a0e50ff Remove this test, it's actually testing something that clang doesn't support.
llvm-svn: 136300
2011-07-28 00:03:07 +00:00
Eric Christopher 3befed71c6 XFAIL this test on ARM. Filed PR10518 to track.
llvm-svn: 136299
2011-07-27 23:48:42 +00:00
Eric Christopher 93dd260cc9 Remove the optimization option for this test.
llvm-svn: 136298
2011-07-27 23:46:26 +00:00
Eric Christopher 60962757d1 No one cares about ppc, but make this work for arm and x86 and xfail the rest.
llvm-svn: 136297
2011-07-27 23:44:48 +00:00
Eric Christopher 87d383b695 Make this darwin only for now while investigating to clear up x86_64
Release+Asserts linux tests.

llvm-svn: 136223
2011-07-27 16:26:09 +00:00
Douglas Gregor fb65e592e0 Add support for C++0x unicode string and character literals, from Craig Topper!
llvm-svn: 136210
2011-07-27 05:40:30 +00:00
Eric Christopher 12ff9528b2 Handle different sized wchar_t for windows.
llvm-svn: 136192
2011-07-26 23:56:49 +00:00
Eric Christopher 99c3638935 Use the correct definition for memset.
llvm-svn: 136188
2011-07-26 23:44:22 +00:00
Eric Christopher fde54ab8b5 Make this darwin only to simplify the padding calculations per arch.
llvm-svn: 136185
2011-07-26 23:39:23 +00:00
Eric Christopher 8f95f425aa This appears to be passing on all hosts.
llvm-svn: 136182
2011-07-26 23:26:00 +00:00
Eric Christopher ebc113d1d3 Try a little hack to fix the memset duplication on windows.
llvm-svn: 136179
2011-07-26 23:18:10 +00:00
Eric Christopher 9688a17bff Try harder to fix these for windows.
llvm-svn: 136177
2011-07-26 23:12:06 +00:00
Eric Christopher 28f8189866 Generalize for various build bots.
llvm-svn: 136173
2011-07-26 22:52:35 +00:00
Eric Christopher 19520147fc Rewrite match line to be friendlier to misc buildbots.
llvm-svn: 136169
2011-07-26 22:44:31 +00:00
Eric Christopher cf2ea54160 Rewrite matching line to be friendlier to misc buildbots.
llvm-svn: 136168
2011-07-26 22:43:37 +00:00
Eric Christopher f883941903 Attempt to rewrite the matching for this test to pacify the windows
build bots.

llvm-svn: 136166
2011-07-26 22:42:01 +00:00
Eric Christopher 970fa44d70 Rework the match here to silence release mode windows buildbots.
llvm-svn: 136164
2011-07-26 22:32:44 +00:00
Eric Christopher 738c7ef5bb Attempt to generalize this test for release mode buildbots.
llvm-svn: 136163
2011-07-26 22:31:33 +00:00
Eric Christopher 4a8bc43083 Try to generalize the match to quiet the windows build bot.
llvm-svn: 136162
2011-07-26 22:27:01 +00:00
Eric Christopher aee57b4948 Use unsigned long long for uint64_t. Fixes part of the windows buildbot.
llvm-svn: 136160
2011-07-26 22:19:01 +00:00
Eric Christopher 85e5156598 Migrate most of the rest of test/FrontendC from llvm and migrate
most of them to FileCheck.

llvm-svn: 136159
2011-07-26 22:17:02 +00:00
Eric Christopher 2dfed48cae Adjust check for release mode.
llvm-svn: 136158
2011-07-26 22:07:13 +00:00
Eric Christopher e70ea8b806 Migrate:
CodeGen/2003-08-21-WideString.c
       CodeGen/2003-10-02-UnionLValueError.c
       CodeGen/2004-02-20-Builtins.c
       CodeGen/2008-01-04-WideBitfield.c
       CodeGen/2002-07-14-MiscTests3.c
       CodeGen/2005-04-09-ComplexOps.c
       CodeGen/2008-12-23-AsmIntPointerTie.c
       CodeGen/2005-07-20-SqrtNoErrno.c
       CodeGen/2005-01-02-VAArgError-ICE.c
       CodeGen/2004-06-17-UnorderedCompares.c
       CodeGen/2002-06-25-FWriteInterfaceFailure.c
       CodeGen/2002-02-18-64bitConstant.c
       CodeGen/2002-05-24-Alloca.c
       CodeGen/2006-01-13-Includes.c
       CodeGen/2007-09-27-ComplexIntCompare.c
       CodeGen/2004-02-13-IllegalVararg.c
       CodeGen/2007-09-12-PragmaPack.c
       CodeGen/2002-08-02-UnionTest.c

from test/FrontendC with changes to remove header file includes.

llvm-svn: 136153
2011-07-26 21:42:32 +00:00
Eric Christopher def19fb79d Migrate CodeGen/2007-03-05-DataLayout.c from test/FrontendC with changes
to remove header file includes.

llvm-svn: 136134
2011-07-26 20:44:55 +00:00
Eric Christopher 5a1d214c4a Migrate CodeGen/2005-02-20-AggregateSAVEEXPR.c from test/FrontendC with
changes to remove any #include lines.

llvm-svn: 136129
2011-07-26 20:38:19 +00:00
Eric Christopher 1d9aab8c9e Migrate CodeGen/2009-09-24-SqrtErrno.c from test/FrontendC with changes
to avoid header inclusions.

llvm-svn: 136128
2011-07-26 20:31:17 +00:00
Eric Christopher 63683b1e64 Migrate CodeGen/2002-03-11-LargeCharInString.c from test/FrontendC and
modify to avoid any outside includes.

llvm-svn: 136127
2011-07-26 20:29:08 +00:00
Eric Christopher 0a887eca46 Add CodeGen/2009-07-15-pad-wchar_t-array.c migrated from test/FrontendC
and modified to avoid includes.

llvm-svn: 136126
2011-07-26 20:27:12 +00:00
Eric Christopher 320db01d13 Migrate wchar-const.c with fixes and FileCheck from llvm/test/FrontendC.
llvm-svn: 136114
2011-07-26 18:39:16 +00:00
NAKAMURA Takumi a2fd936107 test/CodeGen/2003-08-18-SigSetJmp.c: XFAIL: mingw, too!
llvm-svn: 136043
2011-07-26 01:40:37 +00:00
Eric Christopher 1c7ea99456 win32 doesn't have sigsetjmp, just xfail this test there.
llvm-svn: 136041
2011-07-26 01:32:19 +00:00
Eric Christopher 2da8b9c652 Rework this slightly to work for optimized compilers and remove the
optimization from the test.

llvm-svn: 136039
2011-07-26 01:24:10 +00:00
Eric Christopher 6f2a0d7234 These tests use standard headers and so need ms extensions with MSVC headers.
Use the driver instead of just clang -cc1.

llvm-svn: 136037
2011-07-26 01:12:27 +00:00
Eric Christopher ad869153ba Remove this test, it's more properly an optimizer test.
llvm-svn: 136036
2011-07-26 01:11:20 +00:00
Eric Christopher e6051006ba Migrate and FileCheck-ize some of:
2003-09-18-BitfieldTests.c 2007-04-11-PR1321.c 2003-11-13-TypeSafety.c 2003-08-29-StructLayoutBug.c 2010-05-14-Optimized-VarType.c 2003-10-06-NegateExprType.c 2007-06-05-NoInlineAttribute.c 2011-03-31-ArrayRefFolding.c 2010-07-14-ref-off-end.c Atomics-no64bit.c 2007-05-11-str-const.c 2004-11-27-InvalidConstantExpr.c 2007-04-05-UnPackedStruct.c 2004-03-15-SimpleIndirectGoto.c 2004-01-08-ExternInlineRedefine.c sret2.c 2007-02-07-AddrLabel.c 2002-09-19-StarInLabel.c 2003-11-16-StaticArrayInit.c 2003-08-18-SigSetJmp.c 2007-04-24-VolatileStructCopy.c 2002-07-29-Casts.c 2005-06-15-ExpandGotoInternalProblem.c 2007-09-17-WeakRef.c 2007-04-24-str-const.c 2003-08-30-LargeIntegerBitfieldMember.c inline-asm-mrv.c

from llvm/test/FrontendC.

llvm-svn: 136035
2011-07-26 00:57:50 +00:00
Chris Lattner 84037d3d0a fix PR10415, tidying up IR representation of module level inline asm
to avoid extraneous \n's.

llvm-svn: 135862
2011-07-23 20:04:25 +00:00
Devang Patel 11de9a966a Check column number also.
llvm-svn: 135437
2011-07-18 22:18:04 +00:00
Nick Lewycky ba4cc01a1f Don't crash when codegen'ing an empty redecl of a function in C99 mode, when
neither was inline. Fixes bug introduced in r135377.

llvm-svn: 135380
2011-07-18 07:11:55 +00:00
Nick Lewycky 26da4ddfa6 In C99, emit an inline function when encountering an extern redeclaration.
Fixes PR10233!

llvm-svn: 135377
2011-07-18 05:26:13 +00:00
Chris Lattner 6fb0ccfa0f Enhance the IR type lowering code to be much smarter about recursively lowering
types.  Fore xample, we used to lower:

struct bar { int a; };
struct foo {
 void (*FP)(struct bar);
} G;

to:

%struct.foo = type { {}* }

since the function pointer would cause recursive translation of bar and
we didn't know if that would get us into trouble.  We are now smart enough
to know that it is fine, so we get this type instead:

%struct.foo = type { void (i32)* }

Codegen still needs to be prepared for uncooperative types at any place,
which is why I let the maximally uncooperative code sit around for awhile to
help shake out the bugs.

llvm-svn: 135244
2011-07-15 05:16:14 +00:00
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