Commit Graph

71320 Commits

Author SHA1 Message Date
Aleksei Sidorin b05f37afcb [ASTImporter] Support TypeTraitExpr
Patch by Takafumi Kubota!

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

llvm-svn: 318998
2017-11-26 17:04:06 +00:00
Oren Ben Simhon fec21ec0c6 Control-Flow Enforcement Technology - Shadow Stack and Indirect Branch Tracking support (Clang side)
Shadow stack solution introduces a new stack for return addresses only.
The stack has a Shadow Stack Pointer (SSP) that points to the last address to which we expect to return.
If we return to a different address an exception is triggered.
This patch includes shadow stack intrinsics as well as the corresponding CET header.
It includes CET clang flags for shadow stack and Indirect Branch Tracking.

For more information, please see the following:
https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf

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

Change-Id: I79ad0925a028bbc94c8ecad75f6daa2f214171f1
llvm-svn: 318995
2017-11-26 12:34:54 +00:00
Craig Topper 9e032ed55a [X86] Use separate builtins for fma4 scalar intrinsics. Use negations to remove some of the scalar fma3 builtins.
fma4 instructions zero the upper bits of the xmm register. fma3 instructions leave the bits unmodified. This requires separate builtins for the different semantics.

While we're cleaning up the scalar builtins this also removes the fma3 fmsub/fnmadd/fnmsub builtins by using negates in the header file.

llvm-svn: 318985
2017-11-25 19:32:12 +00:00
Devin Coughlin cc5915a5e1 [analyzer] Teach RetainCountChecker about CoreMedia APIs
Teach the retain-count checker that CoreMedia reference types use
CoreFoundation-style reference counting. This enables the checker
to catch leaks and over releases of those types.

rdar://problem/33599757

llvm-svn: 318979
2017-11-25 14:57:42 +00:00
Martin Probst c160cfaf66 clang-format: [JS] do not collapse short classes.
Summary:
clang-format does not collapse short records, interfaces, unions, etc.,
but fails to do so if the record is preceded by certain modifiers
(export, default, abstract, declare). This change skips over all
modifiers, and thus handles all record definitions uniformly.

Before:
    export class Foo { bar: string; }
    class Baz {
      bam: string;
    }

After:
    export class Foo {
      bar: string;
    }
    class Baz {
      bam: string;
    }

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318976
2017-11-25 09:35:33 +00:00
Martin Probst e8e27ca866 clang-format: [JS] handle semis in generic types.
Summary:
TypeScript generic type arguments can contain object (literal) types,
which in turn can contain semicolons:

    const x: Array<{a: number; b: string;} = [];

Previously, clang-format would incorrectly categorize the braced list as
a block and terminate the line at the openening `{`, and then format the
entire expression badly.

With this change, clang-format recognizes `<` preceding a `{` as
introducing a type expression. In JS, `<` comparison with an object
literal can never be true, so the chance of introducing false positives
here is very low.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 318975
2017-11-25 09:33:47 +00:00
Martin Probst 6c38ef90fd clang-format: [JS] handle `for` as object label.
Summary: Previously, clang-format would fail formatting `{for: 1}`.

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318974
2017-11-25 09:24:33 +00:00
Martin Probst 7e0f25b28d clang-format: [JS] disable ASI on decorators.
Summary:
Automatic Semicolon Insertion in clang-format tries to guess if a line
wrap should insert an implicit semicolong. The previous heuristic would
not trigger ASI if a token was immediately preceded by an `@` sign:

    function foo(@Bar  // <-- does not trigger due to preceding @
                baz) {}

However decorators can have arbitrary parameters:

    function foo(@Bar(param, param, param)  // <-- precending @ missed
                baz) {}

While it would be possible to precisely find the matching `@`, just
conversatively disabling ASI for the entire line is simpler, while also
not regressing ASI substatially.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 318973
2017-11-25 09:19:42 +00:00
Krasimir Georgiev f09c42857f [clang-format] Deduplicate using declarations
Summary: This deduplicated equivalent using declarations within a block.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 318960
2017-11-24 18:00:01 +00:00
Martin Probst ce2bd4dfd8 clang-format: [JS] do not break in ArrayType[].
Summary:
Wrapping between the type name and the array type indicator creates
invalid syntax in TypeScript.

Before:
    const xIsALongIdent:
        YJustBarelyFitsLinex
            [];  // illegal syntax.

