platform/upstream/llvm.git
5 years ago[ARM GlobalISel] Cleanup CallLowering. NFC
Diana Picus [Wed, 17 Jul 2019 10:01:27 +0000 (10:01 +0000)]
[ARM GlobalISel] Cleanup CallLowering. NFC

Migrate CallLowering::lowerReturnVal to use the same infrastructure as
lowerCall/FormalArguments and remove the now obsolete code path from
splitToValueTypes.

Forgot to push this earlier.

llvm-svn: 366308

5 years ago[ELF] Delete redundant pageAlign at PT_GNU_RELRO boundaries after D58892
Fangrui Song [Wed, 17 Jul 2019 09:23:04 +0000 (09:23 +0000)]
[ELF] Delete redundant pageAlign at PT_GNU_RELRO boundaries after D58892

Summary:
After D58892 split the RW PT_LOAD on the PT_GNU_RELRO boundary, the new
layout is:

PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss)

The two pageAlign() calls at PT_GNU_RELRO boundaries are redundant due
to the existence of PT_LOAD.

Reviewers: grimar, peter.smith, ruiu, espindola

Reviewed By: ruiu

Subscribers: sfertile, atanasyan, emaste, arichardson, llvm-commits

Tags: #llvm

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

llvm-svn: 366307

5 years ago[OpenCL][Sema] Minor refactoring and constraint checking
Marco Antognini [Wed, 17 Jul 2019 08:52:09 +0000 (08:52 +0000)]
[OpenCL][Sema] Minor refactoring and constraint checking

Summary:
Simplify code a bit and add assertion to address post-landing comments
from D64083.

Subscribers: yaxunl, Anastasia, cfe-commits

Tags: #clang

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

llvm-svn: 366306

5 years ago[Driver] Enable __cxa_atexit on Solaris
Rainer Orth [Wed, 17 Jul 2019 08:37:00 +0000 (08:37 +0000)]
[Driver] Enable __cxa_atexit on Solaris

Starting with Solaris 11.4 (which is now the required minimal version), Solaris does
support __cxa_atexit.  This patch reflects that.

One might consider removing the affected tests altogether instead of inverting them,
as is done on other targets.

Besides, this lets two ASan tests PASS:

  AddressSanitizer-i386-sunos :: TestCases/init-order-atexit.cc
  AddressSanitizer-i386-sunos-dynamic :: TestCases/init-order-atexit.cc

Tested on x86_64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

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

llvm-svn: 366305

5 years agoReplace CRLF with LF.
Rui Ueyama [Wed, 17 Jul 2019 08:31:51 +0000 (08:31 +0000)]
Replace CRLF with LF.

llvm-svn: 366304

5 years ago[mips] Remove redundant test case. NFC
Simon Atanasyan [Wed, 17 Jul 2019 08:12:03 +0000 (08:12 +0000)]
[mips] Remove redundant test case. NFC

The `inlineasm-constraint-reg64.ll` test checks the same functionality.

llvm-svn: 366303

5 years ago[mips] Name inline asm constraint test cases in a uniform manner. NFC
Simon Atanasyan [Wed, 17 Jul 2019 08:11:57 +0000 (08:11 +0000)]
[mips] Name inline asm constraint test cases in a uniform manner. NFC

llvm-svn: 366302

5 years ago[mips] Use mult/mflo pattern on 64-bit targets prior to MIPS64
Simon Atanasyan [Wed, 17 Jul 2019 08:11:40 +0000 (08:11 +0000)]
[mips] Use mult/mflo pattern on 64-bit targets prior to MIPS64

The `MUL` instruction is available starting from the MIPS32/MIPS64 targets.

llvm-svn: 366301

5 years ago[mips] Implement .cplocal directive
Simon Atanasyan [Wed, 17 Jul 2019 08:11:31 +0000 (08:11 +0000)]
[mips] Implement .cplocal directive

This directive forces to use the alternate register for context pointer.
For example, this code:
  .cplocal $4
  jal foo
expands to:
  ld    $25, %call16(foo)($4)
  jalr  $25

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

llvm-svn: 366300

5 years ago[mips] Support the "o" inline asm constraint
Simon Atanasyan [Wed, 17 Jul 2019 08:11:15 +0000 (08:11 +0000)]
[mips] Support the "o" inline asm constraint

As well as other LLVM targets we do not handle "offsettable"
memory addresses in any special way. In other words, the "o" constraint
is an exact equivalent of the "m" one. But some existing code require
the "o" constraint support.

This fixes PR42589.

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

llvm-svn: 366299

5 years ago[Target][NFCI] Remove commented out code
Alex Langford [Wed, 17 Jul 2019 07:13:42 +0000 (07:13 +0000)]
[Target][NFCI] Remove commented out code

llvm-svn: 366295

5 years ago[LoopInfo] Fix getUniqueNonLatchExitBlocks
Serguei Katkov [Wed, 17 Jul 2019 07:09:20 +0000 (07:09 +0000)]
[LoopInfo] Fix getUniqueNonLatchExitBlocks

It is possible that exit block has two predecessors and one of them is a latch
block while another is not.

Current algorithm is based on the assumption that all exits are dedicated
and therefore we can check only first predecessor of loop exit to find all unique
exits.

However if we do not consider latch block and it is first predecessor of some
exit then this exit will be found.

Regression test is added.

As a side effect of algorithm re-writing, the restriction that all exits are dedicated
is eliminated.

Reviewers: reames, fhahn, efriedma
Reviewed By: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D64787

llvm-svn: 366294

5 years ago[NativePDB] Make GetTranslationUnitDecl return an lldb CompilerDeclCtx
Nathan Lanza [Wed, 17 Jul 2019 07:05:49 +0000 (07:05 +0000)]
[NativePDB] Make GetTranslationUnitDecl return an lldb CompilerDeclCtx

