Commit Graph

20259 Commits

Author SHA1 Message Date
David Majnemer 093012bf6e [clang-cl] Implement support for /std
/std: supports two arguments, c++14 and c++latest.  Currently, c++latest
maps to c++1z but this might change down the road.

llvm-svn: 273841
2016-06-27 02:32:12 +00:00
Richard Smith 62f19e700d Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives a
variable weak discardable linkage and partially-ordered initialization, and is
implied for constexpr static data members.)

llvm-svn: 273754
2016-06-25 00:15:56 +00:00
Carlo Bertolli b8503d5399 Revert r273705
[OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

llvm-svn: 273709
2016-06-24 19:20:02 +00:00
Carlo Bertolli e77d6e0e4d [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'
http://reviews.llvm.org/D21564

This patch is an initial implementation for #distribute parallel for.
The main differences that affect other pragmas are:

The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds.
As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value.
As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound.

llvm-svn: 273705
2016-06-24 18:53:35 +00:00
Richard Smith b7d7a046d8 Using for attributes voted into C++17.
llvm-svn: 273666
2016-06-24 12:15:12 +00:00
Cong Liu 8a02efb143 IgnoringImplicit matcher.
llvm-svn: 273659
2016-06-24 09:38:03 +00:00
David Majnemer f11b9798f4 try to fix the MSVC build
llvm-svn: 273651
2016-06-24 05:48:59 +00:00
David Majnemer a3debed239 Use even more ArrayRefs
No functional change is intended, just a small refactoring.

llvm-svn: 273650
2016-06-24 05:33:44 +00:00
David Majnemer 59f7792136 Use more ArrayRefs
No functional change is intended, just a small refactoring.

llvm-svn: 273647
2016-06-24 04:05:48 +00:00
David Majnemer f440d267e3 Use the same underlying type for bitfields
MSVC allocates fresh storage for consecutive bitfields with different
underlying types.

llvm-svn: 273646
2016-06-24 04:05:35 +00:00
Richard Smith b130fe7d31 Implement p0292r2 (constexpr if), a likely C++1z feature.
llvm-svn: 273602
2016-06-23 19:16:49 +00:00
Richard Smith 03a4aa3d00 Re-commit r273548, reverted in r273589, with a fix to not produce
-Wfor-loop-analysis warnings for a for-loop with a condition variable. In such
a case, the loop condition variable is modified on each iteration of the loop
by definition.

Original commit message:

Rearrange condition handling so that semantic checks on a condition variable
are performed before the other substatements of the construct are parsed,
rather than deferring them until the end. This allows better error recovery
from semantic errors in the condition, improves diagnostic order, and is a
prerequisite for C++17 constexpr if.

llvm-svn: 273600
2016-06-23 19:02:52 +00:00
Peter Collingbourne b77ebd749a Revert r273548, "Rearrange condition handling so that semantic checks on a condition variable"
as it caused a regression in -Wfor-loop-analysis.

llvm-svn: 273589
2016-06-23 18:11:15 +00:00
Ben Craig 4067e35fae [Analyzer] Don't cache report generation ExplodedNodes
During the core analysis, ExplodedNodes are added to the
ExplodedGraph, and those nodes are cached for deduplication purposes.

After core analysis, reports are generated. Here, trimmed copies of
the ExplodedGraph are made. Since the ExplodedGraph has already been
deduplicated, there is no need to deduplicate again.

This change makes it possible to add ExplodedNodes to an
ExplodedGraph without the overhead of deduplication. "Uncached" nodes
also cannot be iterated over, but none of the report generation code
attempts to iterate over all nodes. This change reduces the analysis
time of a large .C file from 3m43.941s to 3m40.256s (~1.6% speedup).
It should slightly reduce memory consumption. Gains should be roughly
proportional to the number (and path length) of static analysis
warnings.

This patch enables future work that should remove the need for an
InterExplodedGraphMap inverse map. I plan on using the (now unused)
ExplodedNode link to connect new nodes to the original nodes.

http://reviews.llvm.org/D21229

llvm-svn: 273572
2016-06-23 15:47:12 +00:00
Rafael Espindola c9d336e549 Restructure the propagation of -fPIC/-fPIE.
The PIC and PIE levels are not independent. In fact, if PIE is defined
it is always the same as PIC.

This is clear in the driver where ParsePICArgs returns a PIC level and
a IsPIE boolean. Unfortunately that is currently lost and we pass two
redundant levels down the pipeline.

This patch keeps a bool and a PIC level all the way down to codegen.

llvm-svn: 273566
2016-06-23 15:07:32 +00:00
Richard Smith 19f877c3f2 Rearrange condition handling so that semantic checks on a condition variable
are performed before the other substatements of the construct are parsed,
rather than deferring them until the end. This allows better error recovery
from semantic errors in the condition, improves diagnostic order, and is a
prerequisite for C++17 constexpr if.

llvm-svn: 273548
2016-06-23 08:41:20 +00:00
Craig Topper 79f53ca0b5 [AVX512] Replace masked unpack builtins with shufflevector and selects.
llvm-svn: 273533
2016-06-23 06:36:42 +00:00
David Majnemer f7e3609f77 Use ranges to concisely express iteration
No functional change is intended, this should just clean things up a
little.

llvm-svn: 273522
2016-06-23 00:15:04 +00:00
Hans Wennborg 44d061a471 Add support for /Ob1 and -finline-hint-functions flags
Add support for /Ob1 (and equivalent -finline-hint-functions), which enable
inlining only for functions marked inline, either explicitly (via inline
keyword, for example), or implicitly (function definition in class body,
for example).

This works by enabling inlining pass, and adding noinline attribute to
every function not marked inline.

Patch by Rudy Pons <rudy.pons@ilod.org>!

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

llvm-svn: 273440
2016-06-22 16:56:16 +00:00
Craig Topper 67d8256c11 [AVX512] __builtin_ia32_reducesd_mask and __builtin_ia32_reducess_mask should not require avx512vl.
llvm-svn: 273387
2016-06-22 06:36:18 +00:00
Kelvin Li 7a6ec86fcc [OpenMP] Add the depend clause to target update construct (sema and parsing)
Differential Revision: http://reviews.llvm.org/D21532

llvm-svn: 273369
2016-06-22 03:10:32 +00:00
NAKAMURA Takumi 55195e6b89 Stmt.h: Tweak r273312 to avoid bool:1 to appease win32.
llvm-svn: 273343
2016-06-22 00:41:50 +00:00
Tim Shen 4a05bb8d8d Re-commit "[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr."
Since D21243 fixes relative clang-tidy tests.

This reverts commit a71d9fbd41e99def9159af2b01ef6509394eaeed.

llvm-svn: 273312
2016-06-21 20:29:17 +00:00
Sanjay Patel a4d156980e [x86] AVX FP compare builtins should require AVX target feature (PR28112)
This is a fix for PR28112:
https://llvm.org/bugs/show_bug.cgi?id=28112

The FP comparison intrinsics that take an immediate parameter (rather than specifying
a comparison predicate in the function name) were added with AVX; these are macros in
avxintrin.h. This patch makes clang behavior match gcc (error if a program tries to use 
these without -mavx) and matches the Intel documentation, eg:
VCMPPS: m128 _mm_cmp_ps(m128 a, __m128 b, const int imm)

'V' means this is intended to only work with the AVX form of the instruction.

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

llvm-svn: 273311
2016-06-21 20:22:55 +00:00
Eric Liu 8b636db8d4 Added calculateRangesAfterReplaments() to calculate affacted ranges in the new code.
Summary:
Added calculateRangesAfterReplaments() to calculate original ranges as well as
newly affacted ranges in the new code.

Reviewers: klimek, djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 273290
2016-06-21 17:56:31 +00:00
Pirama Arumuga Nainar c85c85301d Add documentation for RenderScript changes
Summary:
- Document the new 'kernel' attribute
- Mention RenderScript support in the Release Notes.

Reviewers: rsmith

Subscribers: tberghammer, danalbert, cfe-commits, srhines

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

llvm-svn: 273283
2016-06-21 16:09:30 +00:00
Rafael Espindola 557679f42b Add a ENABLE_X86_RELAX_RELOCATIONS cmake option.
This corresponds to binutils' --enable-x86-relax-relocations.

llvm-svn: 273224
2016-06-20 23:54:44 +00:00
Yaxun Liu 143f083e4b [OpenCL] Include opencl-c.h by default as a clang module
Include opencl-c.h by default as a module to utilize the automatic AST caching mechanism of clang modules.

Add an option -finclude-default-header to enable default header for OpenCL, which is off by default.

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

llvm-svn: 273191
2016-06-20 19:26:00 +00:00
Kelvin Li 98780e6eff [OpenMP] Add the nowait clause to target update construct.
Differential Revision: http://reviews.llvm.org/D21477

llvm-svn: 273190
2016-06-20 19:16:34 +00:00
Andrey Turetskiy e8e1ffef11 [X86] Add -mno-iamcu option.
Add -mno-iamcu option to:
  1) Countervail -miamcu option easily
  2) Be compatible with GCC which supports this option

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