After:
    const xIsALongIdent:
        YJustBarelyFitsLinex[];

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318959
2017-11-24 17:05:56 +00:00
Martin Probst a5968aad3d clang-format: [JS] do not wrap before yield.
Summary: The same rules apply as for `return`.

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318958
2017-11-24 17:05:35 +00:00
Martin Probst a2555114b6 clang-format: [JS] space between ! assert and in.
Summary:
Before:
    x = y!in z;
After:
    x = y! in z;

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318957
2017-11-24 17:04:40 +00:00
Ilya Biryukov 8318f61bb8 Avoid copying the data of in-memory preambles
Summary: Preambles are large and we should avoid copying them.

Reviewers: bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 318945
2017-11-24 13:12:38 +00:00
Sam McCall b50a36c8bc [Tooling] Acknowledge that many CompilationDatabases don't support enumeration.
Summary: Provide default implementations so that only getCompileCommands() is mandatory.

Reviewers: ioeric

Subscribers: cfe-commits, bkramer, klimek

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

llvm-svn: 318943
2017-11-24 12:13:55 +00:00
Martin Probst 70cec59e23 clang-format: [JS] handle destructuring `of`.
Summary:
Previously, clang-format would drop a space character between `of` and
then following (non-identifier) token if the preceding token was part of
a destructuring assignment (`}` or `]`).

Before:
    for (const [a, b] of[]) {}

After:
    for (const [a, b] of []) {}

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318942
2017-11-24 10:48:25 +00:00
Adam Balogh da488a65e2 [ASTMatchers] Matchers for new[] operators
Two new matchers for `CXXNewExpr` are added which may be useful e.g. in
`clang-tidy` checkers. One of them is `isArray` which matches `new[]` but not
plain `new`. The other one, `hasArraySize` matches `new[]` for a given size.

llvm-svn: 318909
2017-11-23 12:43:20 +00:00
Olivier Goffart 270ced2bce Do not perform the analysis based warning if the warnings are ignored
This saves some cycles when compiling with "-w".

(Also fix a potential crash on invalid code for tools that tries to recover from some
errors, because analysis might compute the CFG which crashes if the code contains
invalid declaration. This does not happen normally with because we also don't perform
these analysis if there was an error.)

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

llvm-svn: 318900
2017-11-23 08:15:22 +00:00
Serge Pavlov 842022a0f1 [DeclPrinter] Allow printing fully qualified name of function declaration
When requesting a tooltip for a function call in an IDE, the fully
qualified name helps to remove ambiguity in the function signature.

Patch by Nikolai Kosjar!

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

