Commit Graph

45857 Commits

Author SHA1 Message Date
John McCall 18081afc1d Remove alignment from ctors/dtors lists in an attempt to placate LTO.
llvm-svn: 287458
2016-11-19 20:12:25 +00:00
Mehdi Amini 6f40836823 Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)
Summary:
This makes it explicit that ownership is taken. Also replace all `new`
with make_unique<> at call sites.

Reviewers: anemet

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D26884

llvm-svn: 287449
2016-11-19 18:19:41 +00:00
John McCall 6c9f1fdb5c Introduce a helper class for building complex constant initializers. NFC.
I've adopted this in most of the places it makes sense, but v-tables
and CGObjCMac will need a second pass.

llvm-svn: 287437
2016-11-19 08:17:24 +00:00
Ekaterina Romanova 0a70076121 Doxygen comments for avxintrin.h.
Added doxygen comments to avxintrin.h's intrinsics. As of now, all the intrinsics in this file that were documented by Sony's intrinsics guide should have corresponding doxygen comments.

Note: The doxygen comments are automatically generated based on Sony's intrinsic
s document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

Reviewed by Wolfgang Pieb.

llvm-svn: 287436
2016-11-19 04:59:08 +00:00
Peter Collingbourne 66bfcb3ea5 Sema: As of MSVC 2015, a user-declared move operation causes the deletion of both copy operations.
Differential Revision: https://reviews.llvm.org/D26868

llvm-svn: 287411
2016-11-19 00:30:56 +00:00
Akira Hatanaka f7d563c76c [Sema] Don't allow applying address-of operator to a call to a function
with __unknown_anytype return type.

When the following code is compiled, Sema infers that the type of
__unknown_anytype is double:

extern __unknown_anytype func();
double *d = (double*)&func();

This triggers an assert in CodeGenFunction::EmitCallExprLValue because
it doesn't expect to see a call to a function with a non-reference
scalar return type.

This commit prevents the assert by making VisitUnaryAddrOf error out if
the address-of operator is applied to a call to a function with
__unknown_anytype return type.

rdar://problem/20287610

Differential revision: https://reviews.llvm.org/D26808

llvm-svn: 287410
2016-11-19 00:13:03 +00:00
Konstantin Zhuravlyov 62ae8f671c [AMDGPU] Change frexp.exp builtin to return i16 for f16 input
Differential Revision: https://reviews.llvm.org/D26863

llvm-svn: 287390
2016-11-18 22:31:51 +00:00
Dominic Chen c8629bd35a [analyzer] Refactor recursive symbol reachability check to use symbol_iterator
Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26773

llvm-svn: 287380
2016-11-18 21:07:03 +00:00
Oleg Ranevskyy 85d93a8778 [ARM] Fix sema check of ARM special register names
Summary:
This is a simple sema check patch for arguments of `__builtin_arm_rsr` and the related builtins, which currently do not allow special registers with indexes >7.

Some of the possible register name formats these builtins accept are:
```
{c}p<coprocessor>:<op1>:c<CRn>:c<CRm>:<op2>
```
```
o0:op1:CRn:CRm:op2
```
where `op1` / `op2` are integers in the range [0, 7] and `CRn` / `CRm` are integers in the range [0, 15].

The current sema check does not allow `CRn` > 7 and accepts `op2` up to 15.

Reviewers: LukeCheeseman, rengolin

Subscribers: asl, aemerson, rengolin, cfe-commits

Differential Revision: https://reviews.llvm.org/D26464

llvm-svn: 287378
2016-11-18 21:00:08 +00:00
Matthias Braun ae032b6cf5 Adapt to llvm NamedRegionTimer changes
We have to specify a name and description for the timers and groups now.

llvm-svn: 287371
2016-11-18 19:43:25 +00:00
Adam Nemet e4b9fd9852 LTO support for -fsave-optimization-record on Darwin
I guess this would have to be added for each linker.

Differential Revision: https://reviews.llvm.org/D26833

llvm-svn: 287358
2016-11-18 18:17:36 +00:00
Adam Nemet 62ff7bab72 Fix a comment for -fsave-optimization-record
Differential Revision: https://reviews.llvm.org/D26807

llvm-svn: 287357
2016-11-18 18:17:33 +00:00
Joey Gouly 5788b783ac [OpenCL] Introduce ReadPipeType and WritePipeType.
This allows Sema to diagnose passing a read_only pipe to a
write_only pipe argument.

llvm-svn: 287343
2016-11-18 14:10:54 +00:00
Ekaterina Romanova 06b1914cb7 Add doxygen comments for lzcntintrin.h's intrinsics.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Charles Li.

