platform/upstream/llvm.git
5 years agoAdding inline comments to code view type record directives for better readability
Nilanjana Basu [Wed, 17 Jul 2019 21:01:12 +0000 (21:01 +0000)]
Adding inline comments to code view type record directives for better readability

llvm-svn: 366372

5 years ago[PEI] Don't re-allocate a pre-allocated stack protector slot
Francis Visoiu Mistrih [Wed, 17 Jul 2019 20:46:19 +0000 (20:46 +0000)]
[PEI] Don't re-allocate a pre-allocated stack protector slot

The LocalStackSlotPass pre-allocates a stack protector and makes sure
that it comes before the local variables on the stack.

We need to make sure that later during PEI we don't re-allocate a new
stack protector slot. If that happens, the new stack protector slot will
end up being **after** the local variables that it should be protecting.

Therefore, we would have two slots assigned for two different stack
protectors, one at the top of the stack, and one at the bottom. Since
PEI will overwrite the assigned slot for the stack protector, the load
that is used to compare the value of the stack protector will use the
slot assigned by PEI, which is wrong.

For this, we need to check if the object is pre-allocated, and re-use
that pre-allocated slot.

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

llvm-svn: 366371

5 years ago[CodeGen] Add stack protector tests where the guard gets re-assigned
Francis Visoiu Mistrih [Wed, 17 Jul 2019 20:46:16 +0000 (20:46 +0000)]
[CodeGen] Add stack protector tests where the guard gets re-assigned

In preparation of a fix, add tests for multiple backends.

llvm-svn: 366370