llvm-svn: 318896
2017-11-23 05:38:20 +00:00
Eugene Zelenko 5e5e564ca6 [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 318888
2017-11-23 01:20:07 +00:00
Eugene Zelenko 2f8e66bbd8 [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 318882
2017-11-22 21:32:07 +00:00
Alexey Bataev 16e798873e [OPENMP] Add support for cancel constructs in `target teams distribute
parallel for`.

Add support for cancel/cancellation point directives inside `target
teams distribute parallel for` directives.

llvm-svn: 318881
2017-11-22 21:12:03 +00:00
Alexey Bataev dcb4b8fbc1 [OPENMP] Add support for cancel constructs in [teams] distribute
parallel for directives.

Added codegen/sema support for cancel constructs in [teams] distribute
parallel for directives.

llvm-svn: 318872
2017-11-22 20:19:50 +00:00
Petr Hosek 32c9de009a Revert "[CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)"
This reverts commit r318853: tests are failing on Windows bots

llvm-svn: 318866
2017-11-22 19:50:17 +00:00
Alexey Bataev 438388c2ad [OPENMP] Added missed checks for for [simd] based directives.
Added missed checks/analysis for safelen/simdlen clauses + linear clause
in for [simd] based directives.

llvm-svn: 318860
2017-11-22 18:34:02 +00:00
Peter Collingbourne 048ac83973 CachePruning: Allow limiting the number of files in the cache directory.
The default limit is 1000000 but it can be configured with a cache
policy. The motivation is that some filesystems (notably ext4) have
a limit on the number of files that can be contained in a directory
(separate from the inode limit).

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

llvm-svn: 318857
2017-11-22 18:27:31 +00:00
Petr Hosek 9696dbb988 [CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)
This change should resolve https://bugs.llvm.org/show_bug.cgi?id=35022

Patch by Jake Ehrlich

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

llvm-svn: 318853
2017-11-22 17:59:30 +00:00
Alexey Bataev 7f96c375ac [OPENMP] General improvement of code, NFC.
llvm-svn: 318849
2017-11-22 17:19:31 +00:00
Alexey Bataev b45d43c397 [OPENMP] Do not mark captured variables as artificial in debug info.
Captured variables should not be marked as artificial parameters in
outlined functions in debug info.

llvm-svn: 318843
2017-11-22 16:02:03 +00:00
Jonas Hahnfeld 891c7fb19d [OpenMP] Adjust arguments of nvptx runtime functions
In the future the compiler will analyze whether the OpenMP
runtime needs to be (fully) initialized and avoid that overhead
if possible. The functions already take an argument to transfer
that information to the runtime, so pass in the default value 1.
(This is needed for binary compatibility with libomptarget-nvptx
currently being upstreamed.)

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

llvm-svn: 318836
2017-11-22 14:46:49 +00:00
Alexey Bataev f9fc42e50b [OPENMP] Codegen for `target teams` directive.
Added codegen of the clauses for `target teams` directive.

llvm-svn: 318834
2017-11-22 14:25:55 +00:00
Malcolm Parsons 72e5d69826 [Docs] Update list of languages clang-format can format
llvm-svn: 318827
2017-11-22 10:47:35 +00:00
Petr Hosek 5668d83e0e [Driver] Make the use of relax relocations a per target option
The support for relax relocations is dependent on the linker and
different toolchains within the same compiler can be using different
linkers some of which may or may not support relax relocations.

Give toolchains the option to control whether they want to use relax
relocations in addition to the existing (global) build system option.

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

llvm-svn: 318816
2017-11-22 01:38:31 +00:00
Erich Keane 0a340ab31c [X86] Update CPUSupports code to reuse LLVM .def file [NFC]
llvm-svn: 318815
2017-11-22 00:54:01 +00:00
Eugene Zelenko 21fadadbf3 [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 318813
2017-11-21 23:26:08 +00:00
Richard Trieu 430c96b67a [OpenMP] Fix tests after r318789
Update use of __tgt_target that had some 32bit types updated to 64bit.

llvm-svn: 318811
2017-11-21 22:53:19 +00:00
Nirav Dave 61ffc9c0eb Avoid unecessary opsize byte in segment move to memory
Segment moves to memory are always 16-bit. Remove invalid 32 and 64
bit variants.

Recommiting with missing clang inline assembly test change.

Fixes PR34478.

Reviewers: rnk, craig.topper

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 318797
2017-11-21 19:28:13 +00:00
Aaron Ballman 52a3ca9e29 The offsetof macro is intended to work with subobjects rather than simple identifiers designating a member, making the -Wextended-offsetof diagnostic obsolete as this construct is not an extension. Implements WG14 DR496.
llvm-svn: 318796
2017-11-21 19:25:38 +00:00
Aaron Ballman 5f8980a995 Add an AST matcher for hasDefaultArgument() to match on parameter declarations that have a default value.
Patch by Julie Hockett.

llvm-svn: 318794
2017-11-21 19:22:34 +00:00
George Rokos 63bc9d6f66 [Clang][OpenMP] New clang/libomptarget map interface: new function signatures, clang-side
This clang patch changes the __tgt_* API function signatures in preparation for the new map interface.
Changes are: Device IDs 32bits --> 64bits, Flags 32bits --> 64bits

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

llvm-svn: 318789
2017-11-21 18:25:12 +00:00
Hans Wennborg 14e8a5a32d Add -finstrument-function-entry-bare flag
This is an instrumentation flag that's similar to
-finstrument-functions, but it only inserts calls on function entry, the
calls are inserted post-inlining, and they don't take any arugments.

This is intended for users who want to instrument function entry with
minimal overhead.

(-pg would be another alternative, but forces frame pointer emission and
affects link flags, so is probably best left alone to be used for
generating gcov data.)

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

llvm-svn: 318785
2017-11-21 17:30:34 +00:00
Alexey Bataev 7828b25251 [OPENMP] Initial support for asynchronous data update, NFC.
OpenMP 5.0 introduces asynchronous data update/dependecies clauses on
target data directives. Patch adds initial support for outer task
regions to use task-based codegen for future async target data
directives.

llvm-svn: 318781
2017-11-21 17:08:48 +00:00
Jonas Hahnfeld cfd162d8e5 Fix test/OpenMP/nvptx_data_sharing.cpp
This was an oversight that stayed in the test from development.

llvm-svn: 318779
2017-11-21 16:49:11 +00:00
Aleksei Sidorin 2697f8e4b2 [ASTImporter] Support new AST nodes:
* UnresolvedUsingType
 * EmptyDecl
 * NamespaceAliasDecl
 * UsingDecl
 * UsingShadowDecl
 * UsingDirectiveDecl
 * UnresolvedUsingValueDecl
 * UnresolvedUsingTypenameDecl

Refactor error handling in ImportTemplateArgumentLoc() method.
Add a test for inline namespaces.

llvm-svn: 318776
2017-11-21 16:08:41 +00:00
Gheorghe-Teodor Bercea eb89b1d46f [OpenMP] Add implicit data sharing support when offloading to NVIDIA GPUs using OpenMP device offloading
Summary:
This patch is part of the development effort to add support in the current OpenMP GPU offloading implementation for implicitly sharing variables between a target region executed by the team master thread and the worker threads within that team.

This patch is the first of three required for successfully performing the implicit sharing of master thread variables with the worker threads within a team. The remaining two patches are:
- Patch D38978 to the LLVM NVPTX backend which ensures the lowering of shared variables to an device memory which allows the sharing of references;
- Patch (coming soon) is a patch to libomptarget runtime library which ensures that a list of references to shared variables is properly maintained.

A simple code snippet which illustrates an implicit data sharing situation is as follows:

```
#pragma omp target
{
   // master thread only
   int v;
   #pragma omp parallel
   {
      // worker threads
      // use v
   }
}
```

Variable v is implicitly shared from the team master thread which executes the code in between the target and parallel directives. The worker threads must operate on the latest version of v, including any updates performed by the master.

The code generated in this patch relies on the LLVM NVPTX patch (mentioned above) which prevents v from being lowered in the thread local memory of the master thread thus making the reference to this variable un-shareable with the workers. This ensures that the code generated by this patch is correct.
Since the parallel region is outlined the passing of arguments to the outlined regions must preserve the original order of arguments. The runtime therefore maintains a list of references to shared variables thus ensuring their passing in the correct order. The passing of arguments to the outlined parallel function is performed in a separate function which the data sharing infrastructure constructs in this patch. The function is inlined when optimizations are enabled.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, Hahnfeld, ABataev, caomhin

Reviewed By: ABataev

Subscribers: cfe-commits, jholewinski

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

llvm-svn: 318773
2017-11-21 15:54:54 +00:00
Jonas Hahnfeld 4609b25dde Add target triples to openmp-offload-gpu.c
This might fix the failure on Green Dragon.

llvm-svn: 318767
2017-11-21 15:06:28 +00:00
Jonas Hahnfeld 7c78cc5273 [OpenMP] Consistently use cubin extension for nvlink
This was previously done in some places, but for example not for
bundling so that single object compilation with -c failed. In
addition cubin was used for all file types during unbundling which
is incorrect for assembly files that are passed to ptxas.
Tighten up the tests so that we can't regress in that area.

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

llvm-svn: 318763
2017-11-21 14:44:45 +00:00
Martell Malone 051e966e49 [MINGW] normalize WIN32 macros
move _WIN64 and _WIN32 defines to lib/Basic/Targets/OSTargets.h
move WIN32, WIN64 and __MINGW64__ to addMinGWDefines

fixes __MINGW64__ not being defined for aarch64
adds WIN32 definition for x64

Reviewers: mstorsjo

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

llvm-svn: 318755
2017-11-21 11:28:29 +00:00
Aleksei Sidorin 124f5de841 [Analyzer] Stable iteration on indirect goto LabelDecl's to avoid non-determinism (attempt 2)
CFG wass built in non-deterministic order due to the fact that indirect
goto labels' declarations (LabelDecl's) are stored in the llvm::SmallSet
container. LabelDecl's are pointers, whose order is not deterministic,
and llvm::SmallSet sorts them by their non-deterministic addresses after
"small" container is exceeded. This leads to non-deterministic processing
of the elements of the container.

The fix is to use llvm::SmallSetVector that was designed to have
deterministic iteration order.

Patch by Ilya Palachev!

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

llvm-svn: 318754
2017-11-21 11:27:47 +00:00
Aleksei Sidorin 7ac9be1ab7 [Analyzer] Revert r318750 because incorrect files were added for commit.
Sorry for the noise.

llvm-svn: 318753
2017-11-21 11:20:07 +00:00
Ivan A. Kosarev 5d9d32e820 [CodeGen] Generate TBAA type descriptors in a more reliable manner
This patch introduces a couple of helper functions that make it
possible to handle the caching logic in a single place.

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

llvm-svn: 318752
2017-11-21 11:18:06 +00:00