Commit Graph

1535 Commits

Author SHA1 Message Date
Chandler Carruth 392357eea0 Rename a test case to a more generic name. This is a completely useless
test, but David Sehr is looking at spiffing it up and adding some proper
tests for our alloca codegen.

llvm-svn: 158181
2012-06-08 00:06:56 +00:00
Fariborz Jahanian 5d53fcda7c User better API for vla in compund literals.
// rdar://11485774

llvm-svn: 158157
2012-06-07 18:15:55 +00:00
Fariborz Jahanian bbc5bbf4f1 When emitting compund literal of vla pointer elements, make
sure to emit vla size to prevent an irgen crash.
// rdar://11485774

llvm-svn: 158153
2012-06-07 17:07:15 +00:00
Fariborz Jahanian ff045dc040 reverse r158117.
llvm-svn: 158119
2012-06-06 23:21:58 +00:00
Fariborz Jahanian 67164852a7 When doing arithmatic on vla pointer, make sure
to emit vla size to prevent an irgen crash.
// rdar://11485774

llvm-svn: 158117
2012-06-06 22:58:50 +00:00
Eli Friedman 7919beaaf2 Fix a bug with va_arg and vectors on Darwin x86-32. <rdar://problem/11592208>.
llvm-svn: 158017
2012-06-05 19:40:46 +00:00
Craig Topper 2b1eda344a Add fma3 intrinsic header file.
llvm-svn: 157913
2012-06-04 03:42:47 +00:00
Benjamin Kramer 4efdcced7a Upgrade test for the fma4->fma intrinsic change.
llvm-svn: 157900
2012-06-03 10:12:04 +00:00
Craig Topper 3f122a7636 Add builtin for pclmulqdq instruction.
llvm-svn: 157733
2012-05-31 05:18:48 +00:00
Benjamin Kramer ba6e2528fa Add an ammintrin.h header for SSE4a intrinsics.
This is a clean-room implementation based on public documentation and
I tried to validate it as much as possible against gcc.

llvm-svn: 157638
2012-05-29 19:10:17 +00:00
Nuno Lopes 147dcd8c33 add CodeGen support for the alloc_size attribute
llvm-svn: 157483
2012-05-25 17:04:42 +00:00
Justin Holewinski c05323dd5c Un-XFAIL CodeGen/builtins-nvptx.c now that the proper changes have
landed in LLVM core

llvm-svn: 157418
2012-05-24 21:39:33 +00:00
John McCall d65dbd8e6a XFAIL this test, which does not pass on trunk since the grand
renaming in r157403.

llvm-svn: 157413
2012-05-24 20:58:21 +00:00
Justin Holewinski 83e9668133 Replace PTX back-end with NVPTX back-end in all places where Clang cares
NV_CONTRIB

llvm-svn: 157403
2012-05-24 17:43:12 +00:00
Richard Smith 01ade177e9 If the first argument of __builtin_object_size can be folded to a constant
pointer, but such folding encounters side-effects, ignore the side-effects
rather than performing them at runtime: CodeGen generates wrong code for
__builtin_object_size in that case.

llvm-svn: 157310
2012-05-23 04:13:20 +00:00
Nuno Lopes a425589fea wire -fbounds-checking to the new LLVM bounds checking pass
llvm-svn: 157262
2012-05-22 17:19:45 +00:00
Nuno Lopes 2b1ff46ed1 revert the usage of the objectsize intrinsic with 3 parameters (to match LLVM r157255)
llvm-svn: 157256
2012-05-22 15:26:48 +00:00
Akira Hatanaka b08cb81f37 XFAIL this test on MIPS.
Since r156650, clang has stopped emitting byval arguments for MIPS targets.

llvm-svn: 156954
2012-05-16 22:06:47 +00:00
Rafael Espindola bac0fdbd0b We were already passing the case in pr9356. Add it to attributes.c to make
sure we don't regress. I will add a warning in a sec.

llvm-svn: 156726
2012-05-13 01:56:10 +00:00
Benjamin Kramer 29c2b4330c Add support for __attribute__((hot)) and __attribute__((cold)).
Currently cold functions are marked with the "optsize" attribute in CodeGen
so they are always optimized for size.  The hot attribute is just ignored,
LLVM doesn't have a way to express hotness at the moment.