llvm-svn: 287317
2016-11-18 06:26:01 +00:00
Craig Topper 37bf5c6a3f [AVX-512] Replace masked 16-bit element variable shift builtins with new unmasked versions and selects.
llvm-svn: 287313
2016-11-18 05:04:51 +00:00
Ekaterina Romanova 53088dd44d Add doxygen comments to fxsrintrin.h's intrinsics.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Paul Robinson and Charles Li.

llvm-svn: 287295
2016-11-18 01:42:01 +00:00
John McCall 811b291d8c Forward ns_consumed delegate arguments with a move.
StartFunction enters a release cleanup for ns_consumed arguments in
ARC, so we need to balance that somehow.  We could teach StartFunction
that it's emitting a delegating function, so that the cleanup is
unnecessary, but that would be invasive and somewhat fraught.  We could
balance the consumed argument with an extra retain, but clearing the
original variable should be easier to optimize and avoid some extra work
at -O0.  And there shouldn't be any difference as long as nothing else
uses the argument, which should always be true for the places we emit
delegate arguments.

Fixes PR 27887.

llvm-svn: 287291
2016-11-18 01:08:24 +00:00
Justin Lebar 50fe985349 [CUDA] Wrapper header changes necessary to support MacOS.
Reviewers: tra

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26780

llvm-svn: 287288
2016-11-18 00:41:35 +00:00
Justin Lebar d14fe8830e [CUDA] Use the right section and constant names for fatbins when compiling for macos.
Reviewers: tra

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26777

llvm-svn: 287287
2016-11-18 00:41:31 +00:00
Justin Lebar f91086b0a8 [CUDA] Initialize our header search using the host triple.
Summary:
This used to work because system headers are found in a (somewhat)
predictable set of locations on Linux.  But this is not the case on
MacOS; without this change, we don't look in the right places for our
headers when doing device-side compilation on Mac.

Reviewers: tra

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26776

llvm-svn: 287286
2016-11-18 00:41:27 +00:00
Justin Lebar 66c4fd7987 [CUDA] Driver changes to support CUDA compilation on MacOS.
Summary:
Compiling CUDA device code requires us to know the host toolchain,
because CUDA device-side compiles pull in e.g. host headers.

When we only supported Linux compilation, this worked because
CudaToolChain, which is responsible for device-side CUDA compilation,
inherited from the Linux toolchain.  But in order to support MacOS,
CudaToolChain needs to take a HostToolChain pointer.

Because a CUDA toolchain now requires a host TC, we no longer will
create a CUDA toolchain from Driver::getToolChain -- you have to go
through CreateOffloadingDeviceToolChains.  I am *pretty* sure this is
correct, and that previously any attempt to create a CUDA toolchain
through getToolChain() would eventually have resulted in us throwing
"error: unsupported use of NVPTX for host compilation".

In any case hacking getToolChain to create a CUDA+host toolchain would
be wrong, because a Driver can be reused for multiple compilations,
potentially with different host TCs, and getToolChain will cache the
result, causing us to potentially use a stale host TC.

So that's the main change in this patch.

In addition, we have to pull CudaInstallationDetector out of Generic_GCC
and into a top-level class.  It's now used by the Generic_GCC and MachO
toolchains.

Reviewers: tra

Subscribers: rryan, hfinkel, sfantao

Differential Revision: https://reviews.llvm.org/D26774

llvm-svn: 287285
2016-11-18 00:41:22 +00:00
Ekaterina Romanova 2174b6fe72 Minor changes in x86 intrinsics headers; NFC
I made several changes for consistency with the rest of x86 instrinsics header files. Some of these changes help to render doxygen comments better.

1. avxintrin.h –  Moved the opening bracket on a separate line for several 
                  intrinsics (for consistency with the rest of the intrinsics).

2. emmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added braces after extern "C"  even though there is only 
                  one declaration each time

3. xmmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added intrinsic prototypes for a couple of macro definitions
                  into the doxygen comment;
               -  Added braces after extern "C"  even though there is only one
                  declaration each time

4. ammintrin.h –  Removed extra line between the doxygen comment and the body
                  of the functions (for consistency with the rest of the files).

Desk reviewed by Paul Robinson.

llvm-svn: 287278
2016-11-17 23:02:00 +00:00
Bruno Cardoso Lopes 6fa3b742e0 [Preprocessor] Support for '-dI' flag
Re-introduce r285411.

Implement the -dI as supported by GCC: Output ‘#include’ directives in addition
to the result of preprocessing.

This change aims to add this option, pass it through to the preprocessor via
the options class, and when inclusions occur we output some information (+ test
cases).

Patch by Steve O'Brien!

Differential Revision: https://reviews.llvm.org/D26089

llvm-svn: 287275
2016-11-17 22:45:31 +00:00
Bruno Cardoso Lopes 02681c4af6 [CrashReproducer][Darwin] Suggest attaching .crash diagnostic file
In addition to the preprocessed sources file and reproducer script, also
point to the .crash diagnostic files on Darwin. Example:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cpp
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cache
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.sh
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.crash