5 years ago[CodeGen][NFC] Simplify checks for stack protector index checking
Francis Visoiu Mistrih [Wed, 17 Jul 2019 20:46:09 +0000 (20:46 +0000)]
[CodeGen][NFC] Simplify checks for stack protector index checking

Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex() >=
0`.

llvm-svn: 366369

5 years agoRenamed and changed the wording of warn_cconv_ignored
Sunil Srivastava [Wed, 17 Jul 2019 20:41:26 +0000 (20:41 +0000)]
Renamed and changed the wording of warn_cconv_ignored

As discussed in D64780 the wording of this warning message is being
changed to say 'is not supported' instead of 'ignored', and the
diag ID itself is being changed to warn_cconv_not_supported.

llvm-svn: 366368

5 years agoGlobalISel: Handle widenScalar of arbitrary G_MERGE_VALUES sources
Matt Arsenault [Wed, 17 Jul 2019 20:22:44 +0000 (20:22 +0000)]
GlobalISel: Handle widenScalar of arbitrary G_MERGE_VALUES sources

Extract the sources to the GCD of the original size and target size,
padding with implicit_def as necessary.

Also fix the case where the requested source type is wider than the
original result type. This was ignoring the type, and just using the
destination. Do the operation in the requested type and truncate back.

llvm-svn: 366367

5 years agoGlobalISel: Handle more cases for widenScalar of G_MERGE_VALUES
Matt Arsenault [Wed, 17 Jul 2019 20:22:38 +0000 (20:22 +0000)]
GlobalISel: Handle more cases for widenScalar of G_MERGE_VALUES

Use an anyext to the requested type for the leftover operand to
produce a slightly wider type, and then truncate the final merge.

I have another implementation almost ready which handles arbitrary
widens, but I think it produces worse code in this example (which I
think is 90% due to not folding redundant copies or folding out
implicit_def users), so I wanted to add this as a baseline first.

llvm-svn: 366366

5 years agoFix CreateFunctionTemplateSpecialization to prevent dangling poiner to stack memory
Shafik Yaghmour [Wed, 17 Jul 2019 20:16:13 +0000 (20:16 +0000)]
Fix CreateFunctionTemplateSpecialization to prevent dangling poiner to stack memory

In ClangASTContext::CreateFunctionTemplateSpecializationInfo a TemplateArgumentList is allocated on the stack but is treated as if it is persistent in subsequent calls. When we exit the function func_decl will still point to the stack allocated memory. We will use TemplateArgumentList::CreateCopy instead which will allocate memory out of the DeclContext.

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

llvm-svn: 366365

5 years ago[docs] Adjust variable formatting table
Jonas Devlieghere [Wed, 17 Jul 2019 19:49:01 +0000 (19:49 +0000)]
[docs] Adjust variable formatting table

While the in-place hints on valid formats are up to date (e.g. when
choosing an invalid format expr -f nonExisting -- 42), the corresponding
online docs table is not. The formats "address", "hex float",
"instruction" and "void" are missing, and "decimal" refers to an
outdated abbreviation 'i' instead of 'd'.

Patch by: Lukas Böger

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

llvm-svn: 366364

5 years ago[CMake] Remove duplicated logic to find Python when doing a standalone build
Jonas Devlieghere [Wed, 17 Jul 2019 19:36:20 +0000 (19:36 +0000)]
[CMake] Remove duplicated logic to find Python when doing a standalone build

I'm pretty sure there's no need to have this logic living in
LLDBStandalone. It doesn't appear anything in LLVM depends on this, and
We always go through LLDBConfig.cmake which has the canonical way to
find the Python libs and interpreter for LLDB.

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

llvm-svn: 366363

5 years ago[CMake] Use LLVM_DIR and Clang_DIR for standalone builds.
Jonas Devlieghere [Wed, 17 Jul 2019 19:24:15 +0000 (19:24 +0000)]
[CMake] Use LLVM_DIR and Clang_DIR for standalone builds.

When doing a standalone build, without setting LLDB_PATH_TO_LLVM_BUILD
or LLDB_PATH_TO_CLANG_BUILD, you get the following error.

```
CMake Error at cmake/modules/LLDBStandalone.cmake:23 (find_package):
  Could not find a package configuration file provided by "LLVM" with any of
  the following names:

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.
```

This suggests setting LLVM_DIR to LLVM's install directory. However,
LLDBStandalone.cmake takes LLDB_PATH_TO_LLVM_BUILD as its hint. As
someone who isn't familiar with the standalone process, this is rather
confusing. This patch removes LLDB_PATH_TO_LLVM_BUILD and
LLDB_PATH_TO_CLANG_BUILD and instead use LLVM_DIR and Clang_DIR
respectively.

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

llvm-svn: 366362

5 years agoBasic MTE stack tagging instrumentation.
Evgeniy Stepanov [Wed, 17 Jul 2019 19:24:12 +0000 (19:24 +0000)]
Basic MTE stack tagging instrumentation.

Summary:
Use MTE intrinsics to tag stack variables in functions with
sanitize_memtag attribute.

Reviewers: pcc, vitalybuka, hctim, ostannard

Subscribers: srhines, mgorny, javed.absar, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366361

5 years agoBasic codegen for MTE stack tagging.
Evgeniy Stepanov [Wed, 17 Jul 2019 19:24:02 +0000 (19:24 +0000)]
Basic codegen for MTE stack tagging.

Implement IR intrinsics for stack tagging. Generated code is very
unoptimized for now.

Two special intrinsics, llvm.aarch64.irg.sp and llvm.aarch64.tagp are
used to implement a tagged stack frame pointer in a virtual register.

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

llvm-svn: 366360

5 years ago[libc++] XFAIL a test that does not behave properly on older Clang
Louis Dionne [Wed, 17 Jul 2019 18:54:29 +0000 (18:54 +0000)]
[libc++] XFAIL a test that does not behave properly on older Clang

rdar://53015486

llvm-svn: 366359

5 years ago[lld][WebAssembly] Fix handling of comdat functions in init array.
Sam Clegg [Wed, 17 Jul 2019 18:43:36 +0000 (18:43 +0000)]
[lld][WebAssembly] Fix handling of comdat functions in init array.

When hidden symbols are discarded by comdat rules we still want to
create a local defined symbol, otherwise `Symbol::isDiscarded()` relies
on begin able to check `getChunk->discarded`.

This is a followup on rL362769. The comdat.ll test was previously GC'ing
the `__wasm_call_ctors` functions so `do_init` was not actually being
included in the link.  Once that function was included in triggered the
crash bug that this change addresses.

Fixes: https://github.com/emscripten-core/emscripten/issues/8981

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

llvm-svn: 366358

5 years ago[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.
Alexey Bataev [Wed, 17 Jul 2019 18:03:39 +0000 (18:03 +0000)]
[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.

Fixed processing of the CapturedStmt children to fix the crash of the
OpenMP constructs during analysis.

llvm-svn: 366357

5 years ago[dotest] Disable color while testing.
Jonas Devlieghere [Wed, 17 Jul 2019 17:56:57 +0000 (17:56 +0000)]
[dotest] Disable color while testing.

Disable colors so we don't risk having unexpected ANSI codes in the test
output. Currently, the behavior of a test can change depending on
whether it's run under a color-supporting terminal, or under a dummy
terminal, for example when using lit or multiprocessing.

llvm-svn: 366356

5 years agoRevert [AArch64] Add support for Transactional Memory Extension (TME)
Momchil Velikov [Wed, 17 Jul 2019 17:43:32 +0000 (17:43 +0000)]
Revert [AArch64] Add support for Transactional Memory Extension (TME)

This reverts r366322 (git commit 4b8da3a503e434ddbc08ecf66582475765f449bc)

llvm-svn: 366355

5 years ago[clang-tidy] Exclude forward decls from fuchsia-multiple-inheritance
Julie Hockett [Wed, 17 Jul 2019 17:40:53 +0000 (17:40 +0000)]
[clang-tidy] Exclude forward decls from fuchsia-multiple-inheritance

Addresses b39770.

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

llvm-svn: 366354

5 years ago[clang-tidy] Fix crash on end location inside macro
Nathan Huckleberry [Wed, 17 Jul 2019 17:22:43 +0000 (17:22 +0000)]
[clang-tidy] Fix crash on end location inside macro

Summary:
Lexer::getLocForEndOfToken is defined to return an
invalid location if the given location is inside a macro.
Other checks conditionally warn based off location
validity. Updating this check to do the same.

Reviewers: JonasToth, aaron.ballman, nickdesaulniers

Reviewed By: nickdesaulniers

Subscribers: lebedev.ri, nickdesaulniers, xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 366353

5 years ago[Test] Add module cache for TestWeakSymbols
Jonas Devlieghere [Wed, 17 Jul 2019 17:22:29 +0000 (17:22 +0000)]
[Test] Add module cache for TestWeakSymbols

Explicitly set the module cache in the Makefile with
-fmodules-cache-path.

llvm-svn: 366352

5 years ago[Docs][OpenCL] Documentation of C++ for OpenCL mode
Anastasia Stulova [Wed, 17 Jul 2019 17:21:31 +0000 (17:21 +0000)]
[Docs][OpenCL] Documentation of C++ for OpenCL mode

Added documentation of C++ for OpenCL mode into Clang
User Manual and Language Extensions document.

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

llvm-svn: 366351

5 years ago[CMake] Avoid liblldb genex when figuring out the copy destination for framework...
Stefan Granitz [Wed, 17 Jul 2019 17:14:40 +0000 (17:14 +0000)]
[CMake] Avoid liblldb genex when figuring out the copy destination for framework tools

This genex created an order-only dependency to liblldb for every framework tool. It reduced build throughput in the first half of the compilation and pulled in unnecessary build units, e.g. debugserver required ~900 build units. With this change debugserver is (again) down at 52 build units!

llvm-svn: 366350

5 years ago[OPENMP] Resolve lost LoopTripCnt for subsequent loops in same thread.
Ron Lieberman [Wed, 17 Jul 2019 17:07:52 +0000 (17:07 +0000)]
[OPENMP] Resolve lost LoopTripCnt for subsequent loops in same thread.

Remove loopTripCnt from threaded device stack after consuming it.
Added a libomptarget DP message to aid in future debugging and to
validate the added testcase, which only runs in Debug build.

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

llvm-svn: 366349

5 years ago[AMDGPU] Tune inlining parameters for AMDGPU target
Daniil Fukalov [Wed, 17 Jul 2019 16:51:29 +0000 (16:51 +0000)]
[AMDGPU] Tune inlining parameters for AMDGPU target

Summary:
Since the target has no significant advantage of vectorization,
vector instructions bous threshold bonus should be optional.

amdgpu-inline-arg-alloca-cost parameter default value and the target
InliningThresholdMultiplier value tuned then respectively.

Reviewers: arsenm, rampitec

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

Tags: #llvm

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

llvm-svn: 366348

5 years ago[lldb] Make log for ClangModulesDeclVendor's compiler flag less verbose
Raphael Isemann [Wed, 17 Jul 2019 16:51:16 +0000 (16:51 +0000)]
[lldb] Make log for ClangModulesDeclVendor's compiler flag less verbose

Summary:
Currently the ClangModulesDeclVendor is spamming the expression log with the compiler flags it is using, which creates a log that looks like this:

```
clang

 -fmodules

 -fimplicit-module-maps
