platform/upstream/llvm.git
6 years agoPerform a bounds check on a function's argument list before accessing any index value...
Aaron Ballman [Wed, 29 Nov 2017 23:10:14 +0000 (23:10 +0000)]
Perform a bounds check on a function's argument list before accessing any index value specified by an 'argument_with_type_tag' attribute. Fixes PR28520.

Patch by Matt Davis.

llvm-svn: 319383

6 years ago[X86] Remove some questionable looking code that seems to be looking through a VZEXT...
Craig Topper [Wed, 29 Nov 2017 23:08:25 +0000 (23:08 +0000)]
[X86] Remove some questionable looking code that seems to be looking through a VZEXT to create a larger VSEXT.

If the input the vzext was signed this would do the wrong thing.

Not sure how to test this.

llvm-svn: 319382

6 years agoFirst step towards more human-friendly PPC assembler output:
Joerg Sonnenberger [Wed, 29 Nov 2017 23:05:56 +0000 (23:05 +0000)]
First step towards more human-friendly PPC assembler output:
- add -ppc-reg-with-percent-prefix option to use %r3 etc as register
  names
- split off logic for Darwinish verbose conditional codes into a helper
  function
- be explicit about Darwin vs AIX vs GNUish assembler flavors

Based on the patch from Alexandre Yukio Yamashita

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

llvm-svn: 319381

6 years ago[WebAssembly] Update test expectations for gcc torture tests
Sam Clegg [Wed, 29 Nov 2017 23:05:50 +0000 (23:05 +0000)]
[WebAssembly] Update test expectations for gcc torture tests

I believe these were recently fixed by:
https://reviews.llvm.org/rL319186

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

llvm-svn: 319380

6 years agoMake kmp_r_sched_t into a union
Jonathan Peyton [Wed, 29 Nov 2017 22:47:52 +0000 (22:47 +0000)]
Make kmp_r_sched_t into a union

This change makes kmp_r_sched_t type into a union for simpler
comparisons and assignments

Patch by Terry Wilmarth

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

llvm-svn: 319379

6 years agoUse Symbol::File directly.
Rafael Espindola [Wed, 29 Nov 2017 22:47:35 +0000 (22:47 +0000)]
Use Symbol::File directly.

We are already paying the cost of storing a InputFile in every
Symbol, so use it uniformly.

llvm-svn: 319378

6 years ago[CodeView] Factor some code out of TypeTableBuilder.
Zachary Turner [Wed, 29 Nov 2017 22:41:56 +0000 (22:41 +0000)]
[CodeView] Factor some code out of TypeTableBuilder.

This class had some code that would automatically remap type
indices before hashing and serializing.  The only caller of
this method was the TypeStreamMerger anyway, and the method
doesn't make general sense, and prevents making certain future
improvements to the class.  So, factoring this up one level
into the TypeStreamMerger where it belongs.

llvm-svn: 319377

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 29 Nov 2017 22:39:22 +0000 (22:39 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 319376

6 years agoFix aligned memory allocation in the stub library
Jonathan Peyton [Wed, 29 Nov 2017 22:29:38 +0000 (22:29 +0000)]
Fix aligned memory allocation in the stub library

kmp_aligned_malloc() always returned NULL on Windows (stub library only)
that may cause Fortran application crash.  With this change all memory
allocation functions were fixed to use aligned{m,re,rec}alloc() to
allocate/reallocate memory. To deallocate that memory _aligned_free() is
used in kmp_free().

Patch by Olga Malysheva

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

llvm-svn: 319375

6 years agoWarning is emitted when tiles are requested but cannot be used
Jonathan Peyton [Wed, 29 Nov 2017 22:27:18 +0000 (22:27 +0000)]
Warning is emitted when tiles are requested but cannot be used

Added two warnings:
1) Before building the topology map check if tiles are requested but the
   topo method is not hwloc;
2) After building the topology map check if tiles are requested but not
   detected by the library.

Patch by Olga Malysheva

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

llvm-svn: 319374

6 years ago[Coverage] Emit gap areas in braces-optional statements (PR35387)
Vedant Kumar [Wed, 29 Nov 2017 22:25:14 +0000 (22:25 +0000)]
[Coverage] Emit gap areas in braces-optional statements (PR35387)

Emit a gap area starting after the r-paren location and ending at the
start of the body for the braces-optional statements (for, for-each,
while, etc). The count for the gap area equal to the body's count. This
extends the fix in r317758.

Fixes PR35387, rdar://35570345

Testing: stage2 coverage-enabled build of clang, check-clang
llvm-svn: 319373

6 years agoFix types of Fortran array elements
Jonathan Peyton [Wed, 29 Nov 2017 22:23:44 +0000 (22:23 +0000)]
Fix types of Fortran array elements

Fortran array elements made default integer in OMP_GET_PLACE_PROC_IDS and
OMP_GET_PARTITION_PLACE_NUMS subroutines, otherwise call to them produces
incorrect result.

Patch by Olga Malysheva

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

llvm-svn: 319372

6 years agoUse llvm::StringSet instead of std::set.
Rui Ueyama [Wed, 29 Nov 2017 22:21:37 +0000 (22:21 +0000)]
Use llvm::StringSet instead of std::set.

std::set is pretty slow. We generally prefer llvm::StringSet if we don't
need an sorted set.

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

llvm-svn: 319371

6 years agoSimplify. NFC.
Rafael Espindola [Wed, 29 Nov 2017 22:20:03 +0000 (22:20 +0000)]
Simplify. NFC.