llvm-svn: 156723
2012-05-12 21:10:52 +00:00
Akira Hatanaka 8ab86cb344 Coerce byval aggregate arguments to integers whose size matches the integer
register size of the target architecture.
 

llvm-svn: 156650
2012-05-11 21:56:58 +00:00
Akira Hatanaka c37eddf7a7 Fix handling of vector return types.
A vector should be returned via the hidden pointer argument except if its size
is equal to or smaller than 16-bytes and the target ABI is N32 or N64.

llvm-svn: 156642
2012-05-11 21:01:17 +00:00
Nuno Lopes 729e6a056c hopefully fix a bunch of ARM buildbot failures
llvm-svn: 156513
2012-05-09 21:21:49 +00:00
Nuno Lopes ddcce0bb90 update calls to objectsize intrinsic to match LLVM r156473
add a test for -fbounds-checking code generation

llvm-svn: 156474
2012-05-09 15:53:34 +00:00
Eric Christopher c0e7a3d78c The address of a vla is actually complex and requires a dereference.
Part of rdar://11352000

llvm-svn: 156407
2012-05-08 18:56:47 +00:00
Nuno Lopes 9f5616a005 hopefully unbreak some buildbots
llvm-svn: 156357
2012-05-08 01:54:53 +00:00
Nuno Lopes f4c7679f35 make this test a little more useful. I'll add more tests for bound checking once -fbounds-checking patch gets in
llvm-svn: 156321
2012-05-07 20:23:03 +00:00
Alexey Samsonov 74a3868dbb This patch adds a new Clang compiler flag "-gline-tables-only".
It reduces the amount of emitted debug information:
1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram,
DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only.
2) .debug_str contains only function names.
3) No debug data for types/namespaces/variables is emitted.
4) The data in .debug_line is enough to produce valid stack traces with
function names and line numbers.

Reviewed by Eric Christopher.

llvm-svn: 156160
2012-05-04 07:39:27 +00:00
John McCall 1db0a2fab2 During block layout, after padding up to the max field alignment,
the alignment might actually exceed the max field alignment;  don't
assert in this case.

llvm-svn: 155937
2012-05-01 20:28:00 +00:00
Chad Rosier 87622b8b84 Get rid of storelv4si builtin as it can be expressed directly. This is general
goodness because it provides opportunites to cleanup things.  For example,

uint64_t t1(__m128i vA)
{
  uint64_t Alo;
  _mm_storel_epi64((__m128i*)&Alo, vA);
  return Alo;
}

was generating 

	movq	%xmm0, -8(%rbp)
	movq	-8(%rbp), %rax

and now generates

	movd	%xmm0, %rax

rdar://11282581

llvm-svn: 155924
2012-05-01 18:11:51 +00:00
Julien Lerouge 4a5b444371 Currently __builtin_annotation() only annotates an i32.
i32 __builtin_annotation(i32, string);

Applying it to i64 (e.g., long long) generates the following IR.

        trunc i64 {{.*}} to i32
        call i32 @llvm.annotation.i32
        zext i32 {{.*}} to i64

The redundant truncation and extension make the result difficult to use.

This patch makes __builtin_annotation() generic.

        type __builtin_annotation(type, string);

For the i64 example, it simplifies the generated IR to:

        call i64 @llvm.annotation.i64

Patch by Xi Wang!

llvm-svn: 155764
2012-04-28 17:39:16 +00:00
John McCall ac0350a396 Fix a bug with block layout when the block contains something
more aligned than the block header but also contains something
smaller than the block-header alignment but not exactly half
the difference between the large alignment and the header
alignment.  Got that?

I'm really not sure what I was thinking with the buggy computation
here, but the fix is pretty obvious.

llvm-svn: 155662
2012-04-26 21:14:42 +00:00
Chad Rosier 155005c071 Add atan, atan2, exp, and log to the builtin math library functions.
With -fno-math-errno (the default for Darwin) or -ffast-math these library 
function can be marked readnone enabling more opportunities for CSE and other
optimizations.
rdar://11251464

llvm-svn: 155498
2012-04-24 22:40:01 +00:00
Kostya Serebryany 5dd2cfc81e enable TBAA when -fthread-sanitizer is given, even with -O0 or -relaxed-aliasing
llvm-svn: 155430
2012-04-24 06:57:01 +00:00
Eric Christopher 3cc207bbcc Forward declarations should take a context. This helps the debugger
find forward declarations in the context that the actual definition
will occur.