Summary:
We intend to make PdbAstBuilder abstract and implement
PdbAstBuilderClang along with any other languages that wish to use
PDBs. This is the first step.

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

llvm-svn: 366293

5 years ago[Target][NFCI] Rename variable
Alex Langford [Wed, 17 Jul 2019 07:03:17 +0000 (07:03 +0000)]
[Target][NFCI] Rename variable

This variable doesn't have anything to do with clang.

llvm-svn: 366292

5 years agoUpdate email address.
Qiu Chaofan [Wed, 17 Jul 2019 07:02:02 +0000 (07:02 +0000)]
Update email address.

llvm-svn: 366291

5 years agogn build: Merge r366265
Nico Weber [Wed, 17 Jul 2019 01:21:14 +0000 (01:21 +0000)]
gn build: Merge r366265

llvm-svn: 366289

5 years agogn build: Merge r366216
Nico Weber [Wed, 17 Jul 2019 01:19:30 +0000 (01:19 +0000)]
gn build: Merge r366216

llvm-svn: 366288

5 years agoAMDGPU: Add some missing builtins
Matt Arsenault [Wed, 17 Jul 2019 00:01:03 +0000 (00:01 +0000)]
AMDGPU: Add some missing builtins

llvm-svn: 366286

5 years agoDon't require python exe and lib versions to match while crosscompiling
Nathan Lanza [Tue, 16 Jul 2019 23:54:17 +0000 (23:54 +0000)]
Don't require python exe and lib versions to match while crosscompiling

Summary:
While cross compiling, the python executable is used to run a handful
of scripts while the libraries are linked and headers are included.
Theoretically it's possible for the versions to match completely, but
requiring the build to match 2.7.10 to 2.7.15 is unnecessary.

Subscribers: mgorny

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

llvm-svn: 366285

5 years agoFix OpenCLCXX test on 32-bit Windows where thiscall is present
Reid Kleckner [Tue, 16 Jul 2019 23:44:33 +0000 (23:44 +0000)]
Fix OpenCLCXX test on 32-bit Windows where thiscall is present

llvm-svn: 366284

5 years ago[AMDGPU] Autogenerate register asm names
Stanislav Mekhanoshin [Tue, 16 Jul 2019 23:44:21 +0000 (23:44 +0000)]
[AMDGPU] Autogenerate register asm names

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

llvm-svn: 366283

5 years agoFix darwin-ld.c if dsymutil.exe exists on PATH
Reid Kleckner [Tue, 16 Jul 2019 23:38:05 +0000 (23:38 +0000)]
Fix darwin-ld.c if dsymutil.exe exists on PATH

llvm-svn: 366282

5 years agoadd a workaround in GetLine to account for ReadFile not reporintg error
Nathan Lanza [Tue, 16 Jul 2019 23:01:59 +0000 (23:01 +0000)]
add a workaround in GetLine to account for ReadFile not reporintg error

Summary:
ReadFile on Windows is supposed to set ERROR_OPERATION_ABORTED according
to the docs on MSDN. However, this has evidently been a known bug since
Windows 8. Therefore, we can't detect if a signal interrupted in the
fgets. So pressing ctrl-c causes the repl to end and the process to
exit. A temporary workaround is just to attempt to fgets twice until
this bug is fixed.

A possible alternative would be to set a flag in the `sigint_handler`
and simply check that flag in the true part of the if statement.
However, signal handlers on Windows are asynchronous and this would
require sleeping on the repl loop thread while still not necessarily
guarnateeing that you caught the sigint.

Reviewers: jfb

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

llvm-svn: 366281

5 years agoARM: Fix missing immarg for space intrinsic
Matt Arsenault [Tue, 16 Jul 2019 22:41:38 +0000 (22:41 +0000)]
ARM: Fix missing immarg for space intrinsic

llvm-svn: 366280

5 years agoGlobalISel: Add overload of handleAssignments with CCState
Matt Arsenault [Tue, 16 Jul 2019 22:41:34 +0000 (22:41 +0000)]
GlobalISel: Add overload of handleAssignments with CCState

AMDGPU needs to allocate special argument registers separately from
the user function argument list, so needs direct control over the
CCState.

The ArgLocs argument is only really necessary because CCState doesn't
allow access to it.

llvm-svn: 366279

5 years ago[TableGen] Generate offsets into a flat array for getOperandType
Justin Bogner [Tue, 16 Jul 2019 22:39:18 +0000 (22:39 +0000)]
[TableGen] Generate offsets into a flat array for getOperandType

Rather than an array of std::initializer_list, generate a table of
offsets and a flat array of the operands for getOperandType. This is a
bit more efficient on platforms that don't manage to get the array of
inintializer_lists initialized at link time (I'm looking at you
macOS). It's also quite quite a bit faster to compile.

llvm-svn: 366278

5 years agoFix a typo in target features
George Burgess IV [Tue, 16 Jul 2019 22:32:17 +0000 (22:32 +0000)]
Fix a typo in target features

There was a slight typo in r364352 that ended up causing our backend to
complain on some x86 Android builds. This CL fixes that.

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

llvm-svn: 366276

5 years ago[WebAssembly] Compile all TLS on Emscripten as local-exec
Guanzhong Chen [Tue, 16 Jul 2019 22:22:08 +0000 (22:22 +0000)]
[WebAssembly] Compile all TLS on Emscripten as local-exec

Summary:
Currently, on Emscripten, dynamic linking is not supported with threads.
This means that if thread-local storage is used, it must be used in a
statically-linked executable. Hence, local-exec is the only possible model.