llvm-svn: 319370

6 years ago[Documentation] Sort Clang-tidy changes next way: new modules, new checks, renamed...
Eugene Zelenko [Wed, 29 Nov 2017 22:17:39 +0000 (22:17 +0000)]
[Documentation] Sort Clang-tidy changes next way: new modules, new checks, renamed checks, extended checks, new check aliases.

Sort checks in each section alphabetically.

llvm-svn: 319369

6 years ago[SelectionDAG][X86] Teach promotion legalization for fp_to_sint/fp_to_uint to insert...
Craig Topper [Wed, 29 Nov 2017 22:15:43 +0000 (22:15 +0000)]
[SelectionDAG][X86] Teach promotion legalization for fp_to_sint/fp_to_uint to insert an assertsext/assertzext based on the original type

If we put in an assertsext/zext here, we're able to generate better truncate code using pack on pre-avx512 targets.

Similar is already done during type legalization. This is the equivalent for op legalization

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

llvm-svn: 319368

6 years agoDon't crash on broken debug info.
Rafael Espindola [Wed, 29 Nov 2017 22:09:16 +0000 (22:09 +0000)]
Don't crash on broken debug info.

llvm-svn: 319367

6 years ago[XRay][compiler-rt][Darwin] Use dynamic initialisation as an alternative
Dean Michael Berris [Wed, 29 Nov 2017 22:06:12 +0000 (22:06 +0000)]
[XRay][compiler-rt][Darwin] Use dynamic initialisation as an alternative

Summary:
In cases where we can't use the .preinit_array section (as in Darwin for
example) we instead use dynamic initialisation. We know that this
alternative approach will race with the initializers of other objects at
global scope, but this is strictly better than nothing.

Reviewers: kubamracek, nglevin

Subscribers: llvm-commits

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

llvm-svn: 319366

