Commit Graph

22963 Commits

Author SHA1 Message Date
Fangrui Song 0f587e5387 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397.
llvm-svn: 331152
2018-04-30 00:34:09 +00:00
Sanjay Patel d175476566 [Driver, CodeGen] add options to enable/disable an FP cast optimization
As discussed in the post-commit thread for:
rL330437 ( http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180423/545906.html )

We need a way to opt-out of a float-to-int-to-float cast optimization because too much 
existing code relies on the platform-specific undefined result of those casts when the 
float-to-int overflows.

The LLVM changes associated with adding this function attribute are here:
rL330947
rL330950
rL330951

Also as suggested, I changed the LLVM doc to mention the specific sanitizer flag that 
catches this problem:
rL330958

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

llvm-svn: 331041
2018-04-27 14:22:48 +00:00
Oliver Stannard 2fcee8bd52 [ARM,AArch64] Add intrinsics for dot product instructions
The ACLE spec which describes these intrinsics hasn't been published yet, but
this is based on the final draft which will be published soon, and these have
already been implemented by GCC.

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

llvm-svn: 331039
2018-04-27 14:03:32 +00:00
Raphael Isemann 0d24edab02 Make MultiplexASTDeserializationListener part of the API [NFC]
Summary:
This patch moves the MultiplexASTDeserializationListener declaration into a public header.

We're currently using this multiplexer in the cling interpreter to attach another
ASTDeserializationListener during the execution (so, after the MultiplexConsumer is already
attached which prevents us from attaching more). So far we're doing this by patching clang
and making this class public, but it makes things easier if we make this instead just public in
upstream.

Reviewers: thakis, v.g.vassilev, rsmith, bruno

Reviewed By: bruno

Subscribers: llvm-commits, cfe-commits, v.g.vassilev

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

llvm-svn: 331021
2018-04-27 07:05:40 +00:00
Richard Smith 3b8ccd5dbc Fix typo.
llvm-svn: 331017
2018-04-27 04:27:26 +00:00
Richard Smith c08b693e30 Parse A::template B as an identifier rather than as a template-id with no
template arguments.

This fixes some cases where we'd incorrectly accept "A::template B" when B is a
kind of template that requires template arguments (in particular, a variable
template or a concept).

llvm-svn: 331013
2018-04-27 02:00:13 +00:00
Craig Topper 51738f834e [X86] Make __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 only available on 32-bit targets.
These builtins can't be handled by the backend on 64-bit targets. So error up front instead of throwing an isel error.

Fixes PR37225

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

llvm-svn: 330987
2018-04-26 20:14:46 +00:00
Yuka Takahashi 4f38ffa63c Add getDeserializationListener to ASTReader
Summary:
We need to know if ASTReader already has a DeserializationListner or
not, and this also helps to create a multiplexing deserialization
listener if there is one already attached.

Reviewers: v.g.vassilev, rsmith, dblaikie, thakis

Subscribers: cfe-commits

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

llvm-svn: 330946
2018-04-26 15:09:13 +00:00
Richard Smith 53cb831172 Revert addition of 'concept' to diagnostics in r330890.
Matches revert in r330888 of r330794.

llvm-svn: 330891
2018-04-26 01:16:08 +00:00
Richard Smith ecad88d2bb Factor out common code for diagnosing missing template arguments.
In passing, add 'concept' to the list of template kinds in diagnostics.

llvm-svn: 330890
2018-04-26 01:08:00 +00:00
Faisal Vali a534f07f8c Revert rC330794 and some dependent tiny bug fixes
See Richard's humbling feedback here: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html

Wish I'd had the patience to solicit the feedback prior to committing :)

Sorry for the noise guys.

Thank you Richard for being the steward that clang deserves!

llvm-svn: 330888
2018-04-26 00:42:40 +00:00
Artem Dergachev 310bca0178 [analyzer] Fix a crash on lifetime extension through aggregate initialization.
If 'A' is a C++ aggregate with a reference field of type 'C', in code like
  A a = { C() };
