Commit Graph

73748 Commits

Author SHA1 Message Date
Craig Topper 3d9305f28b [X86] Fix the names of a bunch of icelake intrinsics.
Mostly this fixes the names of all the 128-bit intrinsics to start with _mm_ instead of _mm128_ as is the convention and what the Intel docs say.

This also fixes the name of the bitshuffle intrinsics to say epi64 for 128 and 256 bit versions.

llvm-svn: 333497
2018-05-30 03:38:15 +00:00
Eric Fiselier d7d79e2c3b Fix test failure after r333485. Try 2.
Sorry for the breakage.

llvm-svn: 333491
2018-05-30 02:20:40 +00:00
Richard Smith b534510cd5 Make the mangled name collision diagnostic a bit more useful by listing the mangling.
This helps especially when the collision is for a template specialization,
where the template arguments are not available from anywhere else in the
diagnostic, and are likely relevant to the problem.

llvm-svn: 333489
2018-05-30 01:52:16 +00:00
Eric Fiselier 4977c375a5 Fix test failure after r333485.
I missed adjusting a test under Misc in the last commit.
This patch updates that test.

llvm-svn: 333488
2018-05-30 01:22:14 +00:00
Richard Trieu 9359e8f22a [ODRHash] Support FunctionTemplateDecl in records.
llvm-svn: 333486
2018-05-30 01:12:26 +00:00
Eric Fiselier 92e523bf55 [Sema] Use %sub to cleanup overload diagnostics
Summary:
This patch adds the newly added `%sub` diagnostic modifier to cleanup repetition in the overload candidate diagnostics.

I think this should be good to go.

@rsmith: Some of the notes now emit `function template` where they only said `function` previously. It seems OK to me, but I would like your sign off on it.


Reviewers: rsmith, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, rsmith

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

llvm-svn: 333485
2018-05-30 01:00:41 +00:00
Yaxun Liu f614422da9 Add HIP toolchain
This patch adds HIP toolchain to support HIP language mode. It includes:

Create specific compiler jobs for HIP.

Choose specific libraries for HIP.

With contribution from Greg Rodgers.

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

llvm-svn: 333484
2018-05-30 00:53:50 +00:00
Yaxun Liu 3af038beec Add action builder for HIP
To support separate compile/link and linking across device IR in different source files,
a new HIP action builder is introduced. Basically it compiles/links host and device
code separately, and embed fat binary in host linking stage through linker script.

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

llvm-svn: 333483
2018-05-30 00:49:10 +00:00
Richard Smith 6ca999baf2 Revert r332839.
This is causing miscompiles and "definition with same mangled name as another
definition" errors.

llvm-svn: 333482
2018-05-30 00:45:10 +00:00
Richard Trieu e69acc5d8f Check pointer null-ness before dereferencing it.
-Warc-repeated-use-of-weak may trigger a segmentation fault when the Decl
being checked is outside of a function scope, leaving the current function
info pointer null.  This adds a check before using the function info.

llvm-svn: 333471
2018-05-29 22:43:00 +00:00
Petr Hosek dd38d93198 [Driver] Rename DefaultTargetTriple to TargetTriple
While this value is initialized with the DefaultTargetTriple, it
can be later overriden using the -target flag so TargetTriple is
a more accurate name. This change also provides an accessor which
could be accessed from ToolChain implementations.

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

llvm-svn: 333468
2018-05-29 22:35:39 +00:00
Akira Hatanaka 1da9dbbc25 [CodeGen][Darwin] Set the calling-convention of thread-local variable
initialization functions to 'cxx_fast_tlscc'.

This fixes a bug where instructions calling initialization functions for
thread-local static members of c++ template classes were using calling
convention 'cxx_fast_tlscc' while the called functions weren't annotated
with the calling convention.

rdar://problem/40447463

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

llvm-svn: 333447
2018-05-29 18:28:49 +00:00
Craig Topper 681b882d4e [X86] Tag some 128/256 load/store instructions as requiring avx512vl instead of avx512f.
llvm-svn: 333446
2018-05-29 18:23:22 +00:00
Nico Weber 7eddafaf12 add test for r332053
llvm-svn: 333423
2018-05-29 14:48:30 +00:00
Rafael Stahl 0137aa8679 [analyzer] const init: handle non-explicit cases more accurately
Summary: If the access is out of bounds, return UndefinedVal. If it is missing an explicit init, return the implicit zero value it must have.

Reviewers: NoQ, xazax.hun, george.karpenkov

Reviewed By: NoQ

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

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

llvm-svn: 333417
2018-05-29 14:14:22 +00:00
David Stenberg d45d7eae05 Fix emission of phony dependency targets when adding extra deps
Summary:
This commit fixes a bug where passing extra dependency entries
(using -fdepfile-entry) would result in -MP incorrectly emitting
a phony target for the input file, and no phony target for the
first extra dependency.

The extra dependencies are added first to the filename vector in
DFGImpl. That clashed with the emission of the phony targets, as
the code assumed that the first index always correspond to the
input file.

Reviewers: rsmith, pcc, krasin, bruno, vsapsai

Reviewed By: vsapsai

Subscribers: vsapsai, bruno, cfe-commits

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

llvm-svn: 333413
2018-05-29 13:07:58 +00:00
Rafael Stahl df55620c3e Testing commit access with whitespace change.
llvm-svn: 333396
2018-05-29 08:12:15 +00:00
Craig Topper 68a272d501 [X86] Merge the 3 different flavors of masked vpermi2var/vpermt2var builtins to a single version without masking. Use select builtins with appropriate operand instead.
llvm-svn: 333387
2018-05-29 03:26:38 +00:00
Shiva Chen f78fc3842f [RISCV] Add -mrelax/-mno-relax flags to enable/disable RISCV linker relaxation
Differential Revision: https://reviews.llvm.org/D44888

llvm-svn: 333385
2018-05-29 00:44:15 +00:00
Gor Nishanov 07ac63f89e [coroutines] Pass implicit object parameter to promise ctor (fix BUG37604)
Summary:
Complete the implementation of p0914r1.
Implicit object parameter should be passed to a promise constructor.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=37604