```

This patch removes all these newlines and just prints the compiler flags in one line as you see in the command line:

```
clang -fmodules -fimplicit-module-maps [...]
```

Reviewers: shafik, davide

Reviewed By: davide

Subscribers: davide, abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 366347

5 years ago[CMake] Move standalone check so we don't have to reconfigure LLDB
Jonas Devlieghere [Wed, 17 Jul 2019 16:47:02 +0000 (16:47 +0000)]
[CMake] Move standalone check so we don't have to reconfigure LLDB

By moving the standalone check into the main CMake file, the whole file
is ignored in a regular (non-standalone) build. This means that you can
make changes to LLDBStandalone.cmake without having to reconfigure a
build in a different directory. This matters when you share one source
repository with different build directories (e.g. release-assert, debug,
standalone).

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

llvm-svn: 366346

5 years ago[NativePDB] Add a FromCompilerDecl for going from lldb -> clang
Nathan Lanza [Wed, 17 Jul 2019 16:43:36 +0000 (16:43 +0000)]
[NativePDB] Add a FromCompilerDecl for going from lldb -> clang

Summary:
A common transformation in NativePDB is to go from lldb types to clang
types and vice versa. This function automates one of those steps.

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

llvm-svn: 366345

5 years ago[ORC] Add deprecation warnings to ORCv1 layers and utilities.
Lang Hames [Wed, 17 Jul 2019 16:40:52 +0000 (16:40 +0000)]
[ORC] Add deprecation warnings to ORCv1 layers and utilities.

Summary:
ORCv1 is deprecated. The current aim is to remove it before the LLVM 10.0
release. This patch adds deprecation attributes to the ORCv1 layers and
utilities to warn clients of the change.

Reviewers: dblaikie, sgraenitz, AlexDenisov

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 366344

5 years ago[RISCV] Revert r366331 as it exposed some sanitizer failures
Alex Bradbury [Wed, 17 Jul 2019 16:14:52 +0000 (16:14 +0000)]
[RISCV] Revert r366331 as it exposed some sanitizer failures

See <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/33612>.

llvm-svn: 366343

5 years ago[ASan] Support `{f}puts(NULL)` on Darwin
Julian Lettner [Wed, 17 Jul 2019 16:09:25 +0000 (16:09 +0000)]
[ASan] Support `{f}puts(NULL)` on Darwin

On Darwin, the man page states that "both fputs() and puts() print
`(null)' if str is NULL."

