Commit Graph

2898 Commits

Author SHA1 Message Date
Rafael Espindola d94d25301c Make this test stricter. NFC.
llvm-svn: 228112
2015-02-04 04:23:48 +00:00
David Majnemer e1a0b2e2af MS ABI: Records with fields with required aligmnet shouldn't be common
llvm-svn: 227954
2015-02-03 08:49:32 +00:00
David Majnemer 7d82131abe MS ABI: Records with required alignment can't have common linkage
This fixes PR22441.

llvm-svn: 227950
2015-02-03 07:35:55 +00:00
Craig Topper 53565c60e7 [X86] Add other flavors of AVX512 cmpps/cmppd intrinsics.
llvm-svn: 227773
2015-02-01 22:27:40 +00:00
Craig Topper 2a898bfc67 [X86] Add the AVX512 exp2a23 intrinsics.
llvm-svn: 227769
2015-02-01 21:34:11 +00:00
Craig Topper a5df398006 [X86] Add test for avx512er builtins that I forgot to commit with changes to the header file.
llvm-svn: 227762
2015-02-01 19:56:51 +00:00
Craig Topper 67826a5883 [X86] Rename _mm512_valign_epi64/32 intrinsics to _mm512_alignr_epi64/32 to match Intel docs. Make immediate argument to them an ICE. Fix mask size for the alignd version.
llvm-svn: 227713
2015-02-01 07:35:40 +00:00
Craig Topper 1601525f1c [X86] Add range checking to the immediate arguments of many of the SSE/AVX builtins.
llvm-svn: 227674
2015-01-31 06:31:23 +00:00
David Blaikie 303facbeb8 DebugInfo: Fix line table for comparisons harder/better for the sake of C (& the GDB buildbot)
llvm-svn: 227663
2015-01-31 01:10:11 +00:00
David Blaikie 9fd4d08515 Rename test file to be more accurate (& free up the file name for a more appropriate test)
llvm-svn: 227662
2015-01-31 01:10:09 +00:00
Saleem Abdulrasool 71d1dd1e0c CodeGen: create a WindowsARMTargetCodeGenInfo
Create a new TargetCodeGenInfo for Windows on ARM to permit annotating the
functions with stack-probe-size (for /Gs and -mstack-probe-support) for
generating the stack probe necessary for Windows targets.  This will be used by
the backend when lowering the frame to generate the stack probe appropriately.

llvm-svn: 227641
2015-01-30 23:29:19 +00:00
Reid Kleckner 3a417c301b SEH: Don't jump to an unreachable continuation block
If both the __try and __except blocks do not return, we want to delete
the continuation block as unreachable instead.

llvm-svn: 227627
2015-01-30 22:16:45 +00:00
David Majnemer 310e3a8f60 MS ABI: Implement proper support for setjmp
On targets which use the MSVCRT, setjmp is a macro which expands to
_setjmp or _setjmpex.

_setjmp and _setjmpex have a secret, hidden argument which is not listed
in the function prototype on X64 and WoA.  This hidden argument always
seems to be the frame pointer.

_setjmpex isn't used on X86, _setjmp is magically replaced with a call
to _setjmp3.  The second argument is zero for 'normal' setjmp/longjmp
pairs, otherwise it is a count of additional variadic arguments.  This
is used when setjmp appears inside of a try or __try.

It is not safe to use a pointer to setjmp because _setjmp, _setjmpex and
_setmp3 are not compatible with setjmp.

llvm-svn: 227426
2015-01-29 09:29:21 +00:00
Derek Schuff 3970a7ec9b Remove support for pnaclcall attribute
Summary:
It was used for interoperability with PNaCl's calling conventions, but
it's no longer needed.

Also Remove NaCl*ABIInfo which just existed to delegate to either the portable
or native ABIInfo, and remove checkCallingConvention which was now a no-op
override.

Reviewers: jvoung

Subscribers: jfb, llvm-commits

Differential Revision: http://reviews.llvm.org/D7206

