Commit Graph

83090 Commits

Author SHA1 Message Date
Johannes Doerfert 095cecbe0d [OpenMP] `omp begin/end declare variant` - part 1, parsing
This is the first part extracted from D71179 and cleaned up.

This patch provides parsing support for `omp begin/end declare variant`,
as defined in OpenMP technical report 8 (TR8) [0].

A major purpose of this patch is to provide proper math.h/cmath support
for OpenMP target offloading. See PR42061, PR42798, PR42799. The current
code was developed with this feature in mind, see [1].

[0] https://www.openmp.org/wp-content/uploads/openmp-TR8.pdf
[1] https://reviews.llvm.org/D61399#change-496lQkg0mhRN

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D74941
2020-03-27 02:30:58 -05:00
Johannes Doerfert b29322435a [OpenMP][NFC] Open `llvm` and `llvm::omp` namespace in OpenMPClause.cpp 2020-03-27 02:30:57 -05:00
Johannes Doerfert 56d1553dd2 [OpenMP][NFC] Outline common functionality (skipUntilPragmaOpenMPEnd)
The same code was repeated multiple times, we put it in a function now.
2020-03-27 02:30:57 -05:00
David Blaikie 819e540208 Use llvm_unreachable after a fully covered/always-returning switch 2020-03-26 20:09:57 -07:00
Zakk Chen 64fe841856 Fix typo, targetFeature should be lowercase.
this fixing also enable llc -mattr=+cpuhelp

Reviewers: ziangwan, kongyi

Reviewed By: kongyi

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76757
2020-03-26 19:40:04 -07:00
Douglas Yung 5db37f3bca Make PS4 use -fno-use-init-array only as the ABI does not support .init_array.
Reviewed by Paul Robinson
2020-03-26 15:45:40 -07:00
Sid Manning b0da094983 [Hexagon] Add support for Linux/Musl ABI (part 2)
A continuation of https://reviews.llvm.org/D72701.  This
adds support needed in clang.

Differential Revision: https://reviews.llvm.org/D75638
2020-03-26 17:19:46 -05:00
Alexey Bataev 2a43a1610d [OPENMP50]Fix the checks for the nesting of scan directives.
Fixed the check for the orhaned scan directives and improved checks for
parallel for and parallel for simd directives.
2020-03-26 17:30:02 -04:00
Sam Clegg 0731372ee2 [clang] Allow -DDEFAULT_SYSROOT to be a relative path
In this case we interpret the path as relative the clang driver binary.

This allows SDKs to be built that include clang along with a custom
sysroot without requiring users to specify --sysroot to point to the
directory where they installed the SDK.

See https://github.com/WebAssembly/wasi-sdk/issues/58