C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and
crashing. Additionally, destructors aren't added in the CFG for this case,
so for now we shouldn't be inlining the constructor for C().

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

llvm-svn: 330882
2018-04-25 23:02:06 +00:00
Ana Pazos c85505450a [RISCV] More validations on the input value of -march=
Supporting additional rules for parsing ISA string.

- RISC-V ISA strings must be lowercase.
E.g.: rv32IMC is not supported, rv32imc is correct.

- Multi-letter extensions are to be separated by a single
underscore '_'. The extension prefix counts as a letter.
This means extensions that start with 's', 'sx' and 'sx'
are all multi-letter.
E.g.:
xasb is a single non-standard extension named 'xasb'
xa_sb are two extensions, the non-standard user level extension
'xa', and the supervisor level extension 'sb'.

- Standard user-level extensions are specified following
a canonical order, according to Table 22.1 in
RISC-V User-Level ISA V2.2.

- Non-standard user-level 'x' extensions,
standard supervisor-level 's' extensions and
non-standard supervisor-level 'sx' extensions
are also specified following a canonical order according
to Table 22.1 in RISC-V User-Level ISA V2.2:
'x' extensions, follwed by 's' extensions and then 'sx' extensions.

- Extensions might have a version number.
Underscores may be used to separate ISA subset components to
improve readability and to provide disambiguation.
E.g.: rv32i2_m3_a1_f2_d2

- Version numbers are divided into major and minor numbers,
separated by a 'p'. If the minor version is 0, then 'p0' can
be omitted.

- Additional checks for dependent extensions and invalid
extensions combinations.
E.g.:
'e' requires rv32
'e' can't be combined with 'f' nor 'd'
'q' requires rv64

- TODO items have also been marked with comments in the code.

Reviewers: asb, kito-cheng

Reviewed By: asb

Subscribers: edward-jones, mgrang, zzheng, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, shiva0217, cfe-commits

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

llvm-svn: 330880
2018-04-25 22:42:38 +00:00
Artem Dergachev 516837f2a1 [analyzer] Enable analysis of WebKit "unified sources".
Normally the analyzer begins path-sensitive analysis from functions within
the main file, even though the path is allowed to go through any functions
within the translation unit.

When a recent version of WebKit is compiled, the "unified sources" technique
is used, that assumes #including multiple code files into a single main file.
Such file would have no functions defined in it, so the analyzer wouldn't be
able to find any entry points for path-sensitive analysis.

This patch pattern-matches unified file names that are similar to those
used by WebKit and allows the analyzer to find entry points in the included
code files. A more aggressive/generic approach is being planned as well.

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

llvm-svn: 330876
2018-04-25 21:51:26 +00:00
Martin Storsjo 1fab23da1c [Driver] Fix implicit config files from prefixed symlinks
If -no-canonical-prefixes isn't used, the clang executable name used
is the one of the actual executable, not the name of the symlink that
the user invoked.