llvm-svn: 227362
2015-01-28 20:24:52 +00:00
Alex Rosenberg 286f124da5 Enable pragma comment processing for PS4. Original patch by Yunzhong Gao!
llvm-svn: 227336
2015-01-28 18:26:15 +00:00
Tom Stellard d99fb956a3 R600: Use a Southern Islands GPU as the default for the amdgcn target
llvm-svn: 227315
2015-01-28 15:38:44 +00:00
Craig Topper 335e218760 [X86] Add intrinsics for AVX512 128 and 256 bit integer comparison of word and byte vectors.
llvm-svn: 227186
2015-01-27 09:16:29 +00:00
Pete Cooper f051cbf631 Don't generate llvm.expect intrinsics with -O0.
The backend won't run LowerExpect on -O0.  In a debug LTO build, this results in llvm.expect intrinsics being in the LTO IR which doesn't know how to optimize them.

Thanks to Chandler for the suggestion and review.

Differential revision: http://reviews.llvm.org/D7183

llvm-svn: 227135
2015-01-26 20:51:58 +00:00
Craig Topper b4789096c0 [X86] Add AVX512 integer comparison intrinsics for word and byte vectors.
llvm-svn: 227079
2015-01-26 09:24:10 +00:00
Craig Topper 2f25a5a875 [X86] Add more of the AVX512 integer comparision intrinsics. This adds 128 and 256 bit vectors of dwords and qwords.
llvm-svn: 227075
2015-01-26 08:11:49 +00:00
Craig Topper 4cac1c2318 [X86] Add AVX512F integer comparision intrinsics to header file.
llvm-svn: 227067
2015-01-25 23:30:07 +00:00
Justin Bogner 9fa8c9984c test: Convert some tests to FileCheck
These were all doing trivial greps. It's better to use FileCheck.

llvm-svn: 227007
2015-01-24 17:39:36 +00:00
Justin Bogner 2af264a44a test: Remove two redundant lines from this test
The FileCheck already checks for these lines, no need to grep as well.

llvm-svn: 227006
2015-01-24 17:39:32 +00:00
Sanjay Patel 76c9e0986c Process the -fno-signed-zeros optimization flag (PR20870)
The driver currently accepts but ignores the -fno-signed-zeros flag. 
This patch passes the flag through and enables 'nsz' fast-math-flag 
generation in IR.

The existing OpenCL flag for the same functionality is made into an
alias here. It may be removed in a subsequent patch.

This should resolve bug 20870 ( http://llvm.org/bugs/show_bug.cgi?id=20870 );
patches for the optimizer were checked in at:
http://llvm.org/viewvc/llvm-project?view=revision&revision=225050
http://llvm.org/viewvc/llvm-project?view=revision&revision=224583

Differential Revision: http://reviews.llvm.org/D6873

llvm-svn: 226915
2015-01-23 16:40:50 +00:00
Reid Kleckner 2a2e156318 SEH: Emit the constant filter 1 as a catch-all
Minor optimization of code like __try { ... } __except(1) { ... }.

llvm-svn: 226766
2015-01-22 02:25:56 +00:00
Reid Kleckner 1d59f99f5c Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.

Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
  outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
  implemented.
- __finally blocks will not run after exceptions. Fixing this requires
  work in the LLVM SEH preparation pass.

The IR lowering looks like this:

// C code:
bool safe_div(int n, int d, int *r) {
  __try {
    *r = normal_div(n, d);
  } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
    return false;
  }
  return true;
}

; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
  %ehptrs = bitcast i8* %e to i32**
  %ehrec = load i32** %ehptrs
  %code = load i32* %ehrec
  %matches = icmp eq i32 %code, i32 u0xC0000094
  %matches.i32 = zext i1 %matches to i32
  ret i32 %matches.i32
}

define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
  %rr = invoke i32 @normal_div(i32 %n, i32 %d)
      to label %normal unwind to label %lpad

normal:
  store i32 %rr, i32* %r
  ret i1 1

lpad:
  %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
      catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
  %ehptr = extractvalue {i8*, i32} %ehvals, i32 0
  %sel = extractvalue {i8*, i32} %ehvals, i32 1
  %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
  %matches = icmp eq i32 %sel, %filter_sel
  br i1 %matches, label %eh.except, label %eh.resume

eh.except:
  ret i1 false