Differential Revision: https://reviews.llvm.org/D76653
2020-03-26 13:48:57 -07:00
Alexey Bataev f9e71f4d9d Revert "[OPENMP50]Add basic support for inscan reduction modifier."
This reverts commit 8099e0fe82 to fix the
problems with the Windows-based buildbots.
2020-03-26 15:57:19 -04:00
Alexey Bataev 8099e0fe82 [OPENMP50]Add basic support for inscan reduction modifier.
Added basic support (parsing/sema checks) for the inscan modifier in the
reduction clauses.
2020-03-26 14:51:09 -04:00
Michael Liao 6a9ad5f3f4 [cuda][hip] Add CUDA builtin surface/texture reference support.
Summary:
- Even though the bindless surface/texture interfaces are promoted,
  there are still code using surface/texture references. For example,
  [PR#26400](https://bugs.llvm.org/show_bug.cgi?id=26400) reports the
  compilation issue for code using `tex2D` with texture references. For
  better compatibility, this patch proposes the support of
  surface/texture references.
- Due to the absent documentation and magic headers, it's believed that
  `nvcc` does use builtins for texture support. From the limited NVVM
  documentation[^nvvm] and NVPTX backend texture/surface related
  tests[^test], it's believed that surface/texture references are
  supported by replacing their reference types, which are annotated with
  `device_builtin_surface_type`/`device_builtin_texture_type`, with the
  corresponding handle-like object types, `cudaSurfaceObject_t` or
  `cudaTextureObject_t`, in the device-side compilation. On the host
  side, that global handle variables are registered and will be
  established and updated later when corresponding binding/unbinding
  APIs are called[^bind]. Surface/texture references are most like
  device global variables but represented in different types on the host
  and device sides.
- In this patch, the following changes are proposed to support that
  behavior:
  + Refine `device_builtin_surface_type` and
    `device_builtin_texture_type` attributes to be applied on `Type`
    decl only to check whether a variable is of the surface/texture
    reference type.
  + Add hooks in code generation to replace that reference types with
    the correponding object types as well as all accesses to them. In
    particular, `nvvm.texsurf.handle.internal` should be used to load
    object handles from global reference variables[^texsurf] as well as
    metadata annotations.
  + Generate host-side registration with proper template argument
    parsing.

---
[^nvvm]: https://docs.nvidia.com/cuda/pdf/NVVM_IR_Specification.pdf
[^test]: https://raw.githubusercontent.com/llvm/llvm-project/master/llvm/test/CodeGen/NVPTX/tex-read-cuda.ll
[^bind]: See section 3.2.11.1.2 ``Texture reference API` in [CUDA C Programming Guide](https://docs.nvidia.com/cuda/pdf/CUDA_C_Programming_Guide.pdf).
[^texsurf]: According to NVVM IR, `nvvm.texsurf.handle` should be used.  But, the current backend doesn't have that supported. We may revise that later.

Reviewers: tra, rjmccall, yaxunl, a.sidorin

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76365
2020-03-26 14:44:52 -04:00
Sam McCall 47e7bdb107 Test that would have caught recovery-expr crashes in 0788acbccb. NFC 2020-03-26 18:43:29 +01:00
Kirstóf Umann 4dc8472942 [analyzer] Add the Preprocessor to CheckerManager 2020-03-26 17:29:52 +01:00
Matt Arsenault 40076c14fe CUDA: Fix broken test run lines
There was a misisng space between the -march and --cuda-gpu-arch
arguments, so --cuda-gpu-arch wasn't actually being parsed. I'm not
sure what the intent of the sm_10 run lines were, but they error as an
unsupported architecture. Switch these to something else.
2020-03-26 12:19:34 -04:00
Kirstóf Umann 0766d1dca8 Make a windows buildbot happy 2020-03-26 17:04:23 +01:00
Haojian Wu 62dea6e9be Revert "[AST] Build recovery expressions by default for C++."
This reverts commit 0788acbccb.
This reverts commit c2d7a1f79cedfc9fcb518596aa839da4de0adb69:  Revert "[clangd] Add test for FindTarget+RecoveryExpr (which already works). NFC"

It causes a crash on invalid code:

class X {
  decltype(unresolved()) foo;
};
constexpr int s = sizeof(X);
2020-03-26 16:25:32 +01:00
Kristóf Umann 2aac0c47ae Reland "[analyzer][NFC] Tie CheckerRegistry to CheckerManager, allow CheckerManager to be constructed for non-analysis purposes"
Originally commited in rG57b8a407493c34c3680e7e1e4cb82e097f43744a, but
it broke the modules bot. This is solved by putting the contructors of
the CheckerManager class to the Frontend library.

Differential Revision: https://reviews.llvm.org/D75360
2020-03-26 16:12:38 +01:00
John Brawn 0cff81cff0 Add a release note for attribute plugins 2020-03-26 15:01:57 +00:00
Sam McCall 13dc21e841 [AST] Make thinlto testcase robust to 159a9f7e76
Ultimately it relies on the output of __PRETTY_FUNCTION__ which isn't reliable.
2020-03-26 12:47:39 +01:00
Sam McCall 38798d0306 Revert "[AST] Fix thinlto testcase missed in 159a9f7e76307734bcdcae3357640e42e0733194"
This reverts commit 4bd1d55884.
Cure is worse than the disease: "> >" is still expected in most configs.
Working on fixing the fuchsia builder.
2020-03-26 12:38:33 +01:00
gbreynoo a945037e8f Tools emit the bug report URL on crash
When Clang crashes a useful message is output:

"PLEASE submit a bug report to https://bugs.llvm.org/ and include the
crash backtrace, preprocessed source, and associated run script."

A similar message is now output for all tools.

Differential Revision: https://reviews.llvm.org/D74324
2020-03-26 10:26:59 +00:00
Haojian Wu 297a9dac43 [CodeComplete] Don't replace the rest of line in #include completion.
Summary:
The previous behavior was aggressive,
  #include "abc/f^/abc.h"
                foo/  -> candidate
"f/abc.h" is replaced with "foo/", this patch will preserve the "abc.h".

Reviewers: sammccall

Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76770
2020-03-26 11:03:04 +01:00
Sam McCall 4bd1d55884 [AST] Fix thinlto testcase missed in 159a9f7e76 2020-03-26 10:28:54 +01:00
Ties Stuij 71ae267d1f [PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support
Summary:
This patch introduces command-line support for the Armv8.6-a architecture and assembly support for BFloat16. Details can be found
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

in addition to the GCC patch for the 8..6-a CLI:
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg02647.html

In detail this patch

- march options for armv8.6-a
- BFloat16 assembly

This is part of a patch series, starting with command-line and Bfloat16
assembly support. The subsequent patches will upstream intrinsics
support for BFloat16, followed by Matrix Multiplication and the
remaining Virtualization features of the armv8.6-a architecture.

Based on work by:
- labrinea
- MarkMurrayARM
- Luke Cheeseman
- Javed Asbar
- Mikhail Maltsev
- Luke Geeson

Reviewers: SjoerdMeijer, craig.topper, rjmccall, jfb, LukeGeeson

Reviewed By: SjoerdMeijer

Subscribers: stuij, kristof.beyls, hiraditya, dexonsmith, danielkiss, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D76062
2020-03-26 09:17:20 +00:00
Sam McCall 159a9f7e76 [AST] Print a<b<c>> without extra spaces in C++11 or later.
Summary: It's not 1998 anymore.

Reviewers: kadircet

Subscribers: jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76801
2020-03-26 09:53:54 +01:00
Adam Balogh 1a27d63a88 [Analyzer] Only add container note tags to the operations of the affected container
If an error happens which is related to a container the Container
Modeling checker adds note tags to all the container operations along
the bug path. This may be disturbing if there are other containers
beside the one which is affected by the bug. This patch restricts the
note tags to only the affected container and adjust the debug checkers
to be able to test this change.

Differential Revision: https://reviews.llvm.org/D75514
2020-03-26 09:44:16 +01:00
Haojian Wu a9ab11d408 [AST] Build recovery expressions for nonexistent member exprs.
Summary: Previously, we dropped the AST node for nonexistent member exprs.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76764
2020-03-26 08:50:33 +01:00
Adam Balogh a3f4d17a1a [Analyzer] Use note tags to track container begin and and changes
Container operations such as `push_back()`, `pop_front()`
etc. increment and decrement the abstract begin and end
symbols of containers. This patch introduces note tags
to `ContainerModeling` to track these changes. This helps
the user to better identify the source of errors related
to containers and iterators.

Differential Revision: https://reviews.llvm.org/D73720
2020-03-26 07:56:28 +01:00
Michael Liao d264f02c6f Fix `-Wreturn-type` warning. NFC. 2020-03-26 00:53:24 -04:00
Erich Keane fe5c719eaf Implement post-commit comments for D75685/rG86e0a6c60627
@Anastasia made a pair of comments on D75685 after it was committed
requesting changes to the test.  This patch updates the test based on
her comments.
2020-03-25 12:24:56 -07:00
Alexander Belyaev df48e3920a [Clang] Fix clang-tidy errors. 2020-03-25 20:13:43 +01:00
Erich Keane 044c51d8d4 Fix vector type scalar checking when the scalar operand is dependent
As reported in PR45298 and PR45299, vector_size type checking would
crash when done in a situation where the scalar is dependent, such as
a member of the current instantiation.

This is because the scalar checking ensures that you can implicitly
convert a value to a vector-type as long as it doesn't require
truncation. It does this by using the constant evaluator to get the
value as a float. Unfortunately, if the scalar is dependent (such as a
member of the current instantiation), we would hit the assert in the
evaluator.

This patch suppresses the truncation- of-value check in the first phase
of translation. All values are properly errored upon instantiation. This
has one minor regression, in that previously in a non-asserts build,

template<typename T>
struct S {
  float4 f(float4 f) {
    return k + f;
  }
  static constexpr k = 1.1; // causes a truncation on conversion.
};

would error immediately. Because 'k' is value dependent (as a
member-of-the-current-instantiation), this would still be evaluatable
(despite normally asserting).  Due to this patch, this diagnostic is
delayed until instantiation time.
2020-03-25 11:38:58 -07:00
Eli Friedman c46a0c07a6 [clang codegen] Address review comment on comment in constWithPadding. 2020-03-25 10:58:03 -07:00
Nico Weber d7888149aa Suppress a few -Wunreachable-code warnings.
No behavior change. Also fix a comment to say match reality.
2020-03-25 13:55:42 -04:00
Mikhail Maltsev bb4da94e5b [ARM,CDE] Implement predicated Q-register CDE intrinsics
Summary:
This patch implements the following CDE intrinsics:

  T __arm_vcx1q_m(int coproc, T inactive, uint32_t imm, mve_pred_t p);
  T __arm_vcx2q_m(int coproc, T inactive, U n, uint32_t imm, mve_pred_t p);
  T __arm_vcx3q_m(int coproc, T inactive, U n, V m, uint32_t imm, mve_pred_t p);

  T __arm_vcx1qa_m(int coproc, T acc, uint32_t imm, mve_pred_t p);
  T __arm_vcx2qa_m(int coproc, T acc, U n, uint32_t imm, mve_pred_t p);
  T __arm_vcx3qa_m(int coproc, T acc, U n, V m, uint32_t imm, mve_pred_t p);

The intrinsics are not part of the released ACLE spec, but internally at
Arm we have reached consensus to add them to the next ACLE release.

Reviewers: simon_tatham, MarkMurrayARM, ostannard, dmgreen

Reviewed By: simon_tatham

Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76610
2020-03-25 17:08:19 +00:00
Gabor Marton eaa7d00f36 [analyzer][NFC] Add missing LLVM header blurb (and license) 2020-03-25 17:57:29 +01:00
zoecarver b915aec6b5 Add method to TargetInfo to get CPU cache line size
Summary:
This patch adds a virtual method `getCPUCacheLineSize()` to `TargetInfo`. Currently, I've only implemented the method in `X86TargetInfo`. It's extremely important that each CPU's cache line size correct (e.g., we can't just define it as `64` across the board) so, it has been a little slow getting to this point.

I'll work on the ARM CPUs next, but that will probably come later in a different patch.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74918
2020-03-25 09:50:38 -07:00
Michael Kruse 7520cf03ee [clang] Reformat cindex. NFC.
to reduce spurios changes in patches after clang-formatting them. In
particular, these files contain long enums that clang-format reformats
in their entirety if e.g. an element is added.

Reviews having this problem include https://reviews.llvm.org/D76342 and
https://reviews.llvm.org/D71447.
2020-03-25 11:11:48 -05:00
Erich Keane 86e0a6c606 Add MS Mangling for OpenCL Pipe types, add mangling test.
SPIRV2.0 Spec only specifies Linux mangling, however our downstream has
use for a Windows mangling for these types.

Unfortunately, the SPIRV
spec specifies a single mangling for all pipe types, despite clang
allowing overloading on these types.  Because of this, this patch
chooses to mangle the read/writability and element type for the windows
mangling.

The windows manglings in the test all demangle according to demangler:
"void __cdecl test1(struct __clang::ocl_pipe<int,1>)
"void __cdecl test2(struct __clang::ocl_pipe<float,0>)
"void __cdecl test2(struct __clang::ocl_pipe<int,1>)
"void __cdecl test3(struct __clang::ocl_pipe<int const,1>)
"void __cdecl test4(struct __clang::ocl_pipe<union
__clang::__vector<unsigned char,3>,1>)
"void __cdecl test5(struct __clang::ocl_pipe<union
__clang::__vector<int,4>,1>)
"void __cdecl test_reserved_read_pipe(struct __clang::_ASCLglobal<struct
Person > * __ptr64,struct __clang::ocl_pipe<struct Person,1>)

Differential Revision: https://reviews.llvm.org/D75685
2020-03-25 07:59:22 -07:00
Hans Wennborg c278e8f8f9 Build fix: AttributeCommonInfo::AS_C2x 2020-03-25 15:42:21 +01:00
John Brawn 3f03c12a51 Add an attribute plugin example
Differential Revision: https://reviews.llvm.org/D31343
2020-03-25 14:33:44 +00:00
John Brawn bc3f171090 Don't normalise CXX11/C2X attribute names to start with ::
Currently square-bracket-style (CXX11/C2X) attribute names are normalised to
start with :: if they don't have a namespace. This is a bit odd, as such
names are rejected when parsing, so don't do this.

Differential Revision: https://reviews.llvm.org/D76704
2020-03-25 14:33:44 +00:00
sstefan1 72b51d6f93 OpenMP] Adding InaccessibleMemOnly and InaccessibleMemOrArgMemOnly for runtime calls.
Summary: Attempt to add more attributes for runtime calls.

Reviewers: jdoerfert

Subscribers: guansong, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75010
2020-03-25 14:08:50 +00:00
Erich Keane b5a034e771 [SYCL] Implement __builtin_unique_stable_name.
In order to support non-user-named kernels, SYCL needs some way in the
integration headers to name the kernel object themselves. Initially, the
design considered just RTTI naming of the lambdas, this results in a
quite unstable situation in light of some device/host macros.
Additionally, this ends up needing to use RTTI, which is a burden on the
implementation and typically unsupported.

Instead, we've introduced a builtin, __builtin_unique_stable_name, which
takes a type or expression, and results in a constexpr constant
character array that uniquely represents the type (or type of the
expression) being passed to it.

The implementation accomplishes that simply by using a slightly modified
version of the Itanium Mangling. The one exception is when mangling
lambdas, instead of appending the index of the lambda in the function,
it appends the macro-expansion back-trace of the lambda itself in the
form LINE->COL[~LINE->COL...].

Differential Revision: https://reviews.llvm.org/D76620
2020-03-25 07:01:50 -07:00
Richard Sandiford 856bdd01fd [Sema][SVE] Allow casting SVE types to themselves in C
Casts from an SVE type to itself aren't very useful, but they are
supposed to be valid, and could occur in things like macro expansions.

Such casts already work for C++ and are tested by sizeless-1.cpp.
This patch makes them work for C too.

Differential Revision: https://reviews.llvm.org/D76694
2020-03-25 10:52:43 +00:00
Richard Sandiford 578fb2501a [Sema][SVE] Allow ?: to select between SVE types in C
When compiling C, a ?: between two values of the same SVE type
currently gives an error such as:

  incompatible operand types ('svint8_t' (aka '__SVInt8_t') and 'svint8_t')

It's supposed to be valid to select between (cv-qualified versions of)
the same SVE type, so this patch adds that case.

These expressions already work for C++ and are tested by
SemaCXX/sizeless-1.cpp.

Differential Revision: https://reviews.llvm.org/D76693
2020-03-25 10:31:09 +00:00
Simon Tatham 8f1651ccea [ARM,MVE] Add missing tests for vqdmlash intrinsics.
Summary:
These were accidentally left out of D76123. I added tests for the
other three instructions in this small cross-product family (vqdmlah,
vqrdmlah, vqrdmlash) but missed this one.

Reviewers: miyuki

Reviewed By: miyuki

Subscribers: kristof.beyls, dmgreen, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76714
2020-03-25 09:46:16 +00:00
Haojian Wu 0788acbccb [AST] Build recovery expressions by default for C++.
Update the existing tests.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76696
2020-03-25 09:00:48 +01:00
Adrian Prantl c025235e96 Revert "Allow remapping Clang module include paths"
to investigate why this commit broke a test in the LLDB testsuite.

This reverts commit dca920a904.
2020-03-24 17:57:34 -07:00