rdar://48227136

Reviewed By: Lekensteyn

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

llvm-svn: 366342

5 years agoRemove REQUIRES OMP spec version within lit tests
Jonathan Peyton [Wed, 17 Jul 2019 15:41:00 +0000 (15:41 +0000)]
Remove REQUIRES OMP spec version within lit tests

This is a follow up patch to D64534 (r365963) which removed all OMP
spec versioning within the OpenMP runtime codebase.  This patch removes
REQUIRES: openmp-x.y lines from lit tests.

llvm-svn: 366341

5 years agoAMDGPU: Use getTargetConstant
Matt Arsenault [Wed, 17 Jul 2019 15:35:36 +0000 (15:35 +0000)]
AMDGPU: Use getTargetConstant

Avoids creating an extra intermediate mov.

llvm-svn: 366340

5 years agoFix MSVC 'implicitly capture' compile error. NFCI.
Simon Pilgrim [Wed, 17 Jul 2019 15:31:53 +0000 (15:31 +0000)]
Fix MSVC 'implicitly capture' compile error. NFCI.

llvm-svn: 366339

5 years ago[clangd] Type hierarchy: don't resolve parents if the client only asked for children
Nathan Ridge [Wed, 17 Jul 2019 15:26:49 +0000 (15:26 +0000)]
[clangd] Type hierarchy: don't resolve parents if the client only asked for children

