Commit Graph

2811 Commits

Author SHA1 Message Date
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