eh.resume:
  resume
}

Reviewers: rjmccall, rsmith, majnemer

Differential Revision: http://reviews.llvm.org/D5607

llvm-svn: 226760
2015-01-22 01:36:17 +00:00
Rafael Espindola e855c2ae0a Revert "Try to fix -Asserts build bots."
This reverts commit r226758.

Looks like rnk's 226757 fixed the real issue.
Sorry for the noise.

llvm-svn: 226759
2015-01-22 01:33:41 +00:00
Rafael Espindola b88c11281c Try to fix -Asserts build bots.
llvm-svn: 226758
2015-01-22 01:26:39 +00:00
Reid Kleckner 395dad8213 Give the block inlining test a triple to determinise output
It fails on Windows due to another temporary being emitted first, so the
LLVM internal renaming scheme gives out the name
__block_descriptor_tmp1.

llvm-svn: 226757
2015-01-22 01:19:19 +00:00
Rafael Espindola e5df59ff78 Emit DeferredDeclsToEmit in a DFS order.
Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that.

The advantages of the change are that

* The output order is a bit closer to the source order. The change to
test/CodeGenCXX/pod-member-memcpys.cpp is a good example.

* If we decide to deffer more, it will not cause as large changes in the
estcases as it would without this patch.

llvm-svn: 226751
2015-01-22 00:24:57 +00:00
Adam Nemet f893edeaea [AVX512] Add sub-vector FP extracts
Analogous to AVX2, these need to be implemented as macros to properly
propagate the immediate index operand.

Part of <rdar://problem/17688758>

llvm-svn: 226496
2015-01-19 20:12:05 +00:00
Adrian Prantl 7c6f944cdf Migrate all uses of DIVariable's FlagIndirectVariable to use a DIExpression
with a DW_OP_deref instead.

llvm-svn: 226474
2015-01-19 17:51:58 +00:00
Craig Topper f557b09f14 [x86] Mark that the AVX-512 cmpps/cmppd builtins need an ICE for the comparison immediate. This requires converting to a macro in the header file.
llvm-svn: 226421
2015-01-19 01:18:19 +00:00
Eric Christopher 49b425d9d2 Remove pathname dependence. Also rewrite test to use FileCheck
at the same time.

Patch by David Callahan.

llvm-svn: 226331
2015-01-16 22:03:52 +00:00
Rafael Espindola d9b26d563a Add comdat to string literal variables on COFF.
llvm-svn: 226317
2015-01-16 20:32:35 +00:00
Adam Nemet c0cff244fc [AVX512] Add intrinsics for masked aligned FP loads and stores
Part of <rdar://problem/17688758>

llvm-svn: 226298
2015-01-16 18:51:50 +00:00
Adam Nemet d47dec4690 Fix typo in r225922.
llvm-svn: 226297
2015-01-16 18:51:46 +00:00
Duncan P. N. Exon Smith 8d3ef611ce IR: Move MDLocation into place (clang testcases)
Update testcases to match LLVM change in r226048.

llvm-svn: 226049
2015-01-14 22:28:03 +00:00
Daniel Sanders 998c910262 [mips] Handle transparent unions correctly.
Summary:
This fixes MultiSource/Applications/lemon on big-endian N32 by correcting the
handling of the argument to wait(). glibc defines it as a transparent union of
void* and int*. Such unions are passed according to the rules of the first
member so the argument must be passed as if it were a void* (sign extended from
i32 to i64) and not as a union (shifted to the upper bits of an i64).

wait() already behaves correctly on big-endian O32 and N64 since the union is
already the same size as an argument slot.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6963

llvm-svn: 225981
2015-01-14 12:00:12 +00:00
Adam Nemet 63a951eb1c [AVX512] Add FP unpack intrinsics
These are implemented with __builtin_shufflevector just like AVX.

We have some tests on the LLVM side to assert that these shufflevectors do
indeed generate the corresponding unpck instruction.

Part of <rdar://problem/17688758>