Summary: Also reorganize the code for computing supertypes to make it more symmetric to subtypes.

Reviewers: kadircet

Reviewed By: kadircet

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

Tags: #clang

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

llvm-svn: 366338

5 years ago[clang-tidy] Adjust location of namespace comment diagnostic
Ilya Biryukov [Wed, 17 Jul 2019 15:22:14 +0000 (15:22 +0000)]
[clang-tidy] Adjust location of namespace comment diagnostic

Summary:
If there is no comment, place it at the closing brace of a namespace
definition. Previously it was placed at the next character after the
closing brace.

The new position produces a better location for highlighting in clangd
and does not seem to make matters worse for clang-tidy.

Reviewers: alexfh, hokein

Reviewed By: alexfh, hokein

Subscribers: xazax.hun, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 366337

5 years ago[OPENMP]Fix crash in LoopCounterRefChecker when MemberExpr is not Var or Field
Mike Rice [Wed, 17 Jul 2019 15:18:45 +0000 (15:18 +0000)]
[OPENMP]Fix crash in LoopCounterRefChecker when MemberExpr is not Var or Field

checkDecl is only valid for VarDecls or FieldDecls, since getCanonicalDecl
expects only these. Prevent other Decl kinds (such as CXXMethodDecls and
EnumConstantDecls) from entering and asserting.

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

llvm-svn: 366336

5 years ago[Attributor] Deduce "willreturn" function attribute
Hideto Ueno [Wed, 17 Jul 2019 15:15:43 +0000 (15:15 +0000)]
[Attributor] Deduce "willreturn" function attribute

Summary:
Deduce the "willreturn" attribute for functions.

For now, intrinsics are not willreturn. More annotation will be done in another patch.

Reviewers: jdoerfert

Subscribers: jvesely, nhaehnle, nicholas, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366335

5 years ago[llvm-ar][test] Add tests failing on Darwin
Owen Reynolds [Wed, 17 Jul 2019 15:10:02 +0000 (15:10 +0000)]
[llvm-ar][test] Add tests failing on Darwin

These tests that failed on Darwin but passed on other machines due to the default archive format differing
on a Darwin machine, and what looks to be bugs in the output of this format.
I can not investigate these issue further so the tests are considered expected failures on Darwin.

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

llvm-svn: 366334

5 years ago[lld] Add Visual Studio compatible diagnostics
Chris Jackson [Wed, 17 Jul 2019 14:54:02 +0000 (14:54 +0000)]
[lld] Add Visual Studio compatible diagnostics

Summary:
Add a --vs-diagnostics flag that alters the format of diagnostic output
to enable source hyperlinks in Visual Studio.

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

Reviewed by: ruiu

llvm-svn: 366333

5 years ago[ASTImporter] Fix structural eq of lambdas
Gabor Marton [Wed, 17 Jul 2019 14:40:09 +0000 (14:40 +0000)]
[ASTImporter] Fix structural eq of lambdas

Summary:
The structural equivalence check reported false eq between lambda classes
with different parameters in their call signature.
The solution is to check the methods for equality too in case of lambda
classes.

Reviewers: a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 366332