llvm-svn: 273147
2016-06-20 10:31:39 +00:00
Saleem Abdulrasool 88879e6559 Driver: introduce and use `-isystem-after` for cross-windows
This mirrors the many other -i*after options to insert a new system search
directory at the end of the search path.  This makes it possible to actually
inject a search path after the resource dir.  This option is similar in spirit
to the /imsvc option in the clang-cl driver.  This is needed to properly use the
driver for Windows targets where the clang headers wrap some of the system
headers.

This concept is actually useful on other targets (e.g. Linux) and would be
really easy to support on the core toolchain.

llvm-svn: 273016
2016-06-17 17:23:16 +00:00
Yaxun Liu b5044fe421 [OpenCL] Allow -std={cl|CL}{|1.1|1.2|2.0} in driver
Fix a regression which forbids using -std=cl|CL1.1|CL1.2|CL2.0 in driver.

Allow -std and -cl-std={cl|CL}{|1.1|1.2|2.0}.

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

llvm-svn: 273015
2016-06-17 17:19:28 +00:00
Ranjeet Singh ca2b3e7b5c [ARM] Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics.
Reapplying patch in r272777 which was reverted
because the llvm patch which added support
for generating the mcrr/mcrr2 instructions
from the intrinsic was causing an assertion
failure. This has now been fixed in llvm.