Reviewers: modocache, rsmith, lewissbaker

Reviewed By: modocache

Subscribers: cfe-commits, EricWF

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

llvm-svn: 333379
2018-05-28 18:08:47 +00:00
Mikhail R. Gadelha 8af2e690f3 Introduces --stats-only option to only show changes in statistics.
llvm-svn: 333375
2018-05-28 15:40:39 +00:00
Fangrui Song 8e4633aa94 [DebugInfo] Fix typo. NFC
llvm-svn: 333352
2018-05-27 07:23:04 +00:00
Craig Topper f99532faee Revert r333347 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible."
This wasn't supposed to be commited yet.

llvm-svn: 333349
2018-05-26 18:57:41 +00:00
Craig Topper 387b1423db [X86] Remove mask from avx512ifma builtins. Use a select instruction instead.
This reduces from 12 builtins to 6 since we no longer need a mask and maskz version.

llvm-svn: 333348
2018-05-26 18:55:26 +00:00
Craig Topper e091523c82 [X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.
Summary:
We only need to use 512 bit vectors all the way through v8i64 reductions since those max instructions are new to avx512f and only available in 512 bits until SKX.

For v16i32 and floating point we have legacy 128/256 bit instructions we can use.

I've tried to use other intrinsics to reduce the verbosity of the code and avoid having to mention all the shuffles. I've also removed all the -1 shuffle indices so the output sequence is fully specified and not left to backend optimization.

Reviewers: RKSimon, spatel, GBuella

Subscribers: cfe-commits

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

llvm-svn: 333347
2018-05-26 18:55:24 +00:00
David Bolvansky 05a9bc176e [ClangDiagnostics] Silence warning about fallthrough after PrintFatalError
Summary:
ClangDiagnosticsEmitter.cpp:1047:57: warning: this statement may fall through [-Wimplicit-fallthrough=]
       Builder.PrintFatalError("Unknown modifier type: " + Modifier);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
ClangDiagnosticsEmitter.cpp:1048:5: note: here
     case MT_Select: {
                   ^

Reviewers: rsmith, rtrieu

Reviewed By: rtrieu

Subscribers: rtrieu, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 333340
2018-05-26 09:24:00 +00:00
George Burgess IV a75c71d13d Test commit; please ignore.
llvm-svn: 333333
2018-05-26 02:29:14 +00:00
Artem Dergachev 8419cf307e [analyzer] Add security checks for bcmp(), bcopy(), bzero().
These functions are obsolete. The analyzer would advice to replace them with
memcmp(), memcpy() or memmove(), or memset().

Patch by Tom Rix!

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

llvm-svn: 333326
2018-05-26 00:04:26 +00:00
George Burgess IV 3514bace27 Fix typo + reflow comment; NFC
Reflow brings said comment below 80 cols

llvm-svn: 333324
2018-05-25 23:40:59 +00:00
Craig Topper dd3b150ed0 [X86] Add const to another builtin that was missed from r331814.
llvm-svn: 333321
2018-05-25 22:52:29 +00:00
Craig Topper 21ae632ab1 [X86] Correct the target features on two avx512bw builtins that were incorrectly labeled as avx512f.
llvm-svn: 333320
2018-05-25 22:43:20 +00:00
Paul Robinson 76178632a2 Revert "[DebugInfo] Don't bother with MD5 checksums of preprocessed files."
This reverts commit d734f2aa3f76fbf355ecd2bbe081d0c1f49867ab.
Also known as r333311.  A very small but nonzero number of bots fail.

llvm-svn: 333319
2018-05-25 22:35:59 +00:00
Craig Topper 91bdddc300 [X86] Mark a few more builtins const that were missed in r331814.
llvm-svn: 333318
2018-05-25 22:07:43 +00:00
Bob Wilson fa84fc916c Support Swift calling convention for PPC64 targets
This adds basic support for the Swift calling convention with PPC64 targets.
Patch provided by Atul Sowani in bug report #37223

llvm-svn: 333316
2018-05-25 21:26:03 +00:00
Paul Robinson 638d606f83 [DebugInfo] Don't bother with MD5 checksums of preprocessed files.
The checksum will not reflect the real source, so there's no clear
reason to include them in the debug info.  Also this was causing a
crash on the DWARF side.

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

llvm-svn: 333311
2018-05-25 20:59:29 +00:00
Petr Hosek f92ca01e42 [Support] Avoid normalization in sys::getDefaultTargetTriple
The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

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

llvm-svn: 333307
2018-05-25 20:39:37 +00:00
Stephane Sezer b6f6192db1 Convert clang-interpreter to ORC JIT API
Summary: This mostly re-uses code from the KaleidoscopeJIT example.

Reviewers: ddunbar, lhames

Reviewed By: lhames

Subscribers: mgrang, alexshap, mgorny, xiaobai, cfe-commits

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

llvm-svn: 333302
2018-05-25 20:23:42 +00:00
Alexey Bataev 0baba9e728 [OPENMP, NVPTX] Fixed codegen for orphaned parallel region.
If orphaned parallel region is found, the next code must be emitted:
```
if(__kmpc_is_spmd_exec_mode() || __kmpc_parallel_level(loc, gtid))
  Serialized execution.
else if (IsMasterThread())
  Prepare and signal worker.
else
  Outined function call.
```

llvm-svn: 333301
2018-05-25 20:16:03 +00:00
JF Bastien 7853d5faab Follow-up fix for nonnull atomic non-member functions
Handling of the third parameter was only checking for *_n and not for the C11 variant, which means that cmpxchg of a 'desired' 0 value was erroneously warning. Handle C11 properly, and add extgensive tests for this as well as NULL pointers in a bunch of places.

Fixes r333246 from D47229.

llvm-svn: 333290
2018-05-25 17:36:49 +00:00
Jonas Hahnfeld 7411d61c03 [Sema] Add tests for weak functions
I found these checks to be missing, just add some simple cases.

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

llvm-svn: 333283
2018-05-25 15:56:12 +00:00
Kristof Umann d5ef4355d9 [analyzer] Added a getLValue method to ProgramState for bases
Differential Revision: https://reviews.llvm.org/D46891

llvm-svn: 333278
2018-05-25 14:48:33 +00:00
Ivan Donchevskii 5b3589b051 Fix members initialization order in constructor (fails with -Werror)
llvm-svn: 333276
2018-05-25 13:46:07 +00:00
Kristof Umann 3ea7442bd6 [analyzer] Added template argument lists to the Pathdiagnostic output
Because template parameter lists were not displayed
in the plist output, it was difficult to decide in
some cases whether a given checker found a true or a
false positive. This patch aims to correct this.

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

llvm-svn: 333275
2018-05-25 13:18:38 +00:00
Ivan Donchevskii b4670fc777 Optionally add code completion results for arrow instead of dot
Currently getting such completions requires source correction, reparsing
and calling completion again. And if it shows no results and rollback is
required then it costs one more reparse.

With this change it's possible to get all results which can be later
filtered to split changes which require correction.

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

llvm-svn: 333272
2018-05-25 12:56:26 +00:00
Gabor Marton b14056b7aa [ASTImporter] Fix ClassTemplateSpecialization in wrong DC
Summary:
ClassTemplateSpecialization is put in the wrong DeclContex if implicitly
instantiated. This patch fixes it.

Reviewers: a.sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 333269
2018-05-25 11:21:24 +00:00
Gabor Buella 078bb99a90 [x86] invpcid intrinsic
An intrinsic for an old instruction, as described in the Intel SDM.

Reviewers: craig.topper, rnk

Reviewed By: craig.topper, rnk

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

llvm-svn: 333256
2018-05-25 06:34:42 +00:00
JF Bastien 7f0a05ada5 Make atomic non-member functions as nonnull
Summary:
As a companion to libc++ patch https://reviews.llvm.org/D47225, mark builtin atomic non-member functions which accept pointers as nonnull.

The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value).

<rdar://problem/18473124>

Reviewers: arphaman

Subscribers: aheejin, cfe-commits

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

llvm-svn: 333246
2018-05-25 00:07:09 +00:00
Richard Smith 1328cf4b8d Improve diagonstic for braced-init-list as operand to ?: expression.
llvm-svn: 333234
2018-05-24 22:02:52 +00:00
Richard Smith 7b301e2410 Switch a couple of users of LangOpts::GNUMode to the more appropriate LangOpts::GNUKeywords.
llvm-svn: 333233
2018-05-24 21:51:52 +00:00
Richard Smith 7a985e1b9f Improve diagnostics for config mismatches with -fmodule-file.
Unless the user uses -Wno-module-file-config-mismatch (or -Wno-error=...),
allow the AST reader to produce errors describing the nature of the config
mismatch.

llvm-svn: 333220
2018-05-24 20:03:51 +00:00
Craig Topper 26df8c48da [X86] Fix a bad cast in _mm512_mask_abs_epi32 and _mm512_maskz_abs_epi32.
llvm-svn: 333211
2018-05-24 17:32:49 +00:00
Ben Langmuir 0486c8c3af [bash-completion] Fix tab separation on macOS
We have a regex that needs to match a tab character in the command
output, but on macOS sed doesn't support '\t', causing it to split on
the 't' character instead. Fix by having bash expand the \t first.

llvm-svn: 333202
2018-05-24 16:25:40 +00:00
Eric Liu 43cb45107e Disable an in-memory vfs file path test on windows.
The test uses unix paths and doesn't make sense to run on windows.

Fix bot failure caused by r333172:
 http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10799

llvm-svn: 333186
2018-05-24 13:52:48 +00:00
Mikhail R. Gadelha 6c4c55ce9e [analyzer] Move RangeSet related declarations into the RangedConstraintManager header.
Summary: I could also move `RangedConstraintManager.h` under `include/` if you agree as it seems slightly out of place under `lib/`.

Patch by Réka Kovács

Reviewers: NoQ, george.karpenkov, dcoughlin, rnkovacs

Reviewed By: NoQ

Subscribers: mikhail.ramalho, whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, dkrupp, cfe-commits

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

llvm-svn: 333179
2018-05-24 12:16:35 +00:00
Eric Liu 33dd619c80 [VFS] Implement getRealPath in InMemoryFileSystem.
Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 333172
2018-05-24 11:17:00 +00:00
Jacek Olesiak 34391f097d [clang-format] Fix putting ObjC message arguments in one line for multiline receiver
Summary:
Reapply reverted changes from D46879.

Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.:
```
[[object block:^{
  return 42;
}] aa:42 bb:42];
```
will be formatted:
```
[[object block:^{
  return 42;
}] aa:42
   bb:42];
```
even though arguments could fit into one line. This change fixes this behavior.

Test Plan:
make -j12 FormatTests && tools/clang/unittests/Format/FormatTests

Reviewers: benhamilton, krasimir

Reviewed By: benhamilton, krasimir

Subscribers: djasper, klimek, cfe-commits

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

llvm-svn: 333171
2018-05-24 10:50:36 +00:00
Hans Wennborg d0a8ad3ac0 Fix ASTImporterTest on Windows after r333082
With MS compatibility, Sema adds an implicit definition of type_info,
which was causing the matchers to return 3 instead of 2.

llvm-svn: 333170
2018-05-24 10:49:38 +00:00
Gabor Marton 1f667535cf [ASTImporter] Add unit tests for structural equivalence
Summary:
This patch add new tests for structural equivalence. For that a new
common header is created which holds the test related language specific
types and functions.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 333166
2018-05-24 08:41:07 +00:00
Gabor Buella 5219ed89be [X86] NFC Include immintrin.h in CodeGen tests
Following r333110:
"Move all Intel defined intrinsic includes into immintrin.h"

llvm-svn: 333160
2018-05-24 07:09:08 +00:00
Daniel Cederman cfba053491 [Sparc] Use the leon arch for Leon3's when using an external assembler
Summary: This allows the use of the casa instruction available in most Leon3's.

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: joerg, fedor.sergeev, jrtc27, cfe-commits

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

llvm-svn: 333157
2018-05-24 06:16:02 +00:00
Eric Christopher 85f0e505e7 Add Builtins.def support for fread and fwrite to ensure that -fno-builtin-
works with them and test accordingly.

llvm-svn: 333156
2018-05-24 06:09:28 +00:00
Eric Christopher c27ad9bbc8 Migrate libcalls-fno-builtin.c test from checking optimized assembly
to checking for attributes on the call site - and fix up builtin
functions that we were testing for but not ensuring wouldn't be
optimized by the backend.

Leave one set of asm tests to make sure that we're also communicating
builtin-ness to TLI.

llvm-svn: 333154
2018-05-24 06:00:50 +00:00
Steven Wu 49d7c2f597 [Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr
Summary:
Remove the call to DiagnoseUseOfDecl in LookupMemberExpr because:
1. LookupMemberExpr eagerly lookup both getter and setter, reguardless
if they are used or not. It causes wrong diagnostics if you are only
using getter.
2. LookupMemberExpr only diagnoses getter, but not setter.
3. ObjCPropertyOpBuilder already DiagnoseUseOfDecl when building getter
and setter. Doing it again in LookupMemberExpr causes duplicated
diagnostics.

rdar://problem/38479756

Reviewers: erik.pilkington, arphaman, doug.gregor

Reviewed By: arphaman

Subscribers: cfe-commits

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

llvm-svn: 333148
2018-05-24 01:01:43 +00:00
Richard Smith 3e268632cf Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

This re-commits r333044 with a fix for PR37560.

llvm-svn: 333141
2018-05-23 23:41:38 +00:00
Richard Smith 08b682bec1 Rework __builtin_classify_type support to better match GCC and to not assert on
unusual types.

Following the observed behavior of GCC, we now return -1 for vector types
(along with all of our extensions that GCC doesn't support), and for atomic
types we classify the underlying type.

GCC appears to have changed its classification for function and array arguments
between version 5 and version 6. Previously it would classify them as pointers
in C and as functions or arrays in C++, but from version 6 onwards, it
classifies them as pointers. We now follow the more recent GCC behavior rather
than emulating what I can only assume to be a historical bug in their C++
support for this builtin.

Finally, no version of GCC that I can find has ever used the "method"
classification for C++ pointers to member functions. Instead, GCC classifies
them as record types, presumably reflecting an internal implementation detail,
but whatever the reason we now produce compatible results.

llvm-svn: 333126
2018-05-23 21:18:00 +00:00
Craig Topper 3e7d8dfae3 [X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h.
This is an AMD intrinsic not an Intel intrinsic so it shouldn't be in immintrin.h

llvm-svn: 333124
2018-05-23 21:04:26 +00:00
Raphael Isemann 83bdfe5e51 [modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual
Summary:
Since clang r332929 these two headers throw errors when included from somewhere else than their wrapper header. It seems marking them as textual is the best way to fix the builds.

Fixes this new module build error:
    While building module '_Builtin_intrinsics' imported from ...:
    In file included from <module-includes>:2:
    In file included from lib/clang/7.0.0/include/immintrin.h:54:
    In file included from lib/clang/7.0.0/include/wmmintrin.h:29:
    lib/clang/7.0.0/include/__wmmintrin_aes.h:25:2: error: "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."
    #error "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."

Reviewers: rsmith, v.g.vassilev, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

llvm-svn: 333123
2018-05-23 20:59:46 +00:00
Craig Topper 664af9bc34 [X86] Move all Intel defined intrinsic includes into immintrin.h
This matches the Intel documentation which shows them available by importing immintrin.h. x86intrin.h also includes immintrin.h so anyone including x86intrin.h will still get them.

This is different than gcc, but I don't think we were a perfect match there already. I'm unclear what gcc's policy is about how they choose which to add things to.

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

llvm-svn: 333110
2018-05-23 18:32:58 +00:00
Artem Belevich 578653a8fc [CUDA] Fixed the list of GPUs supported by CUDA-9.
Differential Revision: https://reviews.llvm.org/D47268

llvm-svn: 333098
2018-05-23 16:45:23 +00:00
Mikhail R. Gadelha feb3146d4b Test Commit. Fix namespace comment
Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
llvm-svn: 333094
2018-05-23 15:49:12 +00:00
Krasimir Georgiev ba917bf053 [clang-format] fix buildbots after r333085
Old gcc versions don't like raw string literals in macros.

llvm-svn: 333092
2018-05-23 15:21:33 +00:00
Gabor Marton a3af567291 [ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl
Summary:
Currently we do not import the implicit CXXRecordDecl of a
ClassTemplateSpecializationDecl. This patch fixes it.

Reviewers: a.sidorin, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 333086
2018-05-23 14:24:02 +00:00
Krasimir Georgiev 0fb19de0c3 [clang-format] Break template declarations followed by comments
Summary:
This patch fixes two bugs in clang-format where the template wrapper doesn't skip over
comments causing a long template declaration to not be split into multiple lines.
These were latent and exposed by r332436.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 333085
2018-05-23 14:18:19 +00:00
Gabor Marton 9581c331d2 Fix duplicate class template definitions problem
Summary:
We fail to import a `ClassTemplateDecl` if the "To" context already
contains a definition and then a forward decl.  This is because
`localUncachedLookup` does not find the definition.  This is not a
lookup error, the parser behaves differently than assumed in the
importer code.  A `DeclContext` contains one DenseMap (`LookupPtr`)
which maps names to lists.  The list is a special list `StoredDeclsList`
which is optimized to have one element.  During building the initial
AST, the parser first adds the definition to the `DeclContext`.  Then
during parsing the second declaration (the forward decl) the parser
again calls `DeclContext::addDecl` but that will not add a new element
to the `StoredDeclsList` rarther it simply overwrites the old element
with the most recent one.  This patch fixes the error by finding the
definition in the redecl chain.  Added tests for the same issue with
`CXXRecordDecl` and with `ClassTemplateSpecializationDecl`.  These tests
pass and they pass because in `VisitRecordDecl` and in
`VisitClassTemplateSpecializationDecl` we already use
`D->getDefinition()` after the lookup.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 333082
2018-05-23 13:53:36 +00:00
Kristof Umann d173caf3bf Test commit
llvm-svn: 333080
2018-05-23 12:48:55 +00:00
Raphael Isemann eb13d3d22e Fix unaligned memory access when reading INPUT_FILE_OFFSETS data
Summary: The blob data is unaligned, so we also should read it as such. Should fix the random failures with the sanitizer builds.

Reviewers: rsmith, v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 333069
2018-05-23 09:02:40 +00:00
Hans Wennborg 156349fa10 Revert r333044 "Use zeroinitializer for (trailing zero portion of) large array initializers"
It caused asserts, see PR37560.

> Use zeroinitializer for (trailing zero portion of) large array initializers
> more reliably.
>
> Clang has two different ways it emits array constants (from InitListExprs and
> from APValues), and both had some ability to emit zeroinitializer, but neither
> was able to catch all cases where we could use zeroinitializer reliably. In
> particular, emitting from an APValue would fail to notice if all the explicit
> array elements happened to be zero. In addition, for large arrays where only an
> initial portion has an explicit initializer, we would emit the complete
> initializer (which could be huge) rather than emitting only the non-zero
> portion. With this change, when the element would have a suffix of more than 8
> zero elements, we emit the array constant as a packed struct of its initial
> portion followed by a zeroinitializer constant for the trailing zero portion.
>
> In passing, I found a bug where SemaInit would sometimes walk the entire array
> when checking an initializer that only covers the first few elements; that's
> fixed here to unblock testing of the rest.
>
> Differential Revision: https://reviews.llvm.org/D47166

llvm-svn: 333067
2018-05-23 08:24:01 +00:00
Ekaterina Romanova 9b412153bf [DOXYGEN] Formatting changes for better intrinsics documentation rendering
(1) I added some \see cross-references to a few select intrinsics that are related (and have the same or similar semantics). 

(2) pmmintrin.h, smmintrin.h, xmmintrin.h have very few minor formatting changes. They make rendering of our intrinsics documentation better. 

llvm-svn: 333065
2018-05-23 06:33:22 +00:00
Craig Topper 9bed2e6953 [X86] Undef the vector reduction helper macros when we're done with them.
These are implementation helper macros we shouldn't expose them to user code if we don't need to.

llvm-svn: 333064
2018-05-23 06:31:36 +00:00
Craig Topper 39e0347e6a [X86] In the floating point max reduction intrinsics, negate infinity before feeding it to set1.
Previously we negated the whole vector after splatting infinity. But its better to negate the infinity before splatting. This generates IR with the negate already folded with the infinity constant.

llvm-svn: 333062
2018-05-23 05:51:52 +00:00
Craig Topper f2043b08b4 [X86] Remove mask argument from more builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.
llvm-svn: 333061
2018-05-23 04:51:54 +00:00
David Carlier 3c90fcebd4 [analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer
Again, strlc* does not return a pointer so the zero size case doest not fit.

Reviewers: NoQ, george.karpenkov

Reviewed by: NoQ

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

llvm-svn: 333060
2018-05-23 04:38:25 +00:00
David Carlier 5764db4e57 This is a test commit.
llvm-svn: 333059
2018-05-23 04:27:39 +00:00
Alex Lorenz 5a5a654165 [AST][ObjC] Print implicit property expression that only has a setter without crashing
rdar://40447209

llvm-svn: 333046
2018-05-23 00:52:20 +00:00
Richard Smith 9062bbf419 Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

Clang has two different ways it emits array constants (from InitListExprs and
from APValues), and both had some ability to emit zeroinitializer, but neither
was able to catch all cases where we could use zeroinitializer reliably. In
particular, emitting from an APValue would fail to notice if all the explicit
array elements happened to be zero. In addition, for large arrays where only an
initial portion has an explicit initializer, we would emit the complete
initializer (which could be huge) rather than emitting only the non-zero
portion. With this change, when the element would have a suffix of more than 8
zero elements, we emit the array constant as a packed struct of its initial
portion followed by a zeroinitializer constant for the trailing zero portion.

In passing, I found a bug where SemaInit would sometimes walk the entire array
when checking an initializer that only covers the first few elements; that's
fixed here to unblock testing of the rest.

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

llvm-svn: 333044
2018-05-23 00:09:29 +00:00
Sanjay Patel 74c7fb002f [CodeGen] use nsw negation for builtin abs
The clang builtins have the same semantics as the stdlib functions.
The stdlib functions are defined in section 7.20.6.1 of the C standard with:
"If the result cannot be represented, the behavior is undefined."

That lets us mark the negation with 'nsw' because "sub i32 0, INT_MIN" would
be UB/poison.

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

llvm-svn: 333038
2018-05-22 23:02:13 +00:00
Craig Topper 25caca72f4 [X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsics into f16cintrin.h and remove __emmintrin_f16c.h
These were included in emmintrin.h to match Intel Intrinsics Guide documentation. But this is because icc is capable of emulating them on targets that don't support F16C using library calls. Clang/LLVM doesn't have this emulation support. So it makes more sense to include them in immintrin.h instead.

I've left a comment behind to hopefully deter someone from trying to move them again in the future.

llvm-svn: 333033
2018-05-22 22:19:19 +00:00
Craig Topper 8e3689c066 [X86] Remove mask argument from some builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.
llvm-svn: 333027
2018-05-22 20:48:24 +00:00
Craig Topper 99be40c363 [X86] Another attempt at fixing the intrinsic module map for rr333014.
llvm-svn: 333026
2018-05-22 20:48:20 +00:00
Craig Topper 1fceff99d8 [X86] Add two missing #endif directives to immintrin.h that should have been in r333014.
llvm-svn: 333023
2018-05-22 20:33:04 +00:00
Craig Topper a82ee182d4 [X86] Add __emmintrin_f16c.h to module map and CMakeLists.
I missed this in r333014

llvm-svn: 333020
2018-05-22 20:19:05 +00:00
Craig Topper 34c8c0d858 [X86] Move 128-bit f16c intrinsics to __emmintrin_f16c.h include from emmintrin.h. Move 256-bit f16c intrinsics back to f16cintrin.h
Intel documents the 128-bit versions as being in emmintrin.h and the 256-bit version as being in immintrin.h.

This patch makes a new __emmtrin_f16c.h to hold the 128-bit versions to be included from emmintrin.h. And makes the existing f16cintrin.h contain the 256-bit versions and include it from immintrin.h with an error if its included directly.

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

llvm-svn: 333014
2018-05-22 18:54:19 +00:00
Peter Collingbourne 91d02844a3 Reland r332885, "CodeGen, Driver: Start using direct split dwarf emission in clang."
As well as two follow-on commits r332906, r332911 with a fix for
test clang/test/CodeGen/split-debug-filename.c.

llvm-svn: 333013
2018-05-22 18:52:37 +00:00
Jacek Olesiak f51ce777e3 Revert "[clang-format] Fix putting ObjC message arguments in one line for multiline receiver"
Summary: Reverts D46879

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: krasimir, klimek, cfe-commits

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

llvm-svn: 332998
2018-05-22 16:44:42 +00:00
Yaxun Liu 00ddbed298 Revert r332982 Call CreateTempMemWithoutCast for ActiveFlag
Due to regression on arm.

llvm-svn: 332991
2018-05-22 16:13:07 +00:00
Sanjay Patel 1ff6b27940 [CodeGen] produce the LLVM canonical form of abs
We chose the 'slt' form as canonical in IR with:
rL332819
...so we should generate that form directly for efficiency.

llvm-svn: 332989
2018-05-22 15:36:50 +00:00
Sanjay Patel b6e5d4ead1 [CodeGen] add tests for abs builtins; NFC
llvm-svn: 332988
2018-05-22 15:11:59 +00:00
Yaxun Liu 8a60e5db70 Call CreateTempMemWithoutCast for ActiveFlag
Introduced CreateMemTempWithoutCast and CreateTemporaryAllocaWithoutCast to emit alloca
without casting to default addr space.

ActiveFlag is a temporary variable emitted for clean up. It is defined as AllocaInst* type and there is
a cast to AlllocaInst in SetActiveFlag. An alloca casted to generic pointer causes assertion in
SetActiveFlag.

Since there is only load/store of ActiveFlag, it is safe to use the original alloca, therefore use
CreateMemTempWithoutCast is called.

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

llvm-svn: 332982
2018-05-22 14:36:26 +00:00
Brock Wyma 8557ec5d64 [CodeView] Enable debugging of captured variables within C++ lambdas
This change will help Visual Studio resolve forward references to C++ lambda
routines used by captured variables.

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

llvm-svn: 332975
2018-05-22 12:41:19 +00:00
Krasimir Georgiev 067ec70d4f [clang-format] Add a test case for crash
llvm-svn: 332974
2018-05-22 11:44:03 +00:00
Amara Emerson f528bcc32a Revert "CodeGen, Driver: Start using direct split dwarf emission in clang."
This reverts commit r332885 as it broke several greendragon buildbots.

llvm-svn: 332973
2018-05-22 11:18:58 +00:00
Amara Emerson b6aa52a1c4 Revert "Fix another make_unique ambiguity."
This reverts commit r332906 as a dependency to revert r332885.

llvm-svn: 332972
2018-05-22 11:18:49 +00:00
Amara Emerson 9505fe5356 Revert "Add missing x86-registered-target."
This reverts commit r332911, as a dependency to revert r332885.

llvm-svn: 332971
2018-05-22 11:18:43 +00:00
Martin Probst 7ebad4ea81 clang-format: [JS] do not wrap before any `is`.
Summary:
`is` type annotations can occur at any nesting level. For example:

    function x() {
      return function y(): a is B { ... };
    }

Breaking before the `is` above breaks TypeScript parsing the code. This
change prevents the wrap.

Reviewers: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 332968
2018-05-22 10:39:07 +00:00
David Chisnall 48a7afa5a1 [objc-gnustep2] Use unsigned char to avoid potential UB in isalnum.
Suggested by Gabor Buella.

llvm-svn: 332966
2018-05-22 10:13:17 +00:00
David Chisnall 45d0a2650e [objc-gnu] Fix test.
The test was implicitly capturing the local filesystem layout.

Patch by Hans Wennborg!

llvm-svn: 332965
2018-05-22 10:13:14 +00:00
David Chisnall 88e754f57d [objc-gnustep2] Use isalnum instead of a less efficient and nonportable equivalent.
Patch by Hans Wennborg!

llvm-svn: 332964
2018-05-22 10:13:11 +00:00
David Chisnall 404bbcbdcb Revert "Revert r332955 "GNUstep Objective-C ABI version 2""
llvm-svn: 332963
2018-05-22 10:13:06 +00:00
Krasimir Georgiev f163bdc07e [clang-format] Fix crash in getLengthToMatchingParen
Summary:
Found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8212

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 332961
2018-05-22 09:46:55 +00:00
Bjorn Pettersson 844663353d Revert r332955 "GNUstep Objective-C ABI version 2"
Reverted due to buildbot failures.
Seems like isnumber() is some Apple addition to cctype.

llvm-svn: 332957
2018-05-22 08:16:45 +00:00
David Chisnall 7c6cd52698 Add cctype include.
This appears to leak in already on libc++ platforms, but is breaking on
some other targets.

llvm-svn: 332955
2018-05-22 07:22:50 +00:00
David Chisnall 79356eefc0 GNUstep Objective-C ABI version 2
Summary:
This includes initial support for the (hopefully final) updated Objective-C ABI, developed here:

https://github.com/davidchisnall/clang-gnustep-abi-2

It also includes some cleanups and refactoring from older GNU ABIs.

The current version is ELF only, other formats to follow.

Reviewers: rjmccall, DHowett-MSFT

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

llvm-svn: 332950
2018-05-22 06:09:23 +00:00
Craig Topper d97a95ae2c [X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without including wmmintrin.h
llvm-svn: 332929
2018-05-22 02:02:13 +00:00
Raphael Isemann 456d43b98b Add missing include for cstdint to Visibility.h
Summary: We use uint8_t in this header, so we need to include cstdint.

Subscribers: cfe-commits

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

llvm-svn: 332913
2018-05-21 22:27:22 +00:00
Peter Collingbourne ed05e2336d Add missing x86-registered-target.
llvm-svn: 332911
2018-05-21 22:14:02 +00:00
Craig Topper 9efb77e25f [X86] Remove a builtin that should have been removed in r332882.
llvm-svn: 332909
2018-05-21 22:10:02 +00:00
Peter Collingbourne 0322e3cbf5 Fix another make_unique ambiguity.
llvm-svn: 332906
2018-05-21 21:48:17 +00:00
Craig Topper 288bd2e5a0 [X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.
Because the intrinsics in the headers are implemented as macros, we can't just use a select builtin and pternlog builtin. This would require one of the macro arguments to be used twice. Depending on what was passed to the macro we could expand an expression twice leading to weird behavior. We could maybe declare our local variable in the macro, but that would need to worry about name collisions.

To avoid that just generate IR directly in CGBuiltin.cpp.

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

llvm-svn: 332891
2018-05-21 20:58:23 +00:00
Richard Smith 3f1d6de4f7 Revert r332847; it caused us to miscompile certain forms of reference initialization.
llvm-svn: 332886
2018-05-21 20:36:58 +00:00
Peter Collingbourne 47bc01786d CodeGen, Driver: Start using direct split dwarf emission in clang.
Fixes PR37466.

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

llvm-svn: 332885
2018-05-21 20:31:59 +00:00
Craig Topper 842171de36 [X86] Use __builtin_convertvector to implement some of the packed integer to packed float conversion intrinsics.
I believe this is safe assuming default default FP environment. The conversion might be inexact, but it can never overflow the FP type so this shouldn't be undefined behavior for the uitofp/sitofp instructions.

We already do something similar for scalar conversions.

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

llvm-svn: 332882
2018-05-21 20:19:17 +00:00
Peter Collingbourne 9a45114b3c CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.
Part of PR37466.

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

llvm-svn: 332881
2018-05-21 20:16:41 +00:00
Richard Smith bbb2655de0 Revert r332028; see PR37545 for details.
llvm-svn: 332879
2018-05-21 20:10:54 +00:00
Mark Searles bcf611ab36 [Clang Tablegen] Add llvm_unreachable() to getModifierName()
Fix internal build failure:

../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o
../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef
{anonymous}::getModifierName({anonymous}::ModifierType)':
../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8

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

llvm-svn: 332854
2018-05-21 17:29:08 +00:00
Alexey Bataev 66f9577f09 [OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.
if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be
  defined. If `-fopenmp-simd` is specified along with the `-fopenmp`,
  `_OPENMP` macro should be defined with the value `201511`.

llvm-svn: 332852
2018-05-21 16:40:32 +00:00
Daniil Fukalov 1b14a3ad3d [AMDGPU] fixes for lds f32 builtins
1. added restrictions to memory scope, order and volatile parameters
2. added custom processing for these builtins - currently is not used code,
   needed to switch off GCCBuiltin link to the builtins (ongoing change to llvm
   tree)
3. builtins renamed as requested

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

llvm-svn: 332848
2018-05-21 16:18:07 +00:00
Serge Pavlov 9f8068420a [CodeGen] Recognize more cases of zero initialization
If a variable has an initializer, codegen tries to build its value. If
the variable is large in size, building its value requires substantial
resources. It causes strange behavior from user viewpoint: compilation
of huge zero initialized arrays like:

    char data_1[2147483648u] = { 0 };

consumes enormous amount of time and memory.

With this change codegen tries to determine if variable initializer is
equivalent to zero initializer. In this case variable value is not
constructed.

This change fixes PR18978.

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

llvm-svn: 332847
2018-05-21 16:09:54 +00:00
Momchil Velikov fe76b36ab1 [Sema] Fix incorrect packed aligned structure layout
Handle attributes before checking the record layout (e.g. underalignment check
during `alignas` processing), as layout may be cached without taking into
account attributes that may affect it.

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

llvm-svn: 332843
2018-05-21 14:28:43 +00:00
Pavel Labath b3b0255df9 [CodeGen] Disable aggressive structor optimizations at -O0, take 2
The first version of the patch (r332228) was flawed because it was
putting structors into C5/D5 comdats very eagerly. This is correct only
if we can ensure the comdat contains all required versions of the
structor (which wasn't the case). This version uses a more nuanced
approach:
- for local structor symbols we use an alias because we don't have to
  worry about comdats or other compilation units.
- linkonce symbols are emitted separately, as we cannot guarantee we
  will have all symbols we need to form a comdat (they are emitted
  lazily, only when referenced).
- available_externally symbols are also emitted separately, as the code
  seemed to be worried about emitting an alias in this case.
- other linkage types are not affected by the optimization level. They
  either get put into a comdat (weak) or get aliased (external).

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

llvm-svn: 332839
2018-05-21 11:47:45 +00:00
Craig Topper 092d42557b [X86] Remove some preprocessor feature checks from intrinsic headers
Summary:
These look to be a couple things that weren't removed when we switched to target attribute.

The popcnt makes including just smmintrin.h also include popcntintrin.h. The popcnt file itself already contains target attrributes.

The prefetch ones are just wrappers around __builtin_prefetch which we have graceful fallbacks for in the backend if the exact instruction isn't available. So there's no reason to hide them. And it makes them available in functions that have the write target attribute but not a -march command line flag.

Reviewers: echristo, RKSimon, spatel, DavidKreitzer

Reviewed By: echristo

Subscribers: cfe-commits

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

llvm-svn: 332830
2018-05-21 06:07:49 +00:00
Craig Topper ecbd12dd09 [X86] Remove some unused builtins.
These were upgraded to native shufflevectors months ago.

llvm-svn: 332829
2018-05-21 03:36:57 +00:00
Craig Topper 55b4067350 [X86] Remove mask arguments from permvar builtins/intrinsics. Use a select in IR instead.
Someday maybe we'll use selects for all the builtins.

llvm-svn: 332825
2018-05-20 23:34:10 +00:00
Nico Weber 5062e4b1ae Revert 332750, clang part (see comment on D46910).
llvm-svn: 332822
2018-05-20 23:02:20 +00:00
Saleem Abdulrasool 278e1c460b Sema: diagnose invalid catch parameter in ObjC
Ensure that the type being used has an associated interface when
declaring the parameter for `@catch`.

Resolves PR37384!

llvm-svn: 332821
2018-05-20 19:26:44 +00:00
Vassil Vassilev da31c93794 Print the qualified name when dumping deserialized decls.
This is useful to understand and debug the lazy template specializations
used in the pch and modules.

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

llvm-svn: 332817
2018-05-20 09:38:52 +00:00
Brian Gesiak 0a0a4d7785 [Driver] Temporarily remove test for LLVM findNearest
Summary:
This fixes a failure caused by the revert of https://reviews.llvm.org/rL332805.

llvm-svn: 332806
2018-05-19 12:44:02 +00:00
Brian Gesiak bc86c980cf [Driver] Loosen test for LLVM findNearest
Summary:
When https://reviews.llvm.org/D46776 landed to improve the behavior of
`llvm::OptTable::findNearest`, a PS4 buildbot began failing due to an
assertion that a suggestion "-debug-info-macro" should be provided for
the unrecognized option `clang -cc1as -debug-info-macros`. All other
buildbots succeeded in this check, and the PS4 buildbot succeeded in the
other `findNearest` tests.

Temporarily loosen this check in order to reland the `findNearest`
change.

Test Plan: check-clang

llvm-svn: 332804
2018-05-19 11:46:58 +00:00
JF Bastien 6b23972f07 CodeGen: block capture shouldn't ICE
When a lambda capture captures a __block in the same statement, the compiler asserts out because isCapturedBy assumes that an Expr can only be a BlockExpr, StmtExpr, or if it's a Stmt then all the statement's children are expressions. That's wrong, we need to visit all sub-statements even if they're not expressions to see if they also capture.

Fix this issue by pulling out the isCapturedBy logic to use RecursiveASTVisitor.

<rdar://problem/39926584>

llvm-svn: 332801
2018-05-19 04:21:26 +00:00
Eric Fiselier fcd50538c2 Adjust and fix failing CXX tests after r332799
llvm-svn: 332800
2018-05-19 03:33:56 +00:00
Eric Fiselier b87be18d8e [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.
Summary:
There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now!

This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted.

The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example:

```
def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">;
```
when used as
```
"candidate `%sub{select_ovl_candidate}3,2,1 not viable"
```
will act as if we wrote:
```
"candidate %select{function|constructor}3%select{| template| %1}2 not viable"
```

Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 332799
2018-05-19 03:12:04 +00:00
Sunil Srivastava 2ada2499ea Do not enable RTTI with -fexceptions, for PS4
NFC for targets other than PS4.

This patch is a change in behavior for PS4, in that PS4 will no longer enable
RTTI when -fexceptions is specified (RTTI and Exceptions are disabled by default
on PS4). RTTI will remain disabled except for types being thrown or caught.
Also, '-fexceptions -fno-rtti' (previously prohibited on PS4) is now accepted,
as it is for other targets.

This patch removes some PS4 specific code, making the code cleaner.

Also, in the test file rtti-options.cpp, PS4 tests where the behavior is the
same as the generic x86_64-linux are removed, making the test cleaner.

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

llvm-svn: 332784
2018-05-18 23:32:01 +00:00
Shoaib Meenai 364741de30 [test] Fix run line to use correct triple
objc_begin_catch/objc_end_catch are specific to the Itanium ABI, so we
should be using an Itanium triple for this test.

Additionally, while I'm here, convert the run line to invoke the
compiler directly rather than going through the driver.

llvm-svn: 332777
2018-05-18 21:59:29 +00:00
Douglas Yung d40bc5f788 Maintain PS4 ABI compatibility by making the fix made in r331136 not apply when the target is the PS4.
Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 332773
2018-05-18 21:51:46 +00:00
Richard Smith fb50dd34ed Revert r332470 (and corresponding tests in r332492).
This regressed our support for __attribute__((section)). See added test file
for example of code broken by this.

llvm-svn: 332760
2018-05-18 20:18:17 +00:00
Peter Collingbourne e3f652973e Support: Simplify endian stream interface. NFCI.
Provide some free functions to reduce verbosity of endian-writing
a single value, and replace the endianness template parameter with
a field.

Part of PR37466.

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

llvm-svn: 332757
2018-05-18 19:46:24 +00:00
Eric Liu 1edf4bc68c Revert "Move #include manipulation code to new lib/Tooling/Inclusions."
This reverts commit r332720. This break build bot with modules. Need to
investigate. Revert the change to unbreak bots.

llvm-svn: 332751
2018-05-18 18:33:08 +00:00
Petr Hosek 24b61ac832 [Support] Avoid normalization in sys::getDefaultTargetTriple
The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

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

llvm-svn: 332750
2018-05-18 18:33:07 +00:00
Peter Collingbourne f7b81db715 MC: Change the streamer ctors to take an object writer instead of a stream. NFCI.
The idea is that a client that wants split dwarf would create a
specific kind of object writer that creates two files, and use it to
create the streamer.

Part of PR37466.

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

llvm-svn: 332749
2018-05-18 18:26:45 +00:00
Craig Topper b809fc3d63 [X86] Fix a bad cast from mask16 to mask8 in _mm256_mask_cvtepi16_epi8 introduced in r332266.
llvm-svn: 332738
2018-05-18 17:18:46 +00:00
Eric Liu 7112fe63ec Fix unused variable warning in r332724
llvm-svn: 332734
2018-05-18 16:29:42 +00:00