5 years ago[RISCV] Add RISCV to LLVM_ALL_TARGETS so it s built by default
Alex Bradbury [Wed, 17 Jul 2019 14:32:25 +0000 (14:32 +0000)]
[RISCV] Add RISCV to LLVM_ALL_TARGETS so it s built by default

This follows the RFC <http://lists.llvm.org/pipermail/llvm-dev/2019-July/133724.html>.

Follow-on commits will add appropriate release notes changes etc.

Pushing this now and in a minimal form so there is reasonable time before 9.0
branches to resolve any issues arising from e.g. the backend being exposed on
different sanitizer setups.

The current builder for RISC-V is on the staging build-bot
<http://lab.llvm.org:8014/builders/llvm-riscv-linux>, however with the RISCV
backend being built by default it won't provide any real additional coverage.
We will shortly set up a builder that runs the test-suite in qemu-user.

llvm-svn: 366331

5 years ago[RISCV][NFC] Remove outdated TODO from test/CodeGen/RISCV/dwarf-eh.ll
Alex Bradbury [Wed, 17 Jul 2019 14:04:48 +0000 (14:04 +0000)]
[RISCV][NFC] Remove outdated TODO from test/CodeGen/RISCV/dwarf-eh.ll

llvm-svn: 366330

5 years ago[AsmPrinter] Make the encoding of call sites in .gcc_except_table configurable and...
Alex Bradbury [Wed, 17 Jul 2019 14:00:35 +0000 (14:00 +0000)]
[AsmPrinter] Make the encoding of call sites in .gcc_except_table configurable and use for RISC-V

The original behavior was to always emit the offsets to each call site in the
call site table as uleb128 values, however on some architectures (eg RISCV)
these uleb128 offsets into the code cannot always be resolved until link time
(because relaxation will invalidate any calculated offsets), and there are no
appropriate relocations for uleb128 values. As a consequence it needs to be
possible to specify an alternative.

This also switches RISCV to use DW_EH_PE_udata4 for call side encodings in
.gcc_except_table

Differential Revision: https://reviews.llvm.org/D63415
Patch by Edward Jones.

llvm-svn: 366329

5 years agoMips: Remove immarg from copy and insert intrinsics
Matt Arsenault [Wed, 17 Jul 2019 13:55:01 +0000 (13:55 +0000)]
Mips: Remove immarg from copy and insert intrinsics

These intrinsics do in fact work with non-constant index arguments.

These are lowered to either the generic
ISD::INSERT_VECTOR_ELT/ISD::EXTRACT_VECTOR_ELT, or to
VEXTRACT_SEXT_ELT. The handling of these all accept variable
indexes. Turning these into generic instructions which do allow
variables introduces complications in a future change to immarg
handling.

Since these just turn into generic instructions, these are kind of
pointless and should probably just be autoupgraded to
extractelement/insertelement.

llvm-svn: 366328

5 years ago[RISCV] Set correct encodings for DWARF exception handling
Alex Bradbury [Wed, 17 Jul 2019 13:54:38 +0000 (13:54 +0000)]
[RISCV] Set correct encodings for DWARF exception handling

This patch sets correct encodings for DWARF exception handling for RISC-V
(other than call site encoding, which must be udata4 rather than uleb128 and
is handled by D63415).

This has the same intend as D63409, except this version matches GCC/binutils
behaviour which uses the same encodings regardless of PIC/non-PIC and
medlow/medany code model.

llvm-svn: 366327

5 years ago[RISCV][NFC] Add tests that capture current encodings for DWARF EH
Alex Bradbury [Wed, 17 Jul 2019 13:48:49 +0000 (13:48 +0000)]
[RISCV][NFC] Add tests that capture current encodings for DWARF EH

Items which are known to be wrong/different vs GCC are marked as TODO and will
be address in follow-up patches.

llvm-svn: 366326