rdar://11291658

llvm-svn: 155381
2012-04-23 19:00:24 +00:00
Anton Korobeynikov df32b6f2de Do not use stdint.h, driver might provide invalid location for it. Instead, provide the types directly.
This should fix PR12628

llvm-svn: 155342
2012-04-23 09:02:13 +00:00
Craig Topper 26e74e50b6 Convert vperm2f128 and vperm2i128 intrinsics back to using llvm intrinsics. Unfortunately, these instructions have behavior that can't be modeled with shuffle vector.
llvm-svn: 154906
2012-04-17 05:16:56 +00:00
Eli Friedman 114341db6d Attempt to fix test.
llvm-svn: 154897
2012-04-17 01:57:28 +00:00
Chad Rosier a750d46c9f Make sure EmitMoveFromReturnSlot is passing the correct alignment to
EmitFinalDestCopy (and thus pass EmitAggregateCopy the correct alignment).
rdar://11220251

llvm-svn: 154883
2012-04-17 00:35:38 +00:00
Duncan Sands 54c05faade Remove support for -fast-math metadata for the moment.
llvm-svn: 154851
2012-04-16 19:40:49 +00:00
Duncan Sands 8030b810de Generate fpmath metadata when -ffast-math. Note that no optimizations are hooked
up to this yet.

llvm-svn: 154835
2012-04-16 17:24:31 +00:00
Eli Friedman 7f1ff60021 Propagate alignment on lvalues through EmitLValueForField. PR12395.
llvm-svn: 154789
2012-04-16 03:54:45 +00:00
Craig Topper 8e57855ea0 Change _mm256_permute4x64_epi64 and _mm256_permute4x64_pd to use builtin_shufflevector instead of specific builtins. Old builtins will be removed from llvm now that vpermq/vpermpd are supported by shuffle lowering code.
llvm-svn: 154777
2012-04-15 22:18:10 +00:00
Duncan Sands c720e78ebc Use MDBuilder to help with metadata creation.
llvm-svn: 154767
2012-04-15 18:04:54 +00:00
Anton Korobeynikov 20735d2df8 First set of tests for ARM homogenous aggregates. C only. C++ will follow.
llvm-svn: 154666
2012-04-13 11:23:39 +00:00
Richard Smith d65cee9423 Implement __atomic_fetch_nand and __atomic_nand_fetch to complete our set of
GNU __atomic builtins.

llvm-svn: 154659
2012-04-13 06:31:38 +00:00
Richard Smith 01ba47d7b6 Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
predefined macros.

Implement library fallback for __atomic_is_lock_free and
__c11_atomic_is_lock_free, and implement __atomic_always_lock_free.

Contrary to their documentation, GCC's __atomic_fetch_add family don't
multiply the operand by sizeof(T) when operating on a pointer type.
libstdc++ relies on this quirk. Remove this handling for all but the
__c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.

Contrary to their documentation, __atomic_test_and_set and __atomic_clear
take a first argument of type 'volatile void *', not 'void *' or 'bool *',
and __atomic_is_lock_free and __atomic_always_lock_free have an argument
of type 'const volatile void *', not 'void *'.

With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
except for a couple of libstdc++ bugs and some cases where libc++'s test
suite tests for properties which implementations have latitude to vary.

llvm-svn: 154640
2012-04-13 00:45:38 +00:00
Richard Smith feea883de4 Implement support for 18 of the GNU-compatible __atomic builtins.
This is not quite sufficient for libstdc++'s <atomic>: we still need
__atomic_test_and_set and __atomic_clear, and may need a more complete
__atomic_is_lock_free implementation.

We are also missing an implementation of __atomic_always_lock_free,
__atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed
for libstdc++.

llvm-svn: 154579
2012-04-12 05:08:17 +00:00
Richard Smith b1e36c662b Provide, and document, a set of __c11_atomic_* intrinsics to implement C11's
<stdatomic.h> header.

In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.

llvm-svn: 154513
2012-04-11 17:55:32 +00:00
Richard Smith aa22a8cdcf AtomicExpr: make ASTStmtReader a friend and remove setters. Also fix saving
of an uninitialized Stmt* in serialization of __atomic_init and add a test of
atomics serialization.

llvm-svn: 154448
2012-04-10 22:49:28 +00:00