llvm-svn: 225922
2015-01-14 01:31:17 +00:00
Daniel Sanders cdcb580d4e [mips] Fix va_arg() for pointer types on big-endian N32.
Summary:
The Mips ABI's treat pointers in the same way as integers. They are
sign-extended to 32-bit for O32, and 64-bit for N32/N64. This doesn't matter
for O32 and N64 where pointers are already the correct width but it does matter
for big-endian N32, where pointers are 32-bit and need promoting.

The caller side is already passing pointers correctly. This patch corrects the
callee.

Reviewers: vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6812

llvm-svn: 225782
2015-01-13 10:47:00 +00:00
Alexey Samsonov 8845952b54 Reimplement -fsanitize-recover family of flags.
Introduce the following -fsanitize-recover flags:
  - -fsanitize-recover=<list>: Enable recovery for selected checks or
      group of checks. It is forbidden to explicitly list unrecoverable
      sanitizers here (that is, "address", "unreachable", "return").
  - -fno-sanitize-recover=<list>: Disable recovery for selected checks or
     group of checks.
  - -f(no-)?sanitize-recover is now a synonym for
    -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated.

These flags are parsed left to right, and mask of "recoverable"
sanitizer is updated accordingly, much like what we do for -fsanitize= flags.
-fsanitize= and -fsanitize-recover= flag families are independent.

CodeGen change: If there is a single UBSan handler function, responsible
for implementing multiple checks, which have different recoverable setting,
then we emit two handler calls instead of one:
the first one for the set of "unrecoverable" checks, another one - for
set of "recoverable" checks. If all checks implemented by a handler have the
same recoverability setting, then the generated code will be the same.

llvm-svn: 225719
2015-01-12 22:39:12 +00:00
Rafael Espindola 0d4fb98504 [patch][pr19848] Produce explicit comdats in clang.
The llvm IR until recently had no support for comdats. This was a problem when
targeting C++ on ELF/COFF as just using weak linkage would cause quite a bit of
dead bits to remain on the executable (unless -ffunction-sections,
-fdata-sections and --gc-sections were used).

To fix the problem, llvm's codegen will just assume that any weak or linkonce
that is not in an explicit comdat should be output in one with the same name as
the global.

This unfortunately breaks cases like pr19848 where a weak symbol is not
xpected to be part of any comdat.

Now that we have explicit comdats in the IR, we can finally get both cases
right.

This first patch just makes clang give explicit comdats to GlobalValues where
t is allowed to.

A followup patch to llvm will then stop implicitly producing comdats.

llvm-svn: 225705
2015-01-12 22:13:53 +00:00
David Majnemer f1fdf4a80c CodeGen: Simplify consecutive '%' modifiers
LLVM the consecutive '%' modifiers are redundant, skip them.

llvm-svn: 225602
2015-01-11 09:13:56 +00:00
David Majnemer 14d4e7bdbf CodeGen: Simplify consecutive '&' modifiers
LLVM the consecutive '&' modifiers are redundant, skip them.