llvm-svn: 272983
2016-06-17 00:59:41 +00:00
George Burgess IV 419996ccb5 [CodeGen] Fix a segfault caused by pass_object_size.
This patch fixes a bug where we'd segfault (in some cases) if we saw a
variadic function with one or more pass_object_size arguments.

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

llvm-svn: 272971
2016-06-16 23:06:04 +00:00
Marcin Koscielnicki a46fade624 [Builtin] Make __builtin_thread_pointer target-independent.
This is now supported for ARM, AArch64, PowerPC, SystemZ, SPARC, Mips.

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

llvm-svn: 272893
2016-06-16 13:41:54 +00:00
Andrey Turetskiy 4798eb6d59 Compilation for Intel MCU (Part 2/3)
This is the second patch required to support compilation for Intel MCU target (e.g. Intel(R) Quark(TM) micro controller D 2000).
When IAMCU triple is used:
 * Recognize and use IAMCU GCC toolchain
 * Set up include paths
 * Forbid C++

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

llvm-svn: 272883
2016-06-16 10:36:09 +00:00
Paul Robinson afd2dde2fd Allow 'nodebug' on local variables.
Parameters and non-static members of aggregates are still excluded,
and probably should remain that way.

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

llvm-svn: 272859
2016-06-16 00:42:36 +00:00
Etienne Bergeron e28e7f234d Add support to clang-cl driver for /GS switch
Summary:
This patch is adding command-line support for the MSVC buffer security check.

The buffer security check is turned on with the '/GS' compiler switch.
https://msdn.microsoft.com/en-us/library/8dbf701c.aspx

The MSVC buffer security check in implemented here:
http://reviews.llvm.org/D20346

Reviewers: hans, rnk

Subscribers: chrisha, cfe-commits, rnk, hans, thakis

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

llvm-svn: 272832
2016-06-15 20:34:33 +00:00
Ranjeet Singh d48760da64 Reverting r272777 because one of the tests
added in the llvm patch is causing an assertion
to fail.

llvm-svn: 272790
2016-06-15 14:21:28 +00:00
John Brawn 771721cb35 Don't use static variables in LambdaCapture
When static variables are used in inline functions in header files anything that
uses that function ends up with a reference to the variable. Because
RecursiveASTVisitor uses the inline functions in LambdaCapture that use static
variables any AST plugin that uses RecursiveASTVisitor, such as the
PrintFunctionNames example, ends up with a reference to these variables. This is
bad on Windows when building with MSVC with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON
as variables used across a DLL boundary need to be explicitly dllimported in
the DLL using them.

This patch avoids that by adjusting LambdaCapture to be similar to before
r263921, with a capture of either 'this' or a VLA represented by a null Decl
pointer in DeclAndBits with an extra flag added to the bits to distinguish
between the two. This requires the use of an extra bit, and while Decl does
happen to be sufficiently aligned to allow this it's done in a way that means
PointerIntPair doesn't realise it and gives an assertion failure. Therefore I
also adjust Decl slightly to use LLVM_ALIGNAS to allow this.

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