This diff compiles all TLS variables to use local-exec on Emscripten as a
temporary measure until dynamic linking is supported with threads.

The goal for this is to allow C++ types with constructors to be thread-local.

Currently, when `clang` compiles a `thread_local` variable with a constructor,
it generates `__tls_guard` variable:

    @__tls_guard = internal thread_local global i8 0, align 1

As no TLS model is specified, this is treated as general-dynamic, which we do
not support (and cannot support without implementing dynamic linking support
with threads in Emscripten). As a result, any C++ constructor in `thread_local`
variables would not compile.

By compiling all `thread_local` as local-exec, `__tls_guard` will compile and
we can support C++ constructors with TLS without implementing dynamic linking
with threads.

Depends on D64537

Reviewers: tlively, aheejin, sbc100

Reviewed By: aheejin

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 366275

5 years ago[TableGen] Add "getOperandType" to get operand types from opcode/opidx
Justin Bogner [Tue, 16 Jul 2019 22:10:16 +0000 (22:10 +0000)]
[TableGen] Add "getOperandType" to get operand types from opcode/opidx

The InstrInfoEmitter outputs an enum called "OperandType" which gives
numerical IDs to each operand type. This patch makes use of this enum
to define a function called "getOperandType", which allows looking up
the type of an operand given its opcode and operand index.

Patch by Nicolas Guillemot. Thanks!

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

llvm-svn: 366274

5 years agoAdd REQUIRES: x86 to safeseh-no.s test for x86
Reid Kleckner [Tue, 16 Jul 2019 22:01:30 +0000 (22:01 +0000)]
Add REQUIRES: x86 to safeseh-no.s test for x86

llvm-svn: 366273

5 years ago[WebAssembly] Implement thread-local storage (local-exec model)
Guanzhong Chen [Tue, 16 Jul 2019 22:00:45 +0000 (22:00 +0000)]
[WebAssembly] Implement thread-local storage (local-exec model)

Summary:
Thread local variables are placed inside a `.tdata` segment. Their symbols are
offsets from the start of the segment. The address of a thread local variable
is computed as `__tls_base` + the offset from the start of the segment.

`.tdata` segment is a passive segment and `memory.init` is used once per thread
to initialize the thread local storage.

`__tls_base` is a wasm global. Since each thread has its own wasm instance,
it is effectively thread local. Currently, `__tls_base` must be initialized
at thread startup, and so cannot be used with dynamic libraries.

`__tls_base` is to be initialized with a new linker-synthesized function,
`__wasm_init_tls`, which takes as an argument a block of memory to use as the
storage for thread locals. It then initializes the block of memory and sets
`__tls_base`. As `__wasm_init_tls` will handle the memory initialization,
the memory does not have to be zeroed.

To help allocating memory for thread-local storage, a new compiler intrinsic
is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns
the size of the thread-local storage for the current function.

The expected usage is to run something like the following upon thread startup:

    __wasm_init_tls(malloc(__builtin_wasm_tls_size()));

Reviewers: tlively, aheejin, kripken, sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, jfb, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 366272

5 years agoAMDGPU: Partially revert r366250
Matt Arsenault [Tue, 16 Jul 2019 22:00:10 +0000 (22:00 +0000)]
AMDGPU: Partially revert r366250

GCCBuiltin doesn't work for these, because they have a mangled type
(although they arguably should not).

llvm-svn: 366271

5 years ago[ORC][docs] Fix an RST error: the code-block directive needs a newline after it.
Lang Hames [Tue, 16 Jul 2019 21:41:43 +0000 (21:41 +0000)]
[ORC][docs] Fix an RST error: the code-block directive needs a newline after it.

llvm-svn: 366270

5 years ago[ORC][docs] Trim ORCv1 to ORCv2 transition section, add a how-to section.
Lang Hames [Tue, 16 Jul 2019 21:34:59 +0000 (21:34 +0000)]
[ORC][docs] Trim ORCv1 to ORCv2 transition section, add a how-to section.

llvm-svn: 366269

5 years ago[x86] use more phadd for reductions
Sanjay Patel [Tue, 16 Jul 2019 21:30:41 +0000 (21:30 +0000)]
[x86] use more phadd for reductions

This is part of what is requested by PR42023:
https://bugs.llvm.org/show_bug.cgi?id=42023

There's an extension needed for FP add, but exactly how we would specify
that using flags is not clear to me, so I left that as a TODO.
We're still missing patterns for partial reductions when the input vector
is 256-bit or 512-bit, but I think that's a failure of vector narrowing.
If we can reduce the widths, then this matching should work on those tests.

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

llvm-svn: 366268

5 years ago[clang-format] Don't detect call to ObjC class method as C++11 attribute specifier
Ben Hamilton [Tue, 16 Jul 2019 21:29:40 +0000 (21:29 +0000)]
[clang-format] Don't detect call to ObjC class method as C++11 attribute specifier

Summary:
Previously, clang-format detected something like the following as a C++11 attribute specifier.

  @[[NSArray class]]

instead of an array with an Objective-C method call inside. In general, when the attribute specifier checking runs, if it sees 2 identifiers in a row, it decides that the square brackets represent an Objective-C method call. However, here, `class` is tokenized as a keyword instead of an identifier, so this check fails.

To fix this, the attribute specifier first checks whether the first square bracket has an "@" before it. If it does, then that square bracket is not the start of a attribute specifier because it is an Objective-C array literal. (The assumption is that @[[.*]] is not valid C/C++.)

Contributed by rkgibson2.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: aaron.ballman, cfe-commits

Tags: #clang

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

llvm-svn: 366267