5 years ago[ASTImporter] Fix LLDB lookup in transparent ctx and with ext src
Gabor Marton [Wed, 17 Jul 2019 13:47:46 +0000 (13:47 +0000)]
[ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

Summary:
With LLDB we use localUncachedLookup(), however, that fails to find
Decls when a transparent context is involved and the given DC has
external lexical storage.  The solution is to use noload_lookup, which
works well with transparent contexts.  But, we cannot use only the
noload_lookup since the slow case of localUncachedLookup is still needed
in some other cases.

These other cases are handled in ASTImporterLookupTable, but we cannot
use that with LLDB since that traverses through the AST which initiates
the load of external decls again via DC::decls().

We must avoid loading external decls during the import becuase
ExternalASTSource is implemented with ASTImporter, so external loads
during import results in uncontrolled and faulty import.

Reviewers: shafik, teemperor, jingham, clayborg, a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits

Tags: #clang, #lldb

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

llvm-svn: 366325

5 years ago[llvm-ar][test] \r\n -> \n
Fangrui Song [Wed, 17 Jul 2019 13:40:42 +0000 (13:40 +0000)]
[llvm-ar][test] \r\n -> \n

Also simplify some empty output tests with 'count 0'

llvm-svn: 366324

5 years ago[AMDGPU] Optimize atomic AND/OR/XOR
Jay Foad [Wed, 17 Jul 2019 13:40:03 +0000 (13:40 +0000)]
[AMDGPU] Optimize atomic AND/OR/XOR

Summary: Extend the atomic optimizer to handle AND, OR and XOR.

Reviewers: arsenm, sheredom

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

Tags: #llvm

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

llvm-svn: 366323

5 years ago[AArch64] Add support for Transactional Memory Extension (TME)
Momchil Velikov [Wed, 17 Jul 2019 13:23:27 +0000 (13:23 +0000)]
[AArch64] Add support for Transactional Memory Extension (TME)

TME is a future architecture technology, documented in

https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools
https://developer.arm.com/docs/ddi0601/a

More about the future architectures:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/new-technologies-for-the-arm-a-profile-architecture

This patch adds support for the TME instructions TSTART, TTEST, TCOMMIT, and
TCANCEL and the target feature/arch extension "tme".

It also implements TME builtin functions, defined in ACLE Q2 2019
(https://developer.arm.com/docs/101028/latest)

Patch by Javed Absar and Momchil Velikov

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

llvm-svn: 366322

5 years ago[clangd] Force the required interpretation of #import on windows tests.
Sam McCall [Wed, 17 Jul 2019 13:21:25 +0000 (13:21 +0000)]
[clangd] Force the required interpretation of #import on windows tests.

Summary: NFC but should fix a bunch of tests.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 366321

5 years ago[clangd] Handle windows line endings in QueryDriver
Kadir Cetinkaya [Wed, 17 Jul 2019 13:14:02 +0000 (13:14 +0000)]
[clangd] Handle windows line endings in QueryDriver

Summary: fixes second case of https://github.com/clangd/clangd/issues/93

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366320

5 years agoPowerPC: Fix register spilling for SPE registers
Justin Hibbits [Wed, 17 Jul 2019 12:30:48 +0000 (12:30 +0000)]
PowerPC: Fix register spilling for SPE registers

Summary:
Missed in the original commit, use the correct callee-saved register
list for spilling, instead of the standard SVR432 list.  This avoids
needlessly spilling the SPE non-volatile registers when they're not used.

As part of this, also add where missing, and sort, the spill opcode
checks for SPE and SPE4 register classes.

Reviewers: nemanjai, hfinkel, joerg

Subscribers: kbarton, jsji, llvm-commits

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

llvm-svn: 366319

5 years agoPowerPC/SPE: Fix load/store handling for SPE
Justin Hibbits [Wed, 17 Jul 2019 12:30:04 +0000 (12:30 +0000)]
PowerPC/SPE: Fix load/store handling for SPE

Summary:
Pointed out in a comment for D49754, register spilling will currently
spill SPE registers at almost any offset.  However, the instructions
`evstdd` and `evldd` require a) 8-byte alignment, and b) a limit of 256
(unsigned) bytes from the base register, as the offset must fix into a
5-bit offset, which ranges from 0-31 (indexed in double-words).