llvm-svn: 272788
2016-06-15 14:14:51 +00:00
Ranjeet Singh 8d5ad5bdf2 [ARM] Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics.
Patch adds intrinsics for mrrc/mrrc2. The
intrinsics for mrrc/mrrc2 return a single
uint64_t to represent two 32 bit values.

The mcrr/mcrr2 intrinsic was changed to
accept a single uint64_t instead of two
32 bit values as the input for consistency.

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

llvm-svn: 272777
2016-06-15 11:32:18 +00:00
Alexey Bataev 61deb4dadc Revert accidential "[MSVC] Late parsing of in-class defined member functions in template"
This reverts commit 0253605771b8bd9d414aba74fe2742c730d6fd1a.

llvm-svn: 272776
2016-06-15 11:24:54 +00:00
Alexey Bataev 86e786bd17 [MSVC] Late parsing of in-class defined member functions in template
classes.

MSVC actively uses unqualified lookup in dependent bases, lookup at the
instantiation point (non-dependent names may be resolved on things
declared later) etc. and all this stuff is the main cause of
incompatibility between clang and MSVC.

Clang tries to emulate MSVC behavior but it may fail in many cases.
clang could store lexed tokens for member functions definitions within
ClassTemplateDecl for later parsing during template instantiation.

It will allow resolving many possible issues with lookup in dependent
base classes and removing many already existing MSVC-specific
hacks/workarounds from the clang code.

llvm-svn: 272774
2016-06-15 11:19:39 +00:00
Nick Lewycky bc85ec8656 Add a "declared 'nonnull' here" note to warnings where an expression is checked against null.
llvm-svn: 272755
2016-06-15 05:18:39 +00:00
Yaxun Liu 18e3fd3ad6 [OpenCL] Enable -fblocks by default for OpenCL 2.0 and above.
Reviewed as part of http://reviews.llvm.org/D20444

llvm-svn: 272720
2016-06-14 21:43:01 +00:00
Adam Nemet 2de463ece3 Add loop pragma for Loop Distribution
Summary:
This is similar to other loop pragmas like 'vectorize'.  Currently it
only has state values: distribute(enable) and distribute(disable).  When
one of these is specified the corresponding loop metadata is generated:

  !{!"llvm.loop.distribute.enable", i1 true/false}

As a result, loop distribution will be attempted on the loop even if
Loop Distribution in not enabled globally.  Analogously, with 'disable'
distribution can be turned off for an individual loop even when the pass
is otherwise enabled.

There are some slight differences compared to the existing loop pragmas.

1. There is no 'assume_safety' variant which makes its handling slightly
different from 'vectorize'/'interleave'.

2. Unlike the existing loop pragmas, it does not have a corresponding
numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
consistency checks in CheckForIncompatibleAttributes we don't need to
check it against other pragmas.  We just need to check for duplicates of
the same pragma.

Reviewers: rsmith, dexonsmith, aaron.ballman

Subscribers: bob.wilson, cfe-commits, hfinkel

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

llvm-svn: 272656
2016-06-14 12:04:26 +00:00
Roger Ferrer Ibanez 985c0c274b Reverting "Warn when taking address of a packed member"
This new diagnostic is causing some false positives that have to be addressed.

This reverts commit 272552

llvm-svn: 272653
2016-06-14 11:20:07 +00:00
Daniel Sanders 32b2d6b160 [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases.
Summary:
The validity of ABI/CPU pairs is no longer checked on the fly but is
instead checked after initialization. As a result, invalid CPU/ABI pairs
can be reported as being known but invalid instead of being unknown. For
example, we now emit:
  error: ABI 'n32' is not supported on CPU 'mips32r2'
instead of:
  error: unknown target ABI 'n64'

Reviewers: atanasyan

Subscribers: sdardis, cfe-commits

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

llvm-svn: 272645
2016-06-14 08:58:50 +00:00
Serge Pavlov b82a9401df Detect recursive default argument definition
If definition of default function argument uses itself, clang crashed,
because corresponding function parameter is not associated with the default
argument yet. With this fix clang emits appropriate error message.

This change fixes PR28105.

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

llvm-svn: 272623
2016-06-14 02:55:56 +00:00
Taewook Oh f42103ce8b Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
Differential Revision: http://reviews.llvm.org/D19843
Corresponding LLVM change: http://reviews.llvm.org/D19842

Re-commit of r272562 after addressing clang-x86-win2008-selfhost failure.

llvm-svn: 272584
2016-06-13 20:40:21 +00:00