6 years ago[sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib from...
Kuba Mracek [Wed, 29 Nov 2017 21:42:48 +0000 (21:42 +0000)]
[sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib from DYLD_INSERT_LIBRARIES

On macOS, we usually don't require launching the target with DYLD_INSERT_LIBRARIES anymore. However, it is still necessary when running a target that is not instrumented (and e.g. dlopen's an instrument library later). In any case, ASan and TSan currently remove themselves from the DYLD_INSERT_LIBRARIES environment variable to avoid passing it onto children. This works well e.g. when instrumenting a shell. A problem arises when the target is a non-instrumented shim (e.g. "xcrun") that either re-execs or launches a child that is supposed to get DYLD_INSERT_LIBRARIES propagated. To support this mode, this patch introduces 'strip_env' flag that can be used to keep DYLD_INSERT_LIBRARIES untouched.

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

llvm-svn: 319365

6 years agoReformat switch statement added in r319297, NFC
Reid Kleckner [Wed, 29 Nov 2017 21:36:00 +0000 (21:36 +0000)]
Reformat switch statement added in r319297, NFC

llvm-svn: 319364

6 years ago[EH] Use __CxxFrameHandler3 for C++ EH in MS environments
Reid Kleckner [Wed, 29 Nov 2017 21:35:34 +0000 (21:35 +0000)]
[EH] Use __CxxFrameHandler3 for C++ EH in MS environments

Fixes regression introduced by r319297. MSVC environments still use SEH
unwind opcodes but they should use the Microsoft C++ EH personality, not
the mingw one.

llvm-svn: 319363

6 years ago[OPENMP] Allow only loop control variables in distribute simd
Alexey Bataev [Wed, 29 Nov 2017 21:31:48 +0000 (21:31 +0000)]
[OPENMP] Allow only loop control variables in distribute simd
directives.

According to the OpenMP standard, only loop control variables can be
used in linear clauses of distribute-based simd directives.

llvm-svn: 319362

6 years agoReplace a dyn_cast with a cast. NFC.
Rafael Espindola [Wed, 29 Nov 2017 21:29:52 +0000 (21:29 +0000)]
Replace a dyn_cast with a cast. NFC.

llvm-svn: 319361

6 years agoAdd the hasDefinition() AST matcher to match class declarations that also have a...
Aaron Ballman [Wed, 29 Nov 2017 21:21:51 +0000 (21:21 +0000)]
Add the hasDefinition() AST matcher to match class declarations that also have a definition.

Patch by Julie Hockett.

llvm-svn: 319360

6 years agorefactor: Unify+simplify DWARFCompileUnit ctor+Clear() into in-class initializers...
Jan Kratochvil [Wed, 29 Nov 2017 21:13:11 +0000 (21:13 +0000)]
refactor: Unify+simplify DWARFCompileUnit ctor+Clear() into in-class initializers + Extract()

It has no functionality effect.

I was concerned about the worse performance of DWARFDebugInfo::Parse this way
of allocating+destroying a CU for each iteration but I see it is now used only
by DWARFDebugInfo::Dump so that is no longer a problem.

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

llvm-svn: 319359

6 years ago[SourceLocations] Use stronger sort predicate to remove non-deterministic ordering
Mandeep Singh Grang [Wed, 29 Nov 2017 20:55:13 +0000 (20:55 +0000)]
[SourceLocations] Use stronger sort predicate to remove non-deterministic ordering

Summary:
This fixes the following failure uncovered by D39245:
  Clang :: Index/getcursor-preamble.m

Reviewers: gbenyei, akyrtzi, bkramer, arphaman

Reviewed By: arphaman

Subscribers: arphaman, cfe-commits

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

llvm-svn: 319357

6 years ago[LLD] [COFF] Support ENTRY and SUBSYSTEM in .drectve sections
Rui Ueyama [Wed, 29 Nov 2017 20:46:13 +0000 (20:46 +0000)]
[LLD] [COFF] Support ENTRY and SUBSYSTEM in .drectve sections

Adds support for "/ENTRY" and "/SUBSYSTEM" linker options in .drectve
sections. Some Mozilla binaries were using these directives and MSVC
link.exe appears to allow them. No attempt is made to reconcile these
with the options on the command line.

Patch by David Major!

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

llvm-svn: 319356

6 years agoRemove `else` or `break` after `fatal`. NFC.
Rui Ueyama [Wed, 29 Nov 2017 20:45:58 +0000 (20:45 +0000)]
Remove `else` or `break` after `fatal`. NFC.

fatal() does not return, so we don't need `else` or `break` after a call
of fatal.

llvm-svn: 319355

6 years ago[WebAssembly] Fix fptoui lowering bounds
Dan Gohman [Wed, 29 Nov 2017 20:20:11 +0000 (20:20 +0000)]
[WebAssembly] Fix fptoui lowering bounds

To fully avoid trapping on wasm, fptoui needs a second check to ensure that
the operand isn't below the supported range.

llvm-svn: 319354

6 years agoAdd libstd++-4.8 exceptions to ubsan_blacklist.txt
Sam Clegg [Wed, 29 Nov 2017 20:10:14 +0000 (20:10 +0000)]
Add libstd++-4.8 exceptions to ubsan_blacklist.txt

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

llvm-svn: 319353

6 years ago[Hexagon] Remove HexagonISD::PACKHL
Krzysztof Parzyszek [Wed, 29 Nov 2017 19:59:29 +0000 (19:59 +0000)]
[Hexagon] Remove HexagonISD::PACKHL

llvm-svn: 319352

6 years ago[Hexagon] Create helpers extractVector and insertVector in lowering
Krzysztof Parzyszek [Wed, 29 Nov 2017 19:58:10 +0000 (19:58 +0000)]
[Hexagon] Create helpers extractVector and insertVector in lowering

llvm-svn: 319351

6 years ago[scudo] Allow for compile-time choice of the SizeClassMap
Kostya Kortchinsky [Wed, 29 Nov 2017 19:52:09 +0000 (19:52 +0000)]
[scudo] Allow for compile-time choice of the SizeClassMap

Summary:
With this change, we allow someone to chose the `SizeClassMap` they want to use
at compile time via a define.

I feel somewhat unimaginative with the name of the defines, so if someone has a
better idea, let me know. I have been alternating between those and
`SCUDO_USE_xxx_SIZECLASSMAP` which is clearer but also longer. The issue with
those is that it wouldn't be consistent with `SCUDO_TSD_EXCLUSIVE` that should
probably become `SCUDO_USE_EXCLUSIVE_TSD` maybe?

Anyway, naming is hard, and I am not sure what makes more sense!

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: llvm-commits, srhines

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

llvm-svn: 319350

6 years ago[compiler-rt] Switch from deprecated TARGET_IPHONE_SIMULATOR to TARGET_OS_SIMULATOR
Kuba Mracek [Wed, 29 Nov 2017 19:47:14 +0000 (19:47 +0000)]
[compiler-rt] Switch from deprecated TARGET_IPHONE_SIMULATOR to TARGET_OS_SIMULATOR

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

llvm-svn: 319349

6 years ago[asan] Fix macOS FindDynamicShadowStart to consider the last gap in the VM map
Kuba Mracek [Wed, 29 Nov 2017 19:44:52 +0000 (19:44 +0000)]
[asan] Fix macOS FindDynamicShadowStart to consider the last gap in the VM map

It looks FindDynamicShadowStart has a bug: When iterating over the memory map, we will not consider the very last gap in the address space. Let's fix that.

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

llvm-svn: 319348

6 years ago[asan] Don't crash on fclose(NULL)
Kuba Mracek [Wed, 29 Nov 2017 19:43:11 +0000 (19:43 +0000)]
[asan] Don't crash on fclose(NULL)

It's explicitly forbidden to call fclose with NULL, but at least on Darwin, this succeeds and doesn't segfault. To maintain binary compatibility, ASan should survice fclose(NULL) as well.

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

llvm-svn: 319347

6 years ago[X86][AVX512] Tag RCP/RSQRT/GETEXP instructions scheduler classes (REVERSION)
Simon Pilgrim [Wed, 29 Nov 2017 19:37:38 +0000 (19:37 +0000)]
[X86][AVX512] Tag RCP/RSQRT/GETEXP instructions scheduler classes (REVERSION)

Accidental commit of incomplete patch

llvm-svn: 319346

6 years agoMake TypeTableBuilder inherit from TypeCollection.
Zachary Turner [Wed, 29 Nov 2017 19:35:21 +0000 (19:35 +0000)]
Make TypeTableBuilder inherit from TypeCollection.

A couple of places in LLD were passing references to
TypeTableCollections around, which makes it hard to change the
implementation at runtime.  However, these cases only needed to
iterate over the types in the collection, and TypeCollection
already provides a handy abstract interface for this purpose.

By implementing this interface, we can get rid of the need to
pass TypeTableBuilder references around, which should allow us
to swap the implementation at runtime in subsequent patches.

llvm-svn: 319345

6 years ago[asan] Allow getpwnam(NULL) for binary compatibility
Kuba Mracek [Wed, 29 Nov 2017 19:33:35 +0000 (19:33 +0000)]
[asan] Allow getpwnam(NULL) for binary compatibility

Calling getpwnam(NULL) is probably a bug, but at least on Darwin, such a call succeeds without segfaulting. I have some existing code that relies on that. To maintain binary compatibility, ASan should also survive a call to getpwnam with NULL.

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

llvm-svn: 319344

6 years ago[CMake] Refactor testing infrastructure
Jonas Hahnfeld [Wed, 29 Nov 2017 19:31:52 +0000 (19:31 +0000)]
[CMake] Refactor testing infrastructure

The code for the two OpenMP runtime libraries was very similar.
Move to common CMake file that is included and provides a simple
interface for adding testsuites. Also add a common check-openmp
target that runs all testsuites that have been registered.

Note that this renames all test options to the common OPENMP
namespace, for example OPENMP_TEST_C_COMPILER instead of
LIBOMP_TEST_COMPILER and so on.

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

llvm-svn: 319343

6 years ago[CMake] Refactor common settings and flags
Jonas Hahnfeld [Wed, 29 Nov 2017 19:31:48 +0000 (19:31 +0000)]
[CMake] Refactor common settings and flags

These are needed by both libraries, so we can do that in a
common namespace and unify configuration parameters.
Also make sure that the user isn't requesting libomptarget
if the library cannot be built on the system. Issue an error
in that case.

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

llvm-svn: 319342

6 years ago[CMake] Disallow direct configuration
Jonas Hahnfeld [Wed, 29 Nov 2017 19:31:43 +0000 (19:31 +0000)]
[CMake] Disallow direct configuration

As a first step, this allows us to generalize the detection of
standalone builds and make it fully compatible when building in
llvm/runtimes/ which automatically sets OPENMP_STANDLONE_BUILD.

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

llvm-svn: 319341

6 years agoFix line endings in llvm-pdbutil.cpp
Zachary Turner [Wed, 29 Nov 2017 19:29:25 +0000 (19:29 +0000)]
Fix line endings in llvm-pdbutil.cpp

llvm-svn: 319340

6 years ago[sanitizer] Refactor how assembly files are handled
Kuba Mracek [Wed, 29 Nov 2017 19:27:25 +0000 (19:27 +0000)]
[sanitizer] Refactor how assembly files are handled

This renames ASM_TSAN_SYMBOL and ASM_TSAN_SYMBOL_INTERCEPTOR to just ASM_SYMBOL and ASM_SYMBOL_INTERCEPTOR, because they can be useful in more places than just TSan. Also introduce a CMake function to add ASM sources to a target.

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

llvm-svn: 319339

6 years ago[X86][AVX512] Tag RCP/RSQRT/GETEXP instructions scheduler classes
Simon Pilgrim [Wed, 29 Nov 2017 19:19:59 +0000 (19:19 +0000)]
[X86][AVX512] Tag RCP/RSQRT/GETEXP instructions scheduler classes

llvm-svn: 319338

6 years ago[X86][AVX512] Tag 3OP (shuffles, double-shifts and GFNI) instructions scheduler classes
Simon Pilgrim [Wed, 29 Nov 2017 18:52:20 +0000 (18:52 +0000)]
[X86][AVX512] Tag 3OP (shuffles, double-shifts and GFNI) instructions scheduler classes

llvm-svn: 319337

6 years ago[clang-cl] Alias /wd4018 to -Wno-sign-compare
Reid Kleckner [Wed, 29 Nov 2017 18:45:03 +0000 (18:45 +0000)]
[clang-cl] Alias /wd4018 to -Wno-sign-compare

This warning is known to be noisy and projects frequently disable it. In
particular, this should make building isl as bundled in polly with
clang-cl a lot quieter.

llvm-svn: 319336

6 years agoReplace another dyn_cast with a cast.
Rafael Espindola [Wed, 29 Nov 2017 18:43:34 +0000 (18:43 +0000)]
Replace another dyn_cast with a cast.

llvm-svn: 319335

6 years agoReplace a dyn_cast with a cast.
Rafael Espindola [Wed, 29 Nov 2017 18:32:57 +0000 (18:32 +0000)]
Replace a dyn_cast with a cast.

It is always accessed, so there is no value in a dyn_cast.

llvm-svn: 319334

6 years ago[analyzer] Fix unreachable creating PathDiagnosticLocation with widen-loops=true
Devin Coughlin [Wed, 29 Nov 2017 18:25:37 +0000 (18:25 +0000)]
[analyzer] Fix unreachable creating PathDiagnosticLocation with widen-loops=true

In the original design of the analyzer, it was assumed that a BlockEntrance
doesn't create a new binding on the Store, but this assumption isn't true when
'widen-loops' is set to true. Fix this by finding an appropriate location
BlockEntrace program points.

Patch by Henry Wong!

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

llvm-svn: 319333

6 years ago[OPENMP] Do not allow `linear` clauses on non-simd distribute
Alexey Bataev [Wed, 29 Nov 2017 18:20:04 +0000 (18:20 +0000)]
[OPENMP] Do not allow `linear` clauses on non-simd distribute
directives.

`linear` clause is not allowed on non-simd distribute-based directives.

llvm-svn: 319332

6 years ago[ARM][DAG] Revert Disable post-legalization store merge for ARM
Nirav Dave [Wed, 29 Nov 2017 18:06:13 +0000 (18:06 +0000)]
[ARM][DAG] Revert Disable post-legalization store merge for ARM

Partially reverting enabling of post-legalization store merge
(r319036) for just ARM backend as it is causing incorrect code
in some Thumb2 cases.

llvm-svn: 319331

6 years ago[cmake] Replace -Wall with /W4 in clang-cl options now that -Wall aliases -Weverything
Greg Bedwell [Wed, 29 Nov 2017 18:05:32 +0000 (18:05 +0000)]
[cmake] Replace -Wall with /W4 in clang-cl options now that -Wall aliases -Weverything

Instead, reuse the code-path for cl.exe that adds /W4 , which for clang-cl
aliases clang's "-Wall -Wextra" which matches what clang-cl's /Wall
previously aliased.

This should restore the verbosity of a Windows selfhost build back to
its previous levels.

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

llvm-svn: 319330

6 years agoMake check-lit tests respect LLVM_LIT_TOOLS_DIR
Greg Bedwell [Wed, 29 Nov 2017 18:05:26 +0000 (18:05 +0000)]
Make check-lit tests respect LLVM_LIT_TOOLS_DIR

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

llvm-svn: 319329

6 years ago[Power9] add more tests for D38287; NFC
Zaara Syeda [Wed, 29 Nov 2017 17:26:20 +0000 (17:26 +0000)]
[Power9] add more tests for D38287; NFC

llvm-svn: 319328

6 years ago[InstCombine] add tests for select-of-constants; NFC
Sanjay Patel [Wed, 29 Nov 2017 17:21:39 +0000 (17:21 +0000)]
[InstCombine] add tests for select-of-constants; NFC

These are variants of a test that was originally added in:
https://reviews.llvm.org/rL75531
...but removed with:
https://reviews.llvm.org/rL159230

llvm-svn: 319327

6 years ago[X86][AVX512] Add itinerary argument to all AVX512_maskable_* wrappers. NFCI
Simon Pilgrim [Wed, 29 Nov 2017 17:21:15 +0000 (17:21 +0000)]
[X86][AVX512] Add itinerary argument to all AVX512_maskable_* wrappers. NFCI

All default to NoItinerary

llvm-svn: 319326

6 years ago[clang-tidy] make readability-simplify-bool-expr completely ignore macros
Alexander Kornienko [Wed, 29 Nov 2017 17:16:09 +0000 (17:16 +0000)]
[clang-tidy] make readability-simplify-bool-expr completely ignore macros

llvm-svn: 319325

6 years agoAdd opt-viewer testing
Adam Nemet [Wed, 29 Nov 2017 17:07:41 +0000 (17:07 +0000)]
Add opt-viewer testing

Detects whether we have the Python modules (pygments, yaml) required by
opt-viewer and hooks this up to REQUIRES.

This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer
testing).