5 years ago[NFC][ScopBuilder] Move addUserContext to ScopBuilder
Dominik Adamski [Tue, 16 Jul 2019 21:29:06 +0000 (21:29 +0000)]
[NFC][ScopBuilder] Move addUserContext to ScopBuilder

Scope of changes:
1) Moved addUserContext to ScopBuilder.
2) Moved command line option UserContextStr to ScopBuilder.

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

llvm-svn: 366266

5 years ago[clang-tidy] initial version of readability-convert-member-functions-to-static
Matthias Gehre [Tue, 16 Jul 2019 21:19:00 +0000 (21:19 +0000)]
[clang-tidy] initial version of readability-convert-member-functions-to-static

Summary:
Finds non-static member functions that can be made ``static``.

I have run this check (repeatedly) over llvm-project. It made 1708 member functions
``static``. Out of those, I had to exclude 22 via ``NOLINT`` because their address
was taken and stored in a variable of pointer-to-member type (e.g. passed to
llvm::StringSwitch).
It also made 243 member functions ``const``. (This is currently very conservative
to have no false-positives and can hopefully be extended in the future.)

You can find the results here: https://github.com/mgehre/llvm-project/commits/static_const_eval

Reviewers: alexfh, aaron.ballman

Subscribers: mgorny, xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 366265

5 years agoDWARF: Skip zero column for inline call sites
David Blaikie [Tue, 16 Jul 2019 21:15:19 +0000 (21:15 +0000)]
DWARF: Skip zero column for inline call sites

D64033 <https://reviews.llvm.org/D64033> added DW_AT_call_column for
inline sites. However, that change wasn't aware of "-gno-column-info".
To avoid adding column info when "-gno-column-info" is used, now
DW_AT_call_column is only added when we have non-zero column (when
"-gno-column-info" is used, column will be zero).

Patch by Wenlei He!

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

llvm-svn: 366264

5 years ago[libcxx] Rejigger test for destroying delete feature-test macros
Louis Dionne [Tue, 16 Jul 2019 21:13:40 +0000 (21:13 +0000)]
[libcxx] Rejigger test for destroying delete feature-test macros

In r361572, we introduced library support for C++20 destroying delete
and decided to only define the library feature-test macro when the
compiler supports the underlying language feature. This patch reworks
the tests to mirror that.

llvm-svn: 366263

5 years ago[NFC][ScopBuilder] Move buildAliasChecks and its implementing methods to ScopBuilder
Dominik Adamski [Tue, 16 Jul 2019 21:10:45 +0000 (21:10 +0000)]
[NFC][ScopBuilder] Move buildAliasChecks and its implementing methods to ScopBuilder

Scope of changes:
1) Moved buildAliasChecks to ScopBuilder.
2) Moved buildAliasGroup to ScopBuilder.
3) Moved buildAliasGroups to ScopBuilder.
4) Moved buildAliasGroupsForAccesses to ScopBuilder.
5) Moved splitAliasGroupsByDomain to ScopBuilder.
6) Moved addNonEmptyDomainConstraints to ScopBuilder.
7) Moved buildMinMaxAccess to ScopBuilder.
8) Moved calculateMinMaxAccess to ScopBuilder.
9) Moved getAccessDomain to ScopBuilder.
10) Moved command line options used only by buildAliasChecks functions to ScopBuilder.
11) Refactored buildAliasGroup function. Added addAliasGroup function to Scop class for pushing back calculated min/max accesses.
12) Added function incrementNumberOfAliasingAssumptions which increments number of statistic variable AssumptionsAliasing. AssumptionsAliasing variable is defined by STATISTIC macro inside ScopInfo.cpp and it is also used by function trackAssumption from Scop class.
13) Added reference to OptimizationRemarkEmitter to ScopBuilder class.
14) Moved calculateMinMaxAccess function to ScopBuilder class.

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

llvm-svn: 366262

5 years ago[Symbol] Remove unused fields from ClangASTContext
Alex Langford [Tue, 16 Jul 2019 21:05:08 +0000 (21:05 +0000)]
[Symbol] Remove unused fields from ClangASTContext

llvm-svn: 366261

5 years ago[NFC][ScopBuilder] Move addRecordedAssumption to ScopBuilder
Dominik Adamski [Tue, 16 Jul 2019 20:51:04 +0000 (20:51 +0000)]
[NFC][ScopBuilder] Move addRecordedAssumption to ScopBuilder

Scope of changes:
1) Moved addRecordedAssumptions to ScopBuilder.
2) Moved Assumption struct outside Scop class.
3) Refactored addRecordedAssumptions function. Replaced while loop by
for range loop.
4) Added function to clear processed Assumptions.

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

llvm-svn: 366260

5 years ago[libc++] Add missing UNSUPPORTED for CTAD tests
Louis Dionne [Tue, 16 Jul 2019 20:41:33 +0000 (20:41 +0000)]
[libc++] Add missing UNSUPPORTED for CTAD tests

The tests for unordered_set and unordered_multiset were missing UNSUPPORTED
markup for Apple Clang 9.1, which is still being used on some CI bots.

llvm-svn: 366259