When no match is found for the .crash, point the user to a directory
where those can be found. Example:

clang-4.0: note: diagnostic msg: Crash backtrace is located in
clang-4.0: note: diagnostic msg: /Users/bruno/Library/Logs/DiagnosticReports/clang-4.0_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-4.0: note: diagnostic msg: (choose the .crash file that corresponds to your crash)

rdar://problem/27286266

llvm-svn: 287262
2016-11-17 21:41:22 +00:00
Malcolm Parsons ca9d83475e Fixes for r287241. Use placement new. Apply clang-format.
llvm-svn: 287258
2016-11-17 21:00:09 +00:00
Manman Ren b666573238 ObjC Module: try to make objc module deterministic.
Make sure that comparing selectors in DeclarationName does its job.
rdar://problem/28988750

llvm-svn: 287244
2016-11-17 18:41:18 +00:00
Malcolm Parsons ff0382c161 Use unique_ptr for cached tokens for default arguments in C++.
Summary:
This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs.  There was a fixme in the code where the cached tokens are created  about using a smart pointer.

The change is straightforward, though I did have to track down and fix a memory corruption caused by the change.  memcpy was being used to copy parameter information.  This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely.

Patch by David Tarditi!

Reviewers: malcolm.parsons

Subscribers: arphaman, malcolm.parsons, cfe-commits

Differential Revision: https://reviews.llvm.org/D26435

llvm-svn: 287241
2016-11-17 17:52:58 +00:00
Saleem Abdulrasool 765a219431 Sema: correct typo correction for ivars in @implementation
The previous typo correction handling assumed that ivars are only declared in
the interface declaration rather than as a private ivar in the implementation.
Adjust the handling to permit both interfaces.  Assert earlier that the
interface has been acquired to ensure that we can identify when both possible
casts have failed.

Addresses PR31040!

llvm-svn: 287238
2016-11-17 17:10:54 +00:00
Alexey Bataev 957d856e7e [OPENMP] Fixed codegen for 'omp cancel' construct.
If 'omp cancel' construct is used in a worksharing construct it may
cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled.

llvm-svn: 287227
2016-11-17 15:12:05 +00:00
George Burgess IV 004319554c [Sema] Fix a bug in enable_if condition instantiation.
During template instantiation, we currently fall back to just calling
Sema::SubstExpr for enable_if attributes that aren't value-dependent or
type-dependent. Since Sema::SubstExpr strips off any implicit casts
we've added to an expression, it's possible that this behavior will
leave us with an enable_if condition that's just a DeclRefExpr.
Conditions like that deeply confuse Sema::CheckEnableIf.

llvm-svn: 287187
2016-11-17 01:33:54 +00:00
Ivan Krasin d98f5d78cb Insert a type check before reading vtable.
Summary:
this is to prevent a situation when a pointer is invalid or null,
but we get to reading from vtable before we can check that
(possibly causing a segfault without a good diagnostics).

Reviewers: pcc

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26559

llvm-svn: 287181
2016-11-17 00:39:48 +00:00
Reid Kleckner ad425626d2 Add warning when assigning enums to bitfields without an explicit unsigned underlying type
Summary:
Add a warning when assigning enums to bitfields without an explicit
unsigned underlying type. This is to prevent problems with MSVC
compatibility, since the Microsoft ABI defaults to storing enums with a
signed type, causing inconsistencies with saving to/reading from
bitfields.

Also disabled the warning in the dr0xx.cpp test which throws the error,
and added a test for the warning.

The warning can be disabled with -Wno-signed-enum-bitfield.

Patch by Sasha Bermeister!

Reviewers: rnk, aaron.ballman

Subscribers: mehdi_amini, aaron.ballman, cfe-commits, thakis, dcheng

Differential Revision: https://reviews.llvm.org/D24289

llvm-svn: 287177
2016-11-16 23:40:00 +00:00
Anna Zaks 1485992eb3 [analyzer] Remove unused check::RegionChanges::wantsRegionChangeUpdate callback
Remove the check::RegionChanges::wantsRegionChangeUpdate callback as it is no
longer used (since checkPointerEscape has been added).

A patch by Krzysztof Wiśniewski!

Differential Revision: https://reviews.llvm.org/D26759

llvm-svn: 287175
2016-11-16 22:59:01 +00:00
George Burgess IV add6ab5084 Use the member function location in enable_if diagnostics.
Before:
<stdin>:3:3: error: no matching member function for call to 'bar'
  Foo().bar();
  ^

After:
<stdin>:3:9: error: no matching member function for call to 'bar'
  Foo().bar();
        ^