The update to the register spill test is taken partially from the test
case shown in D49754.

Additionally, pointed out by Kei Thomsen, globals will currently use
evldd/evstdd, though the offset isn't known at compile time, so may
exceed the 8-bit (unsigned) offset permitted.  This fixes that as well,
by forcing it to always use evlddx/evstddx when accessing globals.

Part of the patch contributed by Kei Thomsen.

Reviewers: nemanjai, hfinkel, joerg

Subscribers: kbarton, jsji, llvm-commits

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

llvm-svn: 366318

5 years ago[MIPS GlobalISel] ClampScalar and select pointer G_ICMP
Petar Avramovic [Wed, 17 Jul 2019 12:08:01 +0000 (12:08 +0000)]
[MIPS GlobalISel] ClampScalar and select pointer G_ICMP

Add narrowScalar to half of original size for G_ICMP.
ClampScalar G_ICMP's operands 2 and 3 to to s32.
Select G_ICMP for pointers for MIPS32. Pointer compare is same
as for integers, it is enough to declare them as legal type.

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

llvm-svn: 366317

5 years ago[lldb][NFC] Tablegenify watchpoint commands
Raphael Isemann [Wed, 17 Jul 2019 11:48:29 +0000 (11:48 +0000)]
[lldb][NFC] Tablegenify watchpoint commands

Part of the project that migrates these struct initializers to our
new lldb-tablegen.

llvm-svn: 366316

5 years ago[AArch64] Consistent types and naming for AArch64 target features (NFC)
Momchil Velikov [Wed, 17 Jul 2019 11:24:37 +0000 (11:24 +0000)]
[AArch64] Consistent types and naming for AArch64 target features (NFC)

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

Committed as obvious.

llvm-svn: 366315

5 years agoAMDGPU/GFX10: Apply the VMEM-to-scalar-write hazard also to writes to EXEC
Nicolai Haehnle [Wed, 17 Jul 2019 11:22:57 +0000 (11:22 +0000)]
AMDGPU/GFX10: Apply the VMEM-to-scalar-write hazard also to writes to EXEC

Summary: Change-Id: I854fbf7d48e937bef9f8f3f5d0c8aeb970652630

Reviewers: rampitec, mareko

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

Tags: #llvm

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

Change-Id: I4405b3a7f84186acea5a78d291bff71056e745fc
llvm-svn: 366314

5 years agoAMDGPU: Improve alias analysis for GDS
Nicolai Haehnle [Wed, 17 Jul 2019 11:22:19 +0000 (11:22 +0000)]
AMDGPU: Improve alias analysis for GDS

Summary: GDS cannot alias anything else.

Original patch by: Marek Olšák

Reviewers: arsenm, mareko

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, Petar.Avramovic, llvm-commits

Tags: #llvm

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

Change-Id: I07bfbd96f5d5c37a6dfba7997df12f291dd794b0
llvm-svn: 366313

5 years ago[TableGen] Do not set ReadNone attribute on intrinsics with side effects
Momchil Velikov [Wed, 17 Jul 2019 10:53:13 +0000 (10:53 +0000)]
[TableGen] Do not set ReadNone attribute on intrinsics with side effects

If an intrinsic is defined without outputs, but having side effects,
it still can be removed completely from the program. This patch makes
TableGen not set Attribute::ReadNone for intrinsics which
are declared with IntrHasSideEffects.

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

llvm-svn: 366312

5 years ago[clangd] Fix error message in tweaktests to be useful. NFC
Sam McCall [Wed, 17 Jul 2019 10:17:47 +0000 (10:17 +0000)]
[clangd] Fix error message in tweaktests to be useful. NFC

llvm-svn: 366311

5 years ago[llvm-ar][test] Add coverage for replace and update key letters
Owen Reynolds [Wed, 17 Jul 2019 10:16:44 +0000 (10:16 +0000)]
[llvm-ar][test] Add coverage for replace and update key letters

Some more tests to increase llvm-ar test coverage, this time for replace 'r' and update 'u'.

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

llvm-svn: 366309

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