It's also related to https://github.com/apple/swift/pull/12938 and the idea is
to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake.

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

Fixes since the first commit:
1. Disable syntax highlighting as different versions of pygments generate
different HTML
2. Use llvm-cxxfilt from the build

llvm-svn: 319324

6 years ago[Driver] Turns out the GNU assembler does support falkor/saphira.
Chad Rosier [Wed, 29 Nov 2017 16:42:44 +0000 (16:42 +0000)]
[Driver] Turns out the GNU assembler does support falkor/saphira.

llvm-svn: 319323

6 years agoFix function call to fix build
Ismail Donmez [Wed, 29 Nov 2017 15:18:02 +0000 (15:18 +0000)]
Fix function call to fix build

../tools/clang/lib/Driver/ToolChains/Cuda.cpp:80:18: error: reference to non-static member function must be called; did you mean to call it with no arguments?
    if (Distro(D.getVFS).IsDebian())
               ~~^~~~~~
                       ()

llvm-svn: 319322

6 years agoReverted r319315 because of unused functions (due to PPR not yet being
Sander de Smalen [Wed, 29 Nov 2017 15:14:39 +0000 (15:14 +0000)]
Reverted r319315 because of unused functions (due to PPR not yet being
used by any instructions).

llvm-svn: 319321

6 years ago[OPENMP] General improvement of handling of `teams distribute`
Alexey Bataev [Wed, 29 Nov 2017 15:14:16 +0000 (15:14 +0000)]
[OPENMP] General improvement of handling of `teams distribute`
directive, NFC.

Some general improvements in support of `teams distribute` directive.

llvm-svn: 319320

6 years agoFollow up of r319317, add the missing header file
Sylvestre Ledru [Wed, 29 Nov 2017 15:11:53 +0000 (15:11 +0000)]
Follow up of r319317, add the missing header file

llvm-svn: 319319

6 years agoFix 'control reaches end of non-void' warning by using llvm_unreachable.
Manuel Klimek [Wed, 29 Nov 2017 15:09:12 +0000 (15:09 +0000)]
Fix 'control reaches end of non-void' warning by using llvm_unreachable.

llvm-svn: 319318

6 years agoAdd the nvidia-cuda-toolkit Debian package path to search path
Sylvestre Ledru [Wed, 29 Nov 2017 15:03:28 +0000 (15:03 +0000)]
Add the nvidia-cuda-toolkit  Debian package path to search path

Summary:
Reported here:
http://bugs.debian.org/882505

Patch by Andreas Beckmann

Reviewers: Hahnfeld, tra

Reviewed By: tra

Subscribers: jlebar, cfe-commits

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

llvm-svn: 319317

6 years ago[X86][AVX512] Tag VPERMILV instruction scheduler class
Simon Pilgrim [Wed, 29 Nov 2017 14:58:34 +0000 (14:58 +0000)]
[X86][AVX512] Tag VPERMILV instruction scheduler class

llvm-svn: 319316

6 years ago[AArch64][SVE] Asm: Add SVE predicate register definitions and parsing support
Sander de Smalen [Wed, 29 Nov 2017 14:34:18 +0000 (14:34 +0000)]
[AArch64][SVE] Asm: Add SVE predicate register definitions and parsing support

Summary: Patch [1/4] in a series to add parsing of predicates and properly parse SVE ZIP1/ZIP2 instructions.

Reviewers: rengolin, kristof.beyls, fhahn, mcrosier, evandro, echristo, efriedma

Reviewed By: fhahn

Subscribers: aemerson, javed.absar, llvm-commits, tschuett

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

llvm-svn: 319315

6 years agoRestructure how we break tokens.
Manuel Klimek [Wed, 29 Nov 2017 14:29:43 +0000 (14:29 +0000)]
Restructure how we break tokens.

This fixes some bugs in the reflowing logic and splits out the concerns
of reflowing from BreakableToken.

Things to do after this patch:
- Refactor the breakProtrudingToken function possibly into a class, so we
  can split it up into methods that operate on the common state.
- Optimize whitespace compression when reflowing by using the next possible
  split point instead of the latest possible split point.
- Retry different strategies for reflowing (strictly staying below the
  column limit vs. allowing excess characters if possible).

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

llvm-svn: 319314

6 years ago[ARM GlobalISel] Fix selecting G_BRCOND
Diana Picus [Wed, 29 Nov 2017 14:20:06 +0000 (14:20 +0000)]
[ARM GlobalISel] Fix selecting G_BRCOND

When lowering a G_BRCOND, we generate a TSTri of the condition against
1, which sets the flags, and then a Bcc which branches based on the
value of the flags.

Unfortunately, we were using the wrong condition code to check whether
we need to branch (EQ instead of NE), which caused all our branches to
do the opposite of what they were intended to do. This patch fixes the
issue by using the correct condition code.

llvm-svn: 319313

6 years ago[X86][AVX512] Setup unary (PABS/VPLZCNT/VPOPCNT/VPCONFLICT/VMOV*DUP) instruction...
Simon Pilgrim [Wed, 29 Nov 2017 13:49:51 +0000 (13:49 +0000)]
[X86][AVX512] Setup unary (PABS/VPLZCNT/VPOPCNT/VPCONFLICT/VMOV*DUP) instruction scheduler classes

llvm-svn: 319312

6 years ago[AMDGPU][MC][GFX9] Corrected mapping of GFX9 v_add/sub/subrev_u32
Dmitry Preobrazhensky [Wed, 29 Nov 2017 13:33:40 +0000 (13:33 +0000)]
[AMDGPU][MC][GFX9] Corrected mapping of GFX9 v_add/sub/subrev_u32

When translating pseudo to MC, v_add/sub/subrev_u32 shall be mapped via a separate table as GFX8 has opcodes with the same names.
These instructions shall also be labelled as renamed for pseudoToMCOpcode to handle them correctly.

Reviewers: arsenm

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

llvm-svn: 319311

6 years ago[X86][SSE] Merged sse2_unpack and sse2_unpack PUNPCK instruction templates. NFCI.
Simon Pilgrim [Wed, 29 Nov 2017 12:12:27 +0000 (12:12 +0000)]
[X86][SSE] Merged sse2_unpack and sse2_unpack PUNPCK instruction templates. NFCI.

llvm-svn: 319310

6 years ago[clangd] Simplify common JSON-parsing patterns in Protocol.
Sam McCall [Wed, 29 Nov 2017 11:36:46 +0000 (11:36 +0000)]
[clangd] Simplify common JSON-parsing patterns in Protocol.

Summary:
This makes the parse() functions about as short as they can be given the
current signature, and moves all array-traversal etc code to a
central location.

We keep the ability to distinguish between optional and required fields:
and we don't propagate parse errors for optional fields.

I've made most fields required per the LSP spec - the looseness we had
here was mostly a historical accident I think.

Reviewers: ioeric

Subscribers: klimek, cfe-commits, ilya-biryukov

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

llvm-svn: 319309

6 years ago[X86][SSE] Merged sse2_pack and sse2_pack_y PACKSS/PACKUS instruction templates....
Simon Pilgrim [Wed, 29 Nov 2017 11:35:45 +0000 (11:35 +0000)]
[X86][SSE] Merged sse2_pack and sse2_pack_y PACKSS/PACKUS instruction templates. NFCI.

llvm-svn: 319308

6 years ago[ELF][AArch64] Add support for AArch64 range thunks.
Peter Smith [Wed, 29 Nov 2017 11:15:12 +0000 (11:15 +0000)]
[ELF][AArch64] Add support for AArch64 range thunks.

The AArch64 unconditional branch and branch and link instructions have a
maximum range of 128 Mib. This is usually enough for most programs but
there are cases when it isn't enough. This change adds support for range
extension thunks to AArch64. For pc-relative thunks we follow the small
code model and use ADRP, ADD, BR. This has a limit of 4 gigabytes.

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

llvm-svn: 319307

6 years ago[SCEV][NFC] Break from loop after we found first non-Phi in getAddRecExprPHILiterally
Max Kazantsev [Wed, 29 Nov 2017 10:54:16 +0000 (10:54 +0000)]
[SCEV][NFC] Break from loop after we found first non-Phi in getAddRecExprPHILiterally

llvm-svn: 319306

6 years agoDefer StartBackgroundThread() and StopBackgroundThread() in TSan
Kamil Rytarowski [Wed, 29 Nov 2017 10:23:59 +0000 (10:23 +0000)]
Defer StartBackgroundThread() and StopBackgroundThread() in TSan

Summary:
NetBSD cannot spawn new POSIX thread entities in early
libc and libpthread initialization stage. Defer this to the point
of intercepting the first pthread_create(3) call.

This is the last change that makes Thread Sanitizer functional
on NetBSD/amd64 without downstream patches.

********************
Testing Time: 64.91s
********************
Failing Tests (5):
    ThreadSanitizer-x86_64 :: dtls.c
    ThreadSanitizer-x86_64 :: ignore_lib5.cc
    ThreadSanitizer-x86_64 :: ignored-interceptors-mmap.cc
    ThreadSanitizer-x86_64 :: mutex_lock_destroyed.cc
    ThreadSanitizer-x86_64 :: vfork.cc

  Expected Passes    : 290
  Expected Failures  : 1
  Unsupported Tests  : 83
  Unexpected Failures: 5

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, dvyukov, vitalybuka

Reviewed By: dvyukov

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 319305

6 years ago[ELF] Make sure SHT_ARM_ATTRIBUTES is only recognized by Arm Targets
Peter Smith [Wed, 29 Nov 2017 10:20:46 +0000 (10:20 +0000)]
[ELF] Make sure SHT_ARM_ATTRIBUTES is only recognized by Arm Targets

The SHT_ARM_ATTRIBUTES section type is in the processor specific space
adding guard to make sure that it is only recognized when EMachine is
EM_ARM.

llvm-svn: 319304

6 years ago[ARM] Add support for armv7e-m to the .arch directive
Oliver Stannard [Wed, 29 Nov 2017 10:12:15 +0000 (10:12 +0000)]
[ARM] Add support for armv7e-m to the .arch directive

This will allow compilation of assembly files targeting armv7e-m without having
to specify the Tag_CPU_arch attribute as a workaround.

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

Patch by Ian Tessier!

llvm-svn: 319303

6 years ago[CGP] Enable complex addr mode
Serguei Katkov [Wed, 29 Nov 2017 09:48:50 +0000 (09:48 +0000)]
[CGP] Enable complex addr mode

Enable complex addr modes after two critical fixes: rL319109 and rL319292

llvm-svn: 319302

6 years agoComment fix in SelectionDAG.h
Jonas Paulsson [Wed, 29 Nov 2017 09:16:37 +0000 (09:16 +0000)]
Comment fix in SelectionDAG.h

   /// Replace any uses of From with To, leaving
-  /// uses of other values produced by From.Val alone.
+  /// uses of other values produced by From.getNode() alone.
   void ReplaceAllUsesOfValueWith(SDValue From, SDValue To);

(this is what it says in the .cpp file above this method)

llvm-svn: 319301

6 years agoSupport building libunwind as a DLL
Martin Storsjo [Wed, 29 Nov 2017 08:21:12 +0000 (08:21 +0000)]
Support building libunwind as a DLL

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

llvm-svn: 319300

6 years ago[CMake] Use the variable from the right project in install-unwind
Martin Storsjo [Wed, 29 Nov 2017 08:20:57 +0000 (08:20 +0000)]
[CMake] Use the variable from the right project in install-unwind

llvm-svn: 319299

6 years ago[X86] Remove setOperationAction Promote for ISD::SINT_TO_FP MVT::v8i16/v16i8/v16i16.
Craig Topper [Wed, 29 Nov 2017 08:19:36 +0000 (08:19 +0000)]
[X86] Remove setOperationAction Promote for ISD::SINT_TO_FP MVT::v8i16/v16i8/v16i16.

A DAG combine ensures these ops are always promoted to vXi32.

llvm-svn: 319298

6 years agoToolchain: Normalize dwarf, sjlj and seh eh
Martell Malone [Wed, 29 Nov 2017 07:25:12 +0000 (07:25 +0000)]
Toolchain: Normalize dwarf, sjlj and seh eh

This is a re-apply of r319294.

adds -fseh-exceptions and -fdwarf-exceptions flags

clang will check if the user has specified an exception model flag,
in the absense of specifying the exception model clang will then check
the driver default and append the model flag for that target to cc1

-fno-exceptions has a higher priority then specifying the model

move __SEH__ macro definitions out of Targets into InitPreprocessor
behind the -fseh-exceptions flag

move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check

remove unused USESEHExceptions from the MinGW Driver

fold USESjLjExceptions into a new GetExceptionModel function that
gives the toolchain classes more flexibility with eh models

Reviewers: rnk, mstorsjo

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

llvm-svn: 319297

6 years agoRevert change for LibFuzzer target archs
Yi Kong [Wed, 29 Nov 2017 07:03:11 +0000 (07:03 +0000)]
Revert change for LibFuzzer target archs

Broke buildbot.

llvm-svn: 319296

6 years agoRevert "Toolchain: Normalize dwarf, sjlj and seh eh"
Martell Malone [Wed, 29 Nov 2017 06:51:27 +0000 (06:51 +0000)]
Revert "Toolchain: Normalize dwarf, sjlj and seh eh"

This reverts rL319294.
The windows sanitizer does not like seh on x86.
Will re apply with None type for x86

llvm-svn: 319295

6 years agoToolchain: Normalize dwarf, sjlj and seh eh
Martell Malone [Wed, 29 Nov 2017 06:25:13 +0000 (06:25 +0000)]
Toolchain: Normalize dwarf, sjlj and seh eh

adds -fseh-exceptions and -fdwarf-exceptions flags

clang will check if the user has specified an exception model flag,
in the absense of specifying the exception model clang will then check
the driver default and append the model flag for that target to cc1

clang cc1 assumes dwarf is the default if none is passed
and -fno-exceptions has a higher priority then specifying the model

move __SEH__ macro definitions out of Targets into InitPreprocessor
behind the -fseh-exceptions flag

move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check

remove unused USESEHExceptions from the MinGW Driver

fold USESjLjExceptions into a new GetExceptionModel function that
gives the toolchain classes more flexibility with eh models

Reviewers: rnk, mstorsjo

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

llvm-svn: 319294

6 years ago[SCEV][NFC] Remove condition that can never happen due to check few lines above
Max Kazantsev [Wed, 29 Nov 2017 06:10:36 +0000 (06:10 +0000)]
[SCEV][NFC] Remove condition that can never happen due to check few lines above

llvm-svn: 319293

6 years ago[CGP] Fix common type handling in optimizeMemoryInst
Serguei Katkov [Wed, 29 Nov 2017 05:51:26 +0000 (05:51 +0000)]
[CGP] Fix common type handling in optimizeMemoryInst

If common type is different we should bail out due to we will not be
able to create a select or Phi of these values.

Basically it is done in ExtAddrMode::compare however it does not work
if we handle the null first and then two values of different types.
so add a check in initializeMap as well. The check in ExtAddrMode::compare
is used as earlier bail out.

Reviewers: reames, john.brawn
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D40479

llvm-svn: 319292

6 years ago[COFF] Don't export symbols that have corresponding __imp_ symbols
Martin Storsjo [Wed, 29 Nov 2017 05:50:49 +0000 (05:50 +0000)]
[COFF] Don't export symbols that have corresponding __imp_ symbols

GNU ld has got an exception for such symbols, and mingw-w64
occasionally uses that exception to avoid exporting symbols in cases
where they otherwise aren't caught by the other exclusion mechanisms.

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

llvm-svn: 319291

6 years agoUse static function instead of anonymous namespace
Serge Pavlov [Wed, 29 Nov 2017 05:10:11 +0000 (05:10 +0000)]
Use static function instead of anonymous namespace

llvm-svn: 319290

6 years ago[PowerPC] Relax the checking on AND/AND8 in isSignOrZeroExtended.
Sean Fertile [Wed, 29 Nov 2017 04:09:29 +0000 (04:09 +0000)]
[PowerPC] Relax the checking on AND/AND8 in isSignOrZeroExtended.

Separate the handling of AND/AND8 out from PHI/OR/ISEL checking. The reasoning
is the others need all their operands to be sign/zero extended for their output
to also be sign/zero extended. This is true for AND and sign-extension, but for
zero-extension we only need at least one of the input operands to be zero
extended for the result to also be zero extended.

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

llvm-svn: 319289

6 years ago[LibFuzzer] Add Android to LibFuzzer's supported OSes
Yi Kong [Wed, 29 Nov 2017 03:52:44 +0000 (03:52 +0000)]
[LibFuzzer] Add Android to LibFuzzer's supported OSes

... and a trivial fix that x86_64h arch should also be supported.

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

llvm-svn: 319288

6 years agoAMDGPU: Use stricter regexes for add instructions
Matt Arsenault [Wed, 29 Nov 2017 02:25:14 +0000 (02:25 +0000)]
AMDGPU: Use stricter regexes for add instructions

Match the entire _co as one optional piece rather than
a set of characters to match multiple times.

llvm-svn: 319275

6 years agoDelete dead code. NFC.
Rafael Espindola [Wed, 29 Nov 2017 01:55:03 +0000 (01:55 +0000)]
Delete dead code. NFC.

llvm-svn: 319274

6 years ago[Modules] Add textual headers for recently added .def files
Bruno Cardoso Lopes [Wed, 29 Nov 2017 01:53:49 +0000 (01:53 +0000)]
[Modules] Add textual headers for recently added .def files

Keep module.modulemap up to date and get rid of -Wincomplete-umbrella warnings

rdar://problem/35711925

llvm-svn: 319273

6 years agoDAG: Add nuw when splitting loads and stores
Matt Arsenault [Wed, 29 Nov 2017 01:25:12 +0000 (01:25 +0000)]
DAG: Add nuw when splitting loads and stores

The object can't straddle the address space
wrap around, so I think it's OK to assume any
offsets added to the base object pointer can't
overflow. Similar logic already appears to be
applied in SelectionDAGBuilder when lowering
aggregate returns.

llvm-svn: 319272

6 years agollvm-dwarfdump: honor the --show-children option when dumping a specific DIE.
Adrian Prantl [Wed, 29 Nov 2017 01:12:22 +0000 (01:12 +0000)]
llvm-dwarfdump: honor the --show-children option when dumping a specific DIE.

llvm-svn: 319271