5 years ago[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.6
Julian Lettner [Tue, 16 Jul 2019 20:41:04 +0000 (20:41 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.6

Cleanup ARM64 assembly after removing unnecessary computation of mangled
stack pointer in previous commit.

llvm-svn: 366258

5 years agoAMDGPU/GlobalISel: Select G_ASHR
Matt Arsenault [Tue, 16 Jul 2019 20:31:25 +0000 (20:31 +0000)]
AMDGPU/GlobalISel: Select G_ASHR

llvm-svn: 366257

5 years agoAMDGPU/GlobalISel: Select G_LSHR
Matt Arsenault [Tue, 16 Jul 2019 20:25:43 +0000 (20:25 +0000)]
AMDGPU/GlobalISel: Select G_LSHR

llvm-svn: 366256

5 years ago[PowerPC][HTM] Fix impossible reg-to-reg copy assert with ttest builtin
Jinsong Ji [Tue, 16 Jul 2019 20:24:33 +0000 (20:24 +0000)]
[PowerPC][HTM] Fix impossible reg-to-reg copy assert with ttest builtin

Summary:
This is exposed by our internal testing.
The reduced testcase will assert with "Impossible reg-to-reg copy"

We can't use COPY to do 32-bit to 64-bit conversion.

Reviewers: kbarton, hfinkel, nemanjai

Reviewed By: hfinkel

Subscribers: hiraditya, MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 366255

5 years agoAMDGPU/GlobalISel: Select G_SHL
Matt Arsenault [Tue, 16 Jul 2019 20:15:30 +0000 (20:15 +0000)]
AMDGPU/GlobalISel: Select G_SHL

I think this manages to not break the DAG handling with the divergent
predicates because the stadalone divergent patterns end up with a
higher priority than the pattern on the instruction definition.

The 16-bit versions don't work yet.

llvm-svn: 366254

5 years ago[GWP-ASan] Add thread ID to PRNG seed.
Mitch Phillips [Tue, 16 Jul 2019 20:06:17 +0000 (20:06 +0000)]
[GWP-ASan] Add thread ID to PRNG seed.

Summary:
Adds thread ID to PRNG seed for increased entropy. In particular, this allows
multiple runs in quick succession that will have different PRNG seeds, allowing
for better demos/testing.

Reviewers: kcc

Reviewed By: kcc

Subscribers: kubamracek, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 366253

5 years ago[AMDGPU] Change register type for v32 vectors
Stanislav Mekhanoshin [Tue, 16 Jul 2019 20:06:00 +0000 (20:06 +0000)]
[AMDGPU] Change register type for v32 vectors

When it is AReg_1024 this results in unnecessary copying into
AGPRs of a 32 element vectors even though they are not intended
for an mfma instruction.

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

llvm-svn: 366252

5 years agoFix -Wreturn-type warning. NFC.
Michael Liao [Tue, 16 Jul 2019 19:59:08 +0000 (19:59 +0000)]
Fix -Wreturn-type warning. NFC.

llvm-svn: 366251

5 years agoAMDGPU: Fix some missing GCCBuiltin declarations
Matt Arsenault [Tue, 16 Jul 2019 19:44:14 +0000 (19:44 +0000)]
AMDGPU: Fix some missing GCCBuiltin declarations

llvm-svn: 366250

5 years agoAMDGPU/GlobalISel: Fix selection of private stores
Matt Arsenault [Tue, 16 Jul 2019 19:27:44 +0000 (19:27 +0000)]
AMDGPU/GlobalISel: Fix selection of private stores

llvm-svn: 366249

5 years agoAMDGPU/GlobalISel: Select private loads
Matt Arsenault [Tue, 16 Jul 2019 19:22:21 +0000 (19:22 +0000)]
AMDGPU/GlobalISel: Select private loads

llvm-svn: 366248

5 years agoFix LLDB Windows build Python version logic after r366243
Reid Kleckner [Tue, 16 Jul 2019 18:46:51 +0000 (18:46 +0000)]
Fix LLDB Windows build Python version logic after r366243

llvm-svn: 366247

5 years agoAMDGPU/GlobalISel: Select flat stores
Matt Arsenault [Tue, 16 Jul 2019 18:42:53 +0000 (18:42 +0000)]
AMDGPU/GlobalISel: Select flat stores

llvm-svn: 366246

5 years agoMark new test as requiring an x86 backend for LTO native object generation
Reid Kleckner [Tue, 16 Jul 2019 18:34:46 +0000 (18:34 +0000)]
Mark new test as requiring an x86 backend for LTO native object generation

llvm-svn: 366245

5 years agoFix linkrepro.test after safeseh:no change
Reid Kleckner [Tue, 16 Jul 2019 18:33:13 +0000 (18:33 +0000)]
Fix linkrepro.test after safeseh:no change

Add the @feat.00 flag to the input.

llvm-svn: 366244

5 years ago[CMake] Fail when Python interpreter doesn't match Python libraries version
Jonas Devlieghere [Tue, 16 Jul 2019 18:27:12 +0000 (18:27 +0000)]
[CMake] Fail when Python interpreter doesn't match Python libraries version

Because of how CMake finds the Python libraries and interpreter, it's
possible to end up with a discrepancy between the two. For example,
you'd end up using a Python 3 interpreter to run the test suite while
LLDB was built and linked against Python 2.

This patch adds a fatal error to CMake so we find out at configuration
time, instead of finding out at test time.

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

llvm-svn: 366243

5 years agoAMDGPU: Add register classes to flat store patterns
Matt Arsenault [Tue, 16 Jul 2019 18:26:42 +0000 (18:26 +0000)]
AMDGPU: Add register classes to flat store patterns

For some reason GlobalISelEmitter needs register classes to import
these, although it works for the load patterns.

llvm-svn: 366242

5 years ago[IndVars] Speculative fix for an assertion failure seen in bots
Philip Reames [Tue, 16 Jul 2019 18:23:49 +0000 (18:23 +0000)]
[IndVars] Speculative fix for an assertion failure seen in bots

I don't have an IR sample which is actually failing, but the issue described in the comment is theoretically possible, and should be guarded against even if there's a different root cause for the bot failures.

llvm-svn: 366241

5 years agoAMDGPU: Replace store PatFrags
Matt Arsenault [Tue, 16 Jul 2019 18:21:25 +0000 (18:21 +0000)]
AMDGPU: Replace store PatFrags

Convert the easy cases to formats understood for GlobalISel.

llvm-svn: 366240

5 years ago[COFF] Implement /safeseh:no and check @feat.00 flags by default
Reid Kleckner [Tue, 16 Jul 2019 18:17:33 +0000 (18:17 +0000)]
[COFF] Implement /safeseh:no and check @feat.00 flags by default

Summary:
Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and
defined __safe_se_handler_table & size. Now, /safeseh:no leaves those
undefined.

Additionally, we were checking for the safeseh @feat.00 flag in two
places: once to emit errors, and once during safeseh table construction.
The error was set up to be off by default, but safeseh is supposed to be
on by default. I combined the two checks, so now LLD emits an error if
an input object lacks @feat.00 and safeseh is enabled. This caused the
majority of 32-bit LLD tests to fail, since many test input object files
lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to
preserve behavior.

Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any
input file wasn't compiled for safeseh.

Reviewers: mstorsjo, ruiu, thakis

Reviewed By: ruiu, thakis

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 366238

5 years agoAMDGPU/GlobalISel: Select flat loads
Matt Arsenault [Tue, 16 Jul 2019 18:05:29 +0000 (18:05 +0000)]
AMDGPU/GlobalISel: Select flat loads

Now that the patterns use the new PatFrag address space support, the
only blocker to importing most load patterns is the addressing mode
complex patterns.

llvm-svn: 366237

5 years agoTeach `llvm-pdbutil pretty -native` about `-injected-sources`
Nico Weber [Tue, 16 Jul 2019 18:04:26 +0000 (18:04 +0000)]
Teach `llvm-pdbutil pretty -native` about `-injected-sources`

`pretty -native -injected-sources -injected-source-content` works with
this patch, and produces identical output to the dia version.

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

llvm-svn: 366236

5 years ago[AMDGPU] Optimize atomic max/min
Jay Foad [Tue, 16 Jul 2019 17:44:54 +0000 (17:44 +0000)]
[AMDGPU] Optimize atomic max/min

Summary:
Extend the atomic optimizer to handle signed and unsigned max and min
operations, as well as add and subtract.

Reviewers: arsenm, sheredom, critson, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 366235

5 years agoAMDGPU: Redefine load PatFrags
Matt Arsenault [Tue, 16 Jul 2019 17:38:50 +0000 (17:38 +0000)]
AMDGPU: Redefine load PatFrags

Rewrite PatFrags using the new PatFrag address space matching in
tablegen. These will now work with both SelectionDAG and GlobalISel.

llvm-svn: 366234

5 years ago[pstl] Use std::transform_reduce instead of hand-rolled implementation
Louis Dionne [Tue, 16 Jul 2019 17:29:09 +0000 (17:29 +0000)]
[pstl] Use std::transform_reduce instead of hand-rolled implementation

llvm-svn: 366233

5 years ago[NFC] Fix -Wreorder warning in TBB backend
Louis Dionne [Tue, 16 Jul 2019 17:29:03 +0000 (17:29 +0000)]
[NFC] Fix -Wreorder warning in TBB backend

llvm-svn: 366232

5 years agofix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic
Yonghong Song [Tue, 16 Jul 2019 17:24:33 +0000 (17:24 +0000)]
fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic

The original commit is r366076. It is temporarily reverted (r366155)
due to test failure. This resubmit makes test more robust by accepting
regex instead of hardcoded names/references in several places.

This is a followup patch for https://reviews.llvm.org/D61809.
Handle unnamed bitfield properly and add more test cases.

Fixed the unnamed bitfield issue. The unnamed bitfield is ignored
by debug info, so we need to ignore such a struct/union member
when we try to get the member index in the debug info.

D61809 contains two test cases but not enough as it does
not checking generated IRs in the fine grain level, and also
it does not have semantics checking tests.
This patch added unit tests for both code gen and semantics checking for
the new intrinsic.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 366231

5 years agoAMDGPU: Fix missing immarg for mfma intrinsics
Matt Arsenault [Tue, 16 Jul 2019 17:22:21 +0000 (17:22 +0000)]
AMDGPU: Fix missing immarg for mfma intrinsics

llvm-svn: 366230

5 years ago[OpenMP] Move header inclusion out of 'extern "C"'
Jonas Hahnfeld [Tue, 16 Jul 2019 17:16:43 +0000 (17:16 +0000)]
[OpenMP] Move header inclusion out of 'extern "C"'

This leads to problems when compiling C++ code with libc++ for Nvidia GPUs
because Clang now uses wrappers for math functions that might include
C++ templates not allowed in 'extern "C"'.

Differentiel Revision: https://reviews.llvm.org/D64625

llvm-svn: 366229

5 years agoRemoved -mno-omit-leaf-frame-pointer from flags.
Mitch Phillips [Tue, 16 Jul 2019 17:13:02 +0000 (17:13 +0000)]
Removed -mno-omit-leaf-frame-pointer from flags.

Removes -mno-omit-leaf-frame-pointer from Scudo and GWP-ASan's CFlags. Attempt to fix
the sanitizer buildbots.

llvm-svn: 366228

5 years ago[CMake] Add Apple-lldb-Xcode.cmake cache that avoids install options
Stefan Granitz [Tue, 16 Jul 2019 16:57:45 +0000 (16:57 +0000)]
[CMake] Add Apple-lldb-Xcode.cmake cache that avoids install options

llvm-svn: 366226

5 years ago[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.10
Julian Lettner [Tue, 16 Jul 2019 16:22:04 +0000 (16:22 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.10

Remove now-unused assembly code for determining xor key on
Linux/AArch64. This is the final commit of this refactoring.

llvm-svn: 366225

5 years ago[OPENMP][NVPTX]Fixed checks for cuda versions.
Alexey Bataev [Tue, 16 Jul 2019 16:07:10 +0000 (16:07 +0000)]
[OPENMP][NVPTX]Fixed checks for cuda versions.

Summary:
We used CUDART_VERSION macro to check for the installed cuda version
but this macro is defined in cuda_runtime_api.h, which is not used by
project. Better to use CUDA_VERSION macro, which is defined in cuda.h.
Also, added the check if this macro is defined. If macro is undefined,
there is something wrong with the cuda configuration and we should not
continue the compilation.
This also fixes problems with runtime building in cuda 10+.

Reviewers: grokos

Subscribers: guansong, jdoerfert, caomhin, kkwli0, openmp-commits

Tags: #openmp

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

llvm-svn: 366224

5 years ago[AMDGPU] Add the adjusted FP as a livein register.
Michael Liao [Tue, 16 Jul 2019 15:57:12 +0000 (15:57 +0000)]
[AMDGPU] Add the adjusted FP as a livein register.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366223

5 years ago[Strict FP] Allow more relaxed scheduling
Ulrich Weigand [Tue, 16 Jul 2019 15:55:45 +0000 (15:55 +0000)]
[Strict FP] Allow more relaxed scheduling

Reimplement scheduling constraints for strict FP instructions in
ScheduleDAGInstrs::buildSchedGraph to allow for more relaxed
scheduling.  Specifially, allow one strict FP instruction to
be scheduled across another, as long as it is not moved across
any global barrier.

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

Reviewed By: cameron.mcinally

llvm-svn: 366222

5 years agoRevert "[swig] Add workaround for old swig"
Jonas Devlieghere [Tue, 16 Jul 2019 15:54:33 +0000 (15:54 +0000)]
Revert "[swig] Add workaround for old swig"

With the deprecation of swig 1.x (r366213), this workaround should no
longer be necessary.

llvm-svn: 366221

5 years ago[OPENMP]Fix threadid in __kmpc_omp_taskwait call for dependent target calls.
Alexey Bataev [Tue, 16 Jul 2019 15:51:32 +0000 (15:51 +0000)]
[OPENMP]Fix threadid in __kmpc_omp_taskwait call for dependent target calls.

Summary:
We used to call __kmpc_omp_taskwait function with global threadid set to
0. It may crash the application at the runtime if the thread executing
 target region is not a master thread.

Reviewers: grokos, kkwli0

Subscribers: guansong, jdoerfert, caomhin, openmp-commits

Tags: #openmp

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

llvm-svn: 366220

5 years agoRevert [tools] [llvm-nm] Default to reading from stdin not a.out
Alex Brachet [Tue, 16 Jul 2019 15:33:43 +0000 (15:33 +0000)]
Revert [tools] [llvm-nm] Default to reading from stdin not a.out

This reverts r365889 (git commit 60c81354b1d3fced1bd284d334f118d2d792ab4b)

llvm-svn: 366219

5 years agoAdd missing test for r366215
Amara Emerson [Tue, 16 Jul 2019 15:28:29 +0000 (15:28 +0000)]
Add missing test for r366215

llvm-svn: 366218

5 years ago[Remarks] Simplify and refactor the RemarkParser interface
Francis Visoiu Mistrih [Tue, 16 Jul 2019 15:25:05 +0000 (15:25 +0000)]
[Remarks] Simplify and refactor the RemarkParser interface

Before, everything was based on some kind of type erased parser
implementation which container a lot of boilerplate code when multiple
formats were to be supported.

This simplifies it by:

* the remark now owns its arguments
* *always* returning an error from the implementation side
* working around the way the YAML parser reports errors: catch them through
callbacks and re-insert them in a proper llvm::Error
* add a CParser wrapper that is used when implementing the C API to
avoid cluttering the C++ API with useless state
* LLVMRemarkParserGetNext now returns an object that needs to be
released to avoid leaking resources
* add a new API to dispose of a remark entry: LLVMRemarkEntryDispose

llvm-svn: 366217

5 years ago[Remarks][NFC] Combine ParserFormat and SerializerFormat
Francis Visoiu Mistrih [Tue, 16 Jul 2019 15:24:59 +0000 (15:24 +0000)]
[Remarks][NFC] Combine ParserFormat and SerializerFormat

It's useless to have both.

llvm-svn: 366216

5 years ago[ADCE] Fix non-deterministic behaviour due to iterating over a pointer set.
Amara Emerson [Tue, 16 Jul 2019 15:23:10 +0000 (15:23 +0000)]
[ADCE] Fix non-deterministic behaviour due to iterating over a pointer set.

Original patch by Yann Laigle-Chapuy

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

llvm-svn: 366215

5 years ago[DAGCombiner] fold (addcarry (xor a, -1), b, c) -> (subcarry b, a, !c) and flip carry.
Amaury Sechet [Tue, 16 Jul 2019 15:17:00 +0000 (15:17 +0000)]
[DAGCombiner] fold (addcarry (xor a, -1), b, c) -> (subcarry b, a, !c) and flip carry.

Summary:
As per title. DAGCombiner only mathes the special case where b = 0, this patches extends the pattern to match any value of b.

Depends on D57302

Reviewers: hfinkel, RKSimon, craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 366214

5 years ago[SWIG] Deprecate SWIG 1.x
Jonas Devlieghere [Tue, 16 Jul 2019 15:14:01 +0000 (15:14 +0000)]
[SWIG] Deprecate SWIG 1.x

The last swig 1.x release dates from 2009, now 10 years ago. Recently, I
fixed an issue that prevented us from using swig 4 (r364974), which
turned out to be not backward compatible with swig 1.x (r365718).

This patch deprecates this (really old) version of swig and makes swig 2
the minimum supported version in LLDB . This should be fine for the
build bots, which are all running swig 3 or later.

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

llvm-svn: 366213

5 years ago[OpenCL] Fixing sampler initialisations for C++ mode.
Neil Hickey [Tue, 16 Jul 2019 14:57:32 +0000 (14:57 +0000)]
[OpenCL] Fixing sampler initialisations for C++ mode.

Allow conversions between integer and sampler type.

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

llvm-svn: 366212

5 years ago[OPENMP]Add support for analysis of if clauses.
Alexey Bataev [Tue, 16 Jul 2019 14:51:46 +0000 (14:51 +0000)]
[OPENMP]Add support for analysis of if clauses.

Summary:
Added support for analysis of if clauses in the OpenMP directives to be
able to check for the use of uninitialized variables.

Reviewers: NoQ

Subscribers: guansong, jfb, jdoerfert, caomhin, kkwli0, cfe-commits

Tags: clang

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

llvm-svn: 366211

5 years agoAMDGPU/GlobalISel: Fix test failures in release build
Matt Arsenault [Tue, 16 Jul 2019 14:28:30 +0000 (14:28 +0000)]
AMDGPU/GlobalISel: Fix test failures in release build

Apparently the check for legal instructions during instruction
select does not happen without an asserts build, so these would
successfully select in release, and fail in debug.

Make s16 and/or/xor legal. These can just be selected directly
to the 32-bit operation, as is already done in SelectionDAG, so just
make them legal.

llvm-svn: 366210

5 years ago[llvm-ar][test] Add to llvm-ar test coverage
Owen Reynolds [Tue, 16 Jul 2019 14:25:37 +0000 (14:25 +0000)]
[llvm-ar][test] Add to llvm-ar test coverage

This change adds tests to cover existing llvm-ar functionality.
print.test is omitted due to failing on Darwin.

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

llvm-svn: 366209

5 years ago[pstl] Fix compilation with TBB backend
Louis Dionne [Tue, 16 Jul 2019 13:45:10 +0000 (13:45 +0000)]
[pstl] Fix compilation with TBB backend

Some types were not using the right namespace qualification.

llvm-svn: 366208

5 years ago[clangd] Added highlighting for the targets in typedefs and using.
Johan Vikstrom [Tue, 16 Jul 2019 13:23:12 +0000 (13:23 +0000)]
[clangd] Added highlighting for the targets in typedefs and using.

Summary:
In `typedef int A` the `A` was not highlighted previously.

This patch gives `A` the same kind of highlighting that the underlying type has (class/enum) (which in this example is no special highlighting because builtins are not handled yet)
Will add highlightings for built ins in another patch.

Reviewers: hokein, sammccall, ilya-biryukov

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

Tags: #clang

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

llvm-svn: 366207

5 years agoReapply [llvm-ar][test] Increase llvm-ar test coverage
Owen Reynolds [Tue, 16 Jul 2019 12:53:59 +0000 (12:53 +0000)]
Reapply [llvm-ar][test] Increase llvm-ar test coverage

This reapplies 365316 without extract.test due to failing on Darwin.

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

llvm-svn: 366206

5 years agoremove a duplicate declaration
Sylvestre Ledru [Tue, 16 Jul 2019 12:05:54 +0000 (12:05 +0000)]
remove a duplicate declaration

llvm-svn: 366205

5 years agoDocument the LLVM_ENABLE_BINDINGS option
Sylvestre Ledru [Tue, 16 Jul 2019 11:59:17 +0000 (11:59 +0000)]
Document the LLVM_ENABLE_BINDINGS option

llvm-svn: 366204

5 years ago[Object/llvm-readelf/llvm-readobj] - Improve error reporting when e_shstrndx is broken.
George Rimar [Tue, 16 Jul 2019 11:07:30 +0000 (11:07 +0000)]
[Object/llvm-readelf/llvm-readobj] - Improve error reporting when e_shstrndx is broken.

When e_shstrndx is broken, it is impossible to get a section name.
In this patch I improved the error message we show and
added tests for Object and for llvm-readelf/llvm-readobj

Message was changed in two places:
1) llvm-readelf/llvm-readobj previously used a code from Object/ELF.h,
now they have a modified version of it (it has less checks and allows
dumping broken things).
2) Code in Object/ELF.h is still used for generic cases.

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

llvm-svn: 366203

5 years ago[Driver] Don't pass --dynamic-linker to ld on Solaris
Rainer Orth [Tue, 16 Jul 2019 11:06:43 +0000 (11:06 +0000)]
[Driver] Don't pass --dynamic-linker to ld on Solaris

I noticed that clang currently passes --dynamic-linker to ld.  This has been the case
since Solaris 11 support was added initially back in 2012 by David Chisnall (r150580).
I couldn't find any patch submission, let alone a justification, for this, and it seems
completely useless: --dynamic-linker is a gld compatibility form of the option, the
native option being -I.  First of all, however, the dynamic linker passed is simply the
default, so there's no reason at all to specify it in the first place.

This patch removes passing the option and adjusts the affected testcase accordingly.

Tested on x86_64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

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

llvm-svn: 366202

5 years agoReapply [llvm-ar][test] Add to MRI test coverage
Owen Reynolds [Tue, 16 Jul 2019 11:02:11 +0000 (11:02 +0000)]
Reapply [llvm-ar][test] Add to MRI test coverage

This reapplies 363232 without mri-utf8.test due to failing on Darwin.

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

llvm-svn: 366201