In these cases, the target prefix was overridden based on the clang
executable name. (On the other hand the implicit -target option
that such a symlink adds, is added as an actual command line parameter
in tools/driver/driver.cop, before resolving the symlink and finding
the actual clang executable.

Use the original ClangNameParts (set from argv[0] in
tools/driver/driver.cpp) if it seems to be initialized propery.

All existing tests of this feature used -no-canonical-prefixes
(possibly because it also makes the driver look in the directory
of the symlink instead of the directory of the executable); add
another one that uses --config-user-dir= to specify the directory
instead. (For actual users of such symlinks, outisde of the test
suite, the directory is probably the same for both.)

This makes this feature work more like what the documentation
describes.

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

llvm-svn: 330871
2018-04-25 21:23:59 +00:00
Peter Szecsi b180eebed4 [ASTImporter] FriendDecl importing improvements
There are only a few cases of importing a frienddecl which is currently supported.
This patch aims to improve the friend import process.
Set FriendObjectKind in case of decls, insert friend into the friend chain
correctly, checks structurally equivalent in a more advanced manner.
Test cases added as well.  

llvm-svn: 330847
2018-04-25 17:28:03 +00:00
Craig Topper b6dcc57ad1 [Builtins] Fix typos in a comment. NFC
llvm-svn: 330842
2018-04-25 16:57:46 +00:00
Faisal Vali 764216e1f9 [NFC] Make dependent parameter non-deducible, so that we are forced to use the default template parameter.
This might provide users with more graceful diagnostics if they should ever try and call this function with non-ConceptDecls.

llvm-svn: 330798
2018-04-25 03:54:20 +00:00
Faisal Vali 699f45887f Fix rC330794 - a parameter that should have been dependent was inadvertently not -
and compiled in MSVC - but not so for the other bots.

The fix was to make it dependent as intended.

llvm-svn: 330796
2018-04-25 03:28:23 +00:00
Faisal Vali 936de9d666 [c++2a] [concepts] Add rudimentary parsing support for template concept declarations
This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly.

See the test file to get a sense of the basic parsing that this patch supports. 

There is much more work to be done before concepts are usable...

Thanks Changyu!

llvm-svn: 330794
2018-04-25 02:42:26 +00:00
Yaxun Liu 887c569bcb [HIP] Add hip input kind and codegen for kernel launching
HIP is a language similar to CUDA (https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_kernel_language.md ).
The language syntax is very similar, which allows a hip program to be compiled as a CUDA program by Clang. The main difference
is the host API. HIP has a set of vendor neutral host API which can be implemented on different platforms. Currently there is open source
implementation of HIP runtime on amdgpu target (https://github.com/ROCm-Developer-Tools/HIP).

This patch adds support of input kind and language standard hip.

When hip file is compiled, both LangOpts.CUDA and LangOpts.HIP is turned on. This allows compilation of hip program as CUDA
in most cases and only special handling of hip program is needed LangOpts.HIP is checked.

This patch also adds support of kernel launching of HIP program using HIP host API.

When -x hip is not specified, there is no behaviour change for CUDA.

Patch by Greg Rodgers.
Revised and lit test added by Yaxun Liu.

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

llvm-svn: 330790
2018-04-25 01:10:37 +00:00
Richard Trieu 7282d320b7 [ODRHash] Hash template arguments of methods.
llvm-svn: 330789
2018-04-25 00:31:15 +00:00
Artem Belevich 3cce307799 [CUDA] Enable CUDA compilation with CUDA-9.2
Differential Revision: https://reviews.llvm.org/D45827

llvm-svn: 330753
2018-04-24 18:23:19 +00:00
Aleksei Sidorin 04fbffcc52 [ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous decls
This patch introduces the ability to test an arbitrary sequence of imports
between a given set of virtual source files. This should finally allow
us to write simple tests and fix annoying issues inside ASTImporter
that cause failures in CSA CTU. This is done by refactoring
ASTImporterTest functions and introducing `testImportSequence` facility.
As a side effect, `testImport` facility was generalized a bit more. It
should now allow import of non-decl AST nodes; however, there is still no
test using this ability.

As a "test for test", there is also a fix for import anonymous TagDecls
referred by typedef. Before this patch, the setting of typedef for anonymous
structure was delayed; however, this approach misses the corner case if
an enum constant is imported directly. In this patch, typedefs for
anonymous declarations are imported right after the anonymous declaration
is imported, without any delay.

Thanks to Adam Balogh for suggestions included into this patch.

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

llvm-svn: 330704
2018-04-24 10:11:53 +00:00
Craig Topper e78c713b9b [X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.
The 32-bit refers to their input/output type, but the instructions are only available in 64-bit mode.

llvm-svn: 330658
2018-04-23 22:18:36 +00:00
Craig Topper 9d39e04409 [X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.
llvm-svn: 330657
2018-04-23 22:18:34 +00:00
Roman Lebedev 6ed0fad999 [Sema] Add -Wno-self-assign-overloaded
Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

llvm-svn: 330651
2018-04-23 21:35:21 +00:00
Henry Wong 29204c2dfa [analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisitors.h`.
Summary: `TaintBugVisitor` is a universal visitor, and many checkers rely on it, such as `ArrayBoundCheckerV2.cpp`, `DivZeroChecker.cpp` and `VLASizeChecker.cpp`. Moving `TaintBugVisitor` to `BugReporterVisitors.h` enables other checker can also track where `tainted` value came from.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC

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

llvm-svn: 330596
2018-04-23 14:41:17 +00:00
Benjamin Kramer 6f33fca7ec [index] Fix methods that take a shared_ptr to just take a reference.
There is no ownership here, passing a shared_ptr just adds confusion. No
functionality change intended.

llvm-svn: 330595
2018-04-23 14:30:21 +00:00
Sven van Haastregt 49ffffbccd [OpenCL] Reject virtual functions for OpenCL C++
Differential Revision: https://reviews.llvm.org/D45873

llvm-svn: 330579
2018-04-23 11:23:47 +00:00
Mikhail Maltsev 4a4e7a31ad [CodeGen] Reland r330442: Add an option to suppress output of llvm.ident
The test case in the original patch was overly contrained and
failed on PPC targets.

llvm-svn: 330575
2018-04-23 10:08:46 +00:00
Andrew V. Tischenko 8ab2c9cd1e Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature.
Differential Revision: https://reviews.llvm.org/D45619

llvm-svn: 330571
2018-04-23 09:22:30 +00:00
Tim Northover 9dc1d0c74e [Atomics] warn about atomic accesses using libcalls
If an atomic variable is misaligned (and that suspicion is why Clang emits
libcalls at all) the runtime support library will have to use a lock to safely
access it, with potentially very bad performance consequences. There's a very
good chance this is unintentional so it makes sense to issue a warning.

Also give it a named group so people can promote it to an error, or disable it
if they really don't care.

llvm-svn: 330566
2018-04-23 08:16:24 +00:00
Gabor Buella eba6c42e66 [X86] WaitPKG intrinsics
Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 330463
2018-04-20 18:44:33 +00:00
Jordan Rose 90b0a1fc58 Record whether a module came from a private module map
Right now we only use this information in one place, immediately after
we calculate it, but it's still nice information to have. The Swift
project is going to use this to tidy up its "API notes" feature (see
past discussion on cfe-dev that never quite converged).

Reviewed by Bruno Cardoso Lopes.

llvm-svn: 330452
2018-04-20 17:16:04 +00:00
Mikhail Maltsev 42b2a0e162 Revert r330442, CodeGen/no-ident-version.c is failing on PPC
llvm-svn: 330451
2018-04-20 17:14:39 +00:00
Mikhail Maltsev 6550c13912 [CodeGen] Add an option to suppress output of llvm.ident
Summary:
By default Clang outputs its version (including git commit hash, in
case of trunk builds) into object and assembly files. It might be
useful to have an option to disable this, especially for debugging
purposes.
This patch implements new command line flags -Qn and -Qy (the names
are chosen for compatibility with GCC). -Qn disables output of
the 'llvm.ident' metadata string and the 'producer' debug info. -Qy
(enabled by default) does the opposite.

Reviewers: faisalv, echristo, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01

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

llvm-svn: 330442
2018-04-20 16:29:03 +00:00
Jonas Hahnfeld 850fc40b78 [OpenMP] Hide -fopenmp-cuda-mode
This is an advanced flag that should show up neither in clang --help
nor in the ClangCommandLineReference.

llvm-svn: 330429
2018-04-20 13:25:59 +00:00
Nico Weber dd0bb268f0 clang-cl: Accept (and ignore) /Zc:__cplusplus.
See https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
clang-cl already sets __cplusplus to the correct value, so we can just ignore this flag.

Also add test coverage for a few more accepted-but-ignored flags.

https://reviews.llvm.org/D45877

llvm-svn: 330427
2018-04-20 13:10:44 +00:00
Jonas Hahnfeld 8da9c2a2f7 [CUDA] Document recent changes
* Finding installations via ptxas binary
 * Relocatable device code

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

llvm-svn: 330426
2018-04-20 13:04:54 +00:00
Ivan A. Kosarev 4dd9a557fc [NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16() intrinsics
Related differential revision: https://reviews.llvm.org/D45668

llvm-svn: 330420
2018-04-20 12:09:25 +00:00
Artem Dergachev 468bc0d8b9 [analyzer] When we fail to evaluate a pointer cast, escape the pointer.
If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the
analyzer) and such cast is in fact the last use of the pointer, the pointer
symbol is no longer referenced by the program state and a leak is
(mis-)diagnosed.

"Escape" the pointer upon a failed cast, i.e. inform the checker that we can no
longer reliably track it.

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

llvm-svn: 330380
2018-04-19 23:24:32 +00:00
Saleem Abdulrasool 3fe5b7a497 Implement proper support for `-falign-functions`
This implements support for the previously ignored flag
`-falign-functions`.  This allows the frontend to request alignment on
function definitions in the translation unit where they are not
explicitly requested in code.  This is compatible with the GCC behaviour
and the ICC behaviour.

The scalar value passed to `-falign-functions` aligns functions to a
power-of-two boundary.  If flag is used, the functions are aligned to
16-byte boundaries.  If the scalar is specified, it must be an integer
less than or equal to 4096.  If the value is not a power-of-two, the
driver will round it up to the nearest power of two.

llvm-svn: 330378
2018-04-19 23:14:57 +00:00
Ivan A. Kosarev 9b20c245ca [NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode
Differential Revision: https://reviews.llvm.org/D45670

llvm-svn: 330336
2018-04-19 15:27:28 +00:00
Artem Belevich 0ae8590354 [NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma instructions.
The new instructions were added added for sm_70+ GPUs in CUDA-9.1.

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

llvm-svn: 330296
2018-04-18 21:51:48 +00:00
Yaxun Liu 9809db703a [HIP] Add driver input type for HIP
Patch by Greg Rodgers.
Revised by Yaxun Liu.

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

llvm-svn: 330279
2018-04-18 18:25:03 +00:00
Alexey Bataev e372710d30 [OPENMP] Code cleanup and code improvements.
llvm-svn: 330270
2018-04-18 15:57:46 +00:00
Ivan A. Kosarev 1243ebdcdb Revert r330195 "[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch64 mode only".
Differential Revision: https://reviews.llvm.org/D45668

llvm-svn: 330248
2018-04-18 12:02:49 +00:00
Bruno Cardoso Lopes 89b9fdbf1a [Modules] Turn on system header validation for implicit modules
After r300027 implicit builds might fail when updating the SDK on
darwin. Make validation of system headers default when implicit modules
is on and allow modules to be rebuild when system headers change.

rdar://problem/19767523

llvm-svn: 330240
2018-04-18 06:07:49 +00:00
Keith Wyss f437e35671 [XRay] Add clang builtin for xray typed events.
Summary:
A clang builtin for xray typed events. Differs from
__xray_customevent(...) by the presence of a type tag that is vended by
compiler-rt in typical usage. This allows xray handlers to expand logged
events with their type description and plugins to process traced events
based on type.

This change depends on D45633 for the intrinsic definition.

Reviewers: dberris, pelikan, rnk, eizan

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 330220
2018-04-17 21:32:43 +00:00