llvm-svn: 287154
2016-11-16 21:31:25 +00:00
Yaron Keren 3998a09daf Rangify for loops, NFC.
llvm-svn: 287138
2016-11-16 19:24:10 +00:00
Adrian Prantl d3c4e1b11f Fix PR31029 by attaching an artificial debug location to msabi thunks.
This was a latent bug that was recently uncovered by r286400.

llvm-svn: 287134
2016-11-16 18:49:47 +00:00
Benjamin Kramer 7de9969bb0 [Frontend] Allow attaching an external sema source to compiler instance and extra diags to TypoCorrections
This can be used to append alternative typo corrections to an existing diag.
include-fixer can use it to suggest includes to be added.

Differential Revision: https://reviews.llvm.org/D26745

llvm-svn: 287128
2016-11-16 18:15:26 +00:00
Simon Pilgrim 0b33f11164 Remove duplicate condition (PR30648). NFCI.
We only need to check that the bitstream entry is a Record.

llvm-svn: 287114
2016-11-16 16:11:08 +00:00
Pekka Jaaskelainen 6735448751 Add a little endian variant of TCE.
llvm-svn: 287112
2016-11-16 15:22:31 +00:00
Yaron Keren 1cb8146057 Rangify for loop, NFC.
llvm-svn: 287102
2016-11-16 13:45:34 +00:00
Joey Gouly f9889f22a9 [OpenCL] Use the semantic spelling of the Access attribute, rather than a string.
Also fix a latent bug, due to an incorrect traversal of the AttributeList.

llvm-svn: 287100
2016-11-16 11:34:09 +00:00
Simon Pilgrim 698528d83b [X86][AVX512] Replace lossless i32/u32 to f64 conversion intrinsics with generic IR
Both the (V)CVTDQ2PD (i32 to f64) and (V)CVTUDQ2PD (u32 to f64) conversion instructions are lossless and can be safely represented as generic __builtin_convertvector calls instead of x86 intrinsics without affecting final codegen.

This patch removes the clang builtins and their use in the headers - a future patch will deal with removing the llvm intrinsics.

This is an extension patch to D20528 which dealt with the equivalent sse/avx cases.

Differential Revision: https://reviews.llvm.org/D26686

llvm-svn: 287088
2016-11-16 09:27:40 +00:00
Mehdi Amini dc9bf8fab6 Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks
Instead of always displaying the mangled name, try to do better
and get something closer to regular functions.

Recommit r287039 (that was reverted in r287039) with a tweak to
be more generic, and test fixes!

Differential Revision: https://reviews.llvm.org/D26522

llvm-svn: 287085
2016-11-16 07:07:28 +00:00
Steven Wu 844ab6a012 [Driver] Infer the correct option to ld64 for -fembed-bitcode
Summary:
-fembed-bitcode infers -bitcode_bundle to ld64 but it is not correctly
passed when using LTO. LTO is a special case of -fembed-bitcode which
it doesn't require embed the bitcode in a special section in the object
file but it requires linker to save that as part of the final executable.

rdar://problem/29274226

Reviewers: mehdi_amini

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26690

llvm-svn: 287084
2016-11-16 06:06:44 +00:00
Vitaly Buka 2d15858e40 Revert "[OPENMP] Fixed codegen for 'omp cancel' construct."
Summary:
r286944 introduced bugs detected by ASAN as use-after-return.
r287025 have not fixed them completely.

This reverts commit r286944 and r287025.

Reviewers: ABataev

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26720

llvm-svn: 287069
2016-11-16 01:01:22 +00:00
Richard Smith 6328cbd31b Outline evaluation of calls to builtins to avoid inflating stack usage for the
common case of a call to a non-builtin, particularly for unoptimized ASan
builds (where the per-variable stack usage can be quite high).

llvm-svn: 287066
2016-11-16 00:57:23 +00:00
Artem Dergachev 93fd165bfb [analyzer] NumberObjectConversion: Workaround for a linker error with modules.
A combination of C++ modules, variadic functions with more than one argument,
and const globals in headers (all three being necessary) causes some releases
of clang to misplace the matcher objects, which causes the linker to fail.

No functional change - the extra allOf() matcher is no-op here.

llvm-svn: 287045
2016-11-15 22:22:57 +00:00
Mehdi Amini f5f37ee546 Revert "Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks"
This reverts commit r287039, tests are broken.

llvm-svn: 287043
2016-11-15 22:19:50 +00:00
Mehdi Amini 26168ad5c5 Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks
Instead of always displaying the mangled name, try to do better
and get something closer to regular functions.

Differential Revision: https://reviews.llvm.org/D26522

llvm-svn: 287039
2016-11-15 21:47:11 +00:00
Alexey Bataev ba002163c9 [OPENMP] Fix stack use after delete, NFC.
Fixed possible use of stack variable after deletion.

llvm-svn: 287025
2016-11-15 20:57:18 +00:00