llvm-svn: 225601
2015-01-11 09:09:01 +00:00
Duncan P. N. Exon Smith 4bbe428cc5 IR: Add 'distinct' MDNodes to bitcode and assembly (clang)
Update testcases for LLVM change in r225474 to make `MDNode`s explicitly
distinct (when they aren't uniqued).

Part of PR22111.

llvm-svn: 225475
2015-01-08 22:39:28 +00:00
Tom Stellard d8e38a3206 R600: Handle amdgcn triple
For now there is no difference between amdgcn and r600.

llvm-svn: 225294
2015-01-06 20:34:47 +00:00
David Blaikie b9a23c9155 DebugInfo: Provide a less subtle way to set the debug location of simple ret instructions
un-XFAILing the test XFAIL'd in r225086 after it regressed in r225083.

llvm-svn: 225090
2015-01-02 22:07:26 +00:00
David Blaikie 5e9e13f54a Temporarily XFAIL fallout from r225083 while investigating.
Between this behavior and that fixed by r225083/r225000, I'll take the
latter over the former for now, but I'm immediately working on
understanding/addressing this behavior too.

(the fact that the code change in r225083 caused this change in behavior
is a bit troubling anyway - given that it looks & claims to be just a
preformance thing)

llvm-svn: 225086
2015-01-02 19:49:28 +00:00
Craig Topper 2094d8fe88 [x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse intrinsic files.
This still lower to the same intrinsics as before.

This is preparation for bounds checking the immediate on the avx version of the builtin so we don't pass illegal immediates into the backend. Since SSE uses a smaller size immediate its not possible to bounds check when using a shared builtin. Rather than creating a clang specific builtin for the different immediate, I decided (after consulting with Chandler) that it was better to match gcc.

llvm-svn: 224879
2014-12-27 06:59:57 +00:00
David Majnemer fd4f63ad4b Adjust the rest of the tests due to r224849.
llvm-svn: 224865
2014-12-26 18:45:57 +00:00
David Majnemer ca7e485c3f Update tests due to r224849
Inferring nuw caused some clang tests to change their output.

llvm-svn: 224851
2014-12-26 10:29:40 +00:00
Nico Weber 4f477fbe57 Add a triple to try and get this test passing on the ARM bots.
llvm-svn: 224747
2014-12-23 01:07:10 +00:00
Nico Weber 08ef80f4b8 Rename test.cc files to test.cpp.
The lit.cfg files only add .cpp to suffixes, so these tests used to never run,
oops.  (Also tweak to of these tests in minor ways to make the actually pass.)

llvm-svn: 224718
2014-12-22 18:13:07 +00:00
Alexey Bataev 7cb1789011 Fix for PR21915: assert on multidimensional VLA in function arguments.
Fixed assertion on type checking for arguments and parameters on function call if arguments are pointers to VLA
Differential Revision: http://reviews.llvm.org/D6655

llvm-svn: 224504
2014-12-18 06:54:53 +00:00
Eric Christopher 560cc4fb44 Make sure that arm-linux-gnu is still the apcs-gnu ABI when we
use clang -cc1 matching the front end and backend. Fix up a couple
of tests that were testing aapcs for arm-linux-gnu.

The test that removes the aapcs abi calling convention removes
them because the default triple matches what the backend uses
for the calling convention there and so it doesn't need to be
explicitly stated - see the code in TargetInfo.cpp.

llvm-svn: 224491
2014-12-18 02:08:55 +00:00
Saleem Abdulrasool 86b881c63e CodeGen: implement __emit intrinsic
For MSVC compatibility, add the `__emit' builtin. This is used in the Windows
SDK headers, and must therefore be implemented as a builtin rather than an
intrinsic.

The `__emit' builtin provides a mechanism to emit a 16-bit opcode instruction
into the stream. The value must be a compile time constant expression. No
guarantees are made about the CPU and memory states after the execution of the
instruction.

Due to the unchecked nature of the builtin, only support this on Windows on ARM.

llvm-svn: 224438
2014-12-17 17:52:30 +00:00
Toma Tabacu 9941195a9f [mips] Always clobber $1 for MIPS inline asm.
Summary:
Because GCC doesn't use $1 for code generation, inline assembly code can use $1 without having to add it to the clobbers list.

LLVM, on the other hand, does not shy away from using $1, and this can cause conflicts with inline assembly which assumes GCC-like code generation.

A solution to this problem is to make Clang automatically clobber $1 for all MIPS inline assembly.
This is not the optimal solution, but it seems like a necessary compromise, for now.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6638

llvm-svn: 224428
2014-12-17 12:02:58 +00:00
Adrian Prantl 98f1f27810 Update this testcase for the new metadata assembler syntax.
llvm-svn: 224262
2014-12-15 19:25:33 +00:00
Duncan P. N. Exon Smith b3a66691f8 IR: Make metadata typeless in assembly, clang side
Match LLVM changes from r224257.

llvm-svn: 224259
2014-12-15 19:10:08 +00:00
Alexey Bataev a47ae907e8 Fixed test/CodeGen/atomic_ops.c for compatibility with hexagon target
llvm-svn: 224231
2014-12-15 06:12:42 +00:00
Alexey Bataev 452d8e1133 Bugfix for Codegen of atomic load/store/other ops.
Currently clang fires assertions on x86-64 on any atomic operations for long double operands. Patch fixes codegen for such operations.
Differential Revision: http://reviews.llvm.org/D6499

llvm-svn: 224230
2014-12-15 05:25:25 +00:00
David Majnemer ee8d04d8dd CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatile
Don't inherit the volatile-ness of the input pointer to the volatile
operation for memory allocated on the side.

This fixes PR17306.

llvm-svn: 224110
2014-12-12 08:16:09 +00:00
Paul Robinson 0855695159 Instead of having -Os/-Oz add OptimizeForSize/MinSize first, and later
having OptimizeNone remove them again, just don't add them in the
first place if the function already has OptimizeNone.

Note that MinSize can still appear due to attributes on different
declarations; a future patch will address that.

llvm-svn: 224047
2014-12-11 20:14:04 +00:00
Paul Robinson aae2fba540 Diagnose attributes 'optnone' and 'minsize' on the same declaration.
Eventually we'll diagnose them on different declarations, but let's
get this part out of the way first.

llvm-svn: 223985
2014-12-10 23:34:36 +00:00
Paul Robinson 621b6d3bf7 Revert r223980 as it had wrong commit message.
llvm-svn: 223984
2014-12-10 23:32:57 +00:00
Paul Robinson 2936851426 Rename a couple of preprocessor symbols to be more descriptive. NFC.
Review feedback from recent changes to GetSVN.cmake.

llvm-svn: 223980
2014-12-10 23:12:37 +00:00
Kostya Serebryany 597dcc7a8d No memcpy for copy ctor with -fsanitize-address-field-padding=1
Summary:
When -fsanitize-address-field-padding=1 is present
don't emit memcpy for copy constructor.
Thanks Nico for the extra test case.

Test Plan: regression tests

Reviewers: thakis, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

Differential Revision: http://reviews.llvm.org/D6515

llvm-svn: 223563
2014-12-06 01:23:08 +00:00
Eric Christopher 0e2618857c Have the driver and the target code agree on what the default ABI
is for each machine. Fix up darwin tests that were testing for
aapcs on armv7-ios when the actual ABI is apcs.

Should be no user visible change without -cc1.

llvm-svn: 223429
2014-12-05 01:06:59 +00:00
Reid Kleckner 2c8d86ca05 Add test for __umulh
llvm-svn: 223319
2014-12-03 23:52:26 +00:00
Anton Korobeynikov d90dd7977e Fix invalid calling convention used for libcalls on ARM.
ARM ABI specifies that all the libcalls use soft FP ABI 
(even hard FP binaries). These days clang emits _mulsc3 / _muldc3
calls with default (C) calling convention which would be translated
into AAPCS_VFP LLVM calling and thus the result of complex
multiplication will be bogus.

Introduce a way for a target to specify explicitly calling
convention for libcalls. Right now this is temporary correctness
fix. Ultimately, we'll end with intrinsic for complex 
multiplication and all calling convention decisions for libcalls
will be put into backend.

llvm-svn: 223123
2014-12-02 16:04:58 +00:00
Justin Holewinski 6e9bfa344c [NVPTX] Fix type error for some builtins in BuiltinsNVPTX.def
llvm-svn: 223116
2014-12-02 12:58:24 +00:00
Tim Northover b047bfae32 AArch64: simplify PCS mapping.
Now that LLVM can count the registers needed to implement AAPCS rules, we don't
need to duplicate that logic here. This means we can drop the explicit padding
and also use more natural types in many cases (e.g. "struct { float arr[3]; }"
used to end up as "[2 x double]" to avoid holes on the stack.

The one wrinkle is that AAPCS va_arg was also using the register counting
machinery. But the local replacement isn't too bad.

llvm-svn: 222904
2014-11-27 21:02:49 +00:00
David Majnemer 659be55daa CodeGen: Fix emission of __atomic_compare_exchange
We (wrongly) discarded the return value of the call.

llvm-svn: 222798
2014-11-25 23:44:32 +00:00
Chandler Carruth cc75b75b9d Update Clang tests that run the LLVM optimizer to reflect the changed
canonicalization in r222748. No interesting functionality changed here.

llvm-svn: 222749
2014-11-25 10:10:37 +00:00
Tim Northover bdcc1ed66d testing: make test use FileCheck
The "grep internal | count" was fragile when your source or remote paths could
contain the word "internal".

llvm-svn: 222685
2014-11-24 21:03:34 +00:00
Paul Robinson 4ece682586 Correctly remove OptimizeForSize from functions marked OptimizeNone.
This allows using __attribute__((optnone)) and the -Os/-Oz options.
Fixes PR21604.

llvm-svn: 222683
2014-11-24 20:51:42 +00:00
Saleem Abdulrasool aca550fdb5 CodeGen: make i686-windows-itanium more similar to msvc
The itanium environment follows the system calling convention for structures.
Pass small aggregates via registers.

llvm-svn: 222680
2014-11-24 20:14:29 +00:00
Saleem Abdulrasool ec5c624550 CodeGen: tweak struct ABI handling
Cygwin and MinGW fail to conform to the underlying system's structure passing
ABI.  Make the check more precise to ensure that we correctly generate code for
the itanium environment.

llvm-svn: 222626
2014-11-23 02:16:24 +00:00
David Majnemer d8cd8f7b6e CodeGen: Make atomic operations play nice with address spaces
We were being a little sloppy with our pointer/address space casts.

This fixes PR21643.

llvm-svn: 222615
2014-11-22 10:44:12 +00:00
Alexey Samsonov cfb97aa620 Remove support for undocumented SpecialCaseList entries.
"global-init", "global-init-src" and "global-init-type" were originally
used to blacklist entities in ASan init-order checker. However, they
were never documented, and later were replaced by "=init" category.

Old blacklist entries should be converted as follows:
  * global-init:foo -> global:foo=init
  * global-init-src:bar -> src:bar=init
  * global-init-type:baz -> type:baz=init

llvm-svn: 222401
2014-11-20 01:27:19 +00:00
Chad Rosier 36577d037f Revert "[Reassociate] Update test cases due to r222142."
This reverts commit r222144.  Commit r222142 is being reverted due to
a spec2006/gcc execution-time regression.

Update mips-varargs test as well.

llvm-svn: 222397
2014-11-19 23:20:35 +00:00
Daniel Sanders 59229dcb29 Allow EmitVAArg() to promote types and use this to fix some N32/N64 vararg issues for Mips.
Summary:
With this patch, passing a va_list to another function and reading 10 int's from
it works correctly on a big-endian target.

Based on a pair of patches by David Chisnall, one of which I've reworked
for the current trunk.

Reviewers: theraven, atanasyan

Reviewed By: theraven, atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6248

llvm-svn: 222339
2014-11-19 10:01:35 +00:00
Eric Christopher 8be702dbaa This test also requires an aarch64 target.
llvm-svn: 222268
2014-11-18 22:36:11 +00:00
Justin Hibbits 90ca05e5e5 Add PIC-level support to Clang.
Summary:
This distinguishes between -fpic and -fPIC now, with the additions in LLVM for
PIC level support.

Test Plan: No regressions

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rnk, emaste, llvm-commits

Differential Revision: http://reviews.llvm.org/D5400

llvm-svn: 222227
2014-11-18 06:17:20 +00:00
Chad Rosier 0837f63fd2 [Reassociate] Update test cases due to r222142.
llvm-svn: 222144
2014-11-17 16:34:47 +00:00
Reid Kleckner b1be683074 Fix IRGen for passing transparent unions
We have had a test for this for a long time with a FIXME saying what we
should be doing. This just does it.

Fixes PR21573.

llvm-svn: 222074
2014-11-15 01:41:41 +00:00
Fariborz Jahanian 68e7938361 This patch fixes couple of bugs for predefined expression
used inside blocks. It fixes a crash in naming code
for __func__ etc. when used in a block declared globally.
It also brings back old naming convention for
predefined expression which was broken. rdar://18961148

llvm-svn: 222065
2014-11-14 23:55:27 +00:00
Anton Korobeynikov 5f951ee8bd Recommit r222044 with a test fix - it does not make sense to hunt
for a typedef before arithmetic conversion in all rare corner cases.

llvm-svn: 222049
2014-11-14 22:09:15 +00:00
Anton Korobeynikov 50fc68f2d9 Again revert r222044 to resolve darwin objc test fails.
llvm-svn: 222047
2014-11-14 21:54:46 +00:00
Anton Korobeynikov dc12b367bc Follow-up to D6217
Summary:
Ok, here is somewhat addition to D6217 aiming to preserve old darwin behavior wrt the typedefed types. The actual change to SemaChecking turned out to be pretty gross, in particular:
  1. We need to extract the typedef'ed type for proper diagnostics
  2. We need to walk over paren expressions as well

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6256

llvm-svn: 222044
2014-11-14 21:41:07 +00:00
Bill Schmidt 8ff672d397 [PowerPC] Enable vec_perm for long long and double vector types for VSX
VSX makes the "vector long long" and "vector double" types available.
This patch enables the vec_perm interface for these types.  The same
builtin is generated regardless of the specified type, so no
additional work or testing is needed in the back end.  Tests are added
to ensure this builtin is generated by the front end.

llvm-svn: 221988
2014-11-14 13:10:13 +00:00
Bill Schmidt cee13a2712 [PowerPC] Add VSX builtins for vec_div
This patch adds builtin support for xvdivdp and xvdivsp, along with a
new test case.  The builtins are accessed using vec_div in altivec.h.
Builtins are listed (mostly) alphabetically there, so inserting these
changed the line numbers for deprecation warnings tested in
test/Headers/altivec-intrin.c.

There is a companion patch for LLVM.

llvm-svn: 221984
2014-11-14 12:10:51 +00:00
Anton Korobeynikov 50a3cbd7c0 Temporary revert r221818 until all the problems
with objc stuff will be resolved.

llvm-svn: 221829
2014-11-12 23:15:38 +00:00
Anton Korobeynikov 0140aa8756 Fix fallout from r219557
Summary:
Consider the following nifty 1 liner: (0 ? csqrtl(2.0f) : sqrtl(2.0f)). One can easily obtain such code from e.g. tgmath. Right now it produces an assertion because we fail to do the promotion real => _Complex real.

The case was properly handled previously (old handleOtherComplexFloatConversion routine), but was forgotten in the current version. This seems to be about fallout from r219557

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6217

llvm-svn: 221821
2014-11-12 22:19:06 +00:00
Bill Schmidt 9ec8cea02b [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New code in altivec.h defines these in terms of new builtins, which
are themselves defined in BuiltinsPPC.def.  The builtins are converted
to LLVM intrinsics in CGBuiltin.cpp.  Additional code is added to
builtins-ppc-vsx.c to verify the correct generation of the intrinsics.

Note that I moved the other VSX builtins so all VSX builtins will be
alphabetical in their own section in BuiltinsPPC.def.

There is a companion patch for LLVM.

llvm-svn: 221768
2014-11-12 04:19:56 +00:00
Kostya Serebryany 4133eabb45 [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6160

llvm-svn: 221739
2014-11-11 23:38:13 +00:00
Alexey Samsonov e396bfc064 Bundle conditions checked by UBSan with sanitizer kinds they implement.
Summary:
This change makes CodeGenFunction::EmitCheck() take several
conditions that needs to be checked (all of them need to be true),
together with sanitizer kinds these checks are for. This would allow
to split one call into UBSan runtime into several calls in case
different sanitizer kinds would have different recoverability
settings.

Tests should be fixed accordingly, I'm working on it.

Test Plan: regression test suite.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6219

llvm-svn: 221716
2014-11-11 22:03:54 +00:00
Alexey Samsonov cfc9d3fe17 Simplify the test by using multiple --check-prefix arguments
llvm-svn: 221713
2014-11-11 21:50:44 +00:00
Tim Northover 5a1558ec31 ARM ABI: simplify decisions on whether args can be expanded.
Homogeneous aggregates on AAPCS_VFP ARM need to be passed *without* being
flattened (e.g. [2 x float] rather than "float, float") for various weird ABI
reasons. However, this isn't the case for anything else; further, we know at
the ABIArgInfo::getDirect callsites whether this flattening is allowed.

So, we can get more unified ARM code, with a simpler Clang, by just using that
knowledge directly.

llvm-svn: 221559
2014-11-07 22:30:50 +00:00