platform/upstream/llvm.git
5 years agoRevert "[lld] Reapply "Prevent duplicate files in debug line header in dwarf 5.""
Ali Tamur [Tue, 26 Mar 2019 19:57:13 +0000 (19:57 +0000)]
Revert "[lld] Reapply "Prevent duplicate files in debug line header in dwarf 5.""

This reverts commit rL357020

Reason: rL357018, which this commit depend on breaks the test:
llvm/test/tools/llvm-objdump/embedded-source.test on some architectures.

llvm-svn: 357025

5 years ago[libc++] Fix return value of snprintf_l() on Windows when buffer is too small
Thomas Anderson [Tue, 26 Mar 2019 19:51:30 +0000 (19:51 +0000)]
[libc++] Fix return value of snprintf_l() on Windows when buffer is too small

When the output buffer is too small to contain the output, `vsnprintf()`
fills the buffer and returns the number of characters that __would have__
been written if the buffer was sufficiently large.

`_vnsprintf_s()` on the other hand fills the buffer and returns -1 when this
happens.  We want the former behavior, but we also want to be able to
pass in a locale to prevent having to call `setlocale()`.

`__stdio_common_vsprintf()` is the only function general enough to get
the behavior we want.

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

llvm-svn: 357024

5 years agoRevert "[coroutines] Add std::experimental::task<T> type"
Brian Gesiak [Tue, 26 Mar 2019 19:50:46 +0000 (19:50 +0000)]
Revert "[coroutines] Add std::experimental::task<T> type"

This revision is causing build and test failures, such as
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio,
so I'll revert it.

llvm-svn: 357023

5 years ago[WebAssembly] Initial implementation of PIC code generation
Sam Clegg [Tue, 26 Mar 2019 19:46:15 +0000 (19:46 +0000)]
[WebAssembly] Initial implementation of PIC code generation

This change implements lowering of references global symbols in PIC
mode.

This change implements lowering of global references in PIC mode using a
new @GOT reference type. @GOT references can be used with function or
data symbol names combined with the get_global instruction. In this case
the linker will insert the wasm global that stores the address of the
symbol (either in memory for data symbols or in the wasm table for
function symbols).

For now I'm continuing to use the R_WASM_GLOBAL_INDEX_LEB relocation
type for this type of reference which means that this relocation type
can refer to either a global or a function or data symbol. We could
choose to introduce specific relocation types for GOT entries in the
future.  See the current dynamic linking proposal:

https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md

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

llvm-svn: 357022

5 years agogn build: Format all build files
Nico Weber [Tue, 26 Mar 2019 19:16:28 +0000 (19:16 +0000)]
gn build: Format all build files

Re-ran `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`.

llvm-svn: 357021

5 years ago[lld] Reapply "Prevent duplicate files in debug line header in dwarf 5."
Ali Tamur [Tue, 26 Mar 2019 18:59:52 +0000 (18:59 +0000)]
[lld] Reapply "Prevent duplicate files in debug line header in dwarf 5."

Reapply rL356943; the previous attempt was reverted because the patch rL356941
that this depended on had broken a test.

Original commit message:

[lld] Prevent duplicate files in debug line header in dwarf 5.

Tags: #llvm

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

llvm-svn: 357020

5 years agogn build: Merge r356929 (effectively relands r353518, reverted in r353621)
Nico Weber [Tue, 26 Mar 2019 18:55:37 +0000 (18:55 +0000)]
gn build: Merge r356929 (effectively relands r353518, reverted in r353621)

llvm-svn: 357019

5 years ago[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5."
Ali Tamur [Tue, 26 Mar 2019 18:53:23 +0000 (18:53 +0000)]
[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5."

Reapply rL356941 after regenerating the object file in the failing test
llvm/test/tools/llvm-objdump/embedded-source.test from source.

Original commit message:

[llvm] Prevent duplicate files in debug line header in dwarf 5.

Motivation: In previous dwarf versions, file name indexes started from 1, and
the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes
the primary source file to be explicitly given an entry with an index number 0.

The current implementation honors the specification by just duplicating the
main source file, once with index number 0, and later maybe with another
index number. While this is compliant with the letter of the standard, the
duplication causes problems for consumers of this information such as lldb.
(Some files are duplicated, where only some of them have a line table although
all refer to the same file)

With this change, dwarf 5 debug line section files always start from 0, and
the zeroth entry is not duplicated whenever possible. This requires different
handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns
an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5)
However, I think the minor complication is worth it, because it enables all
consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the
file name list homogenously.

Tags: #llvm, #debug-info

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

llvm-svn: 357018

5 years ago[llvm-objcopy] - Strip sections before symbols.
George Rimar [Tue, 26 Mar 2019 18:42:15 +0000 (18:42 +0000)]
[llvm-objcopy] - Strip sections before symbols.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40007.

Idea is to swap the order of stripping. So that we strip sections before
symbols what allows us to strip relocation sections without emitting
the error about relative symbols.

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

llvm-svn: 357017

5 years agoAdd lldb-vscode as a dependency of lldb tests.
Jorge Gorbe Moya [Tue, 26 Mar 2019 18:36:44 +0000 (18:36 +0000)]
Add lldb-vscode as a dependency of lldb tests.

Summary:
In the current state, 'ninja check-lldb' runs the lldb-vscode tests, but it
won't rebuild lldb-vscode if any of its sources has changed. This is very
confusing when you fix something and the tests keep failing, or vice versa.

Reviewers: clayborg

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 357016

5 years ago[WebAssembly] Don't analyze branches after CFGStackify
Heejin Ahn [Tue, 26 Mar 2019 18:21:20 +0000 (18:21 +0000)]
[WebAssembly] Don't analyze branches after CFGStackify

Summary:
`WebAssembly::analyzeBranch` now does not analyze anything if the
function is CFG stackified. We were previously doing similar things by
checking if a branch's operand is whether an integer or an MBB, but this
failed to bail out when a BB did not have any terminators.

Consider this case:
```
bb0:
  try $label0
  call @foo    // unwinds to %ehpad
bb1:
  ...
  br $label0   // jumps to %cont. can be deleted
ehpad:
  catch
  ...
cont:
  end_try
```
Here `br $label0` will be deleted in CFGStackify's
`removeUnnecessaryInstrs` function, because we jump to the %cont block
even without the branch. But in this case, MachineVerifier fails to
verify this, because `ehpad` is not a successor of `bb1` even if `bb1`
does not have any terminators. MachineVerifier incorrectly thinks `bb1`
falls through to the next block.

This pass now consistently rejects all analysis after CFGStackify
whether a BB has terminators or not, also making the MachineVerifier
work. (MachineVerifier does not try to verify relationships between BBs
if `analyzeBranch` fails, the behavior we want after CFGStackify.)

This also adds a new option `-wasm-disable-ehpad-sort` for testing. This
option helps create the sorted order we want to test, and without the
fix in this patch, the tests in cfg-stackify-eh.ll fail at
MachineVerifier with `-wasm-disable-ehpad-sort`.

Reviewers: dschuff

Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

llvm-svn: 357015

5 years ago[ConstantRange] Fix outdated comment; NFC
Nikita Popov [Tue, 26 Mar 2019 18:05:53 +0000 (18:05 +0000)]
[ConstantRange] Fix outdated comment; NFC

Full/empty is required now, so there is no default.

llvm-svn: 357014

5 years ago[InstCombine] Add tests for ssubo X, C -> saddo X, -C; NFC
Nikita Popov [Tue, 26 Mar 2019 18:05:43 +0000 (18:05 +0000)]
[InstCombine] Add tests for ssubo X, C -> saddo X, -C; NFC

Add baseline tests for canonicalization of
ssubo X, C -> saddo X, -C.

Patch by Dan Robertson.

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

llvm-svn: 357013

5 years ago[InstCombine] form uaddsat from add+umin (PR14613)
Sanjay Patel [Tue, 26 Mar 2019 17:50:08 +0000 (17:50 +0000)]
[InstCombine] form uaddsat from add+umin (PR14613)

This is the last step towards solving the examples shown in:
https://bugs.llvm.org/show_bug.cgi?id=14613

With this change, x86 should end up with psubus instructions
when those are available.

All known codegen issues with expanding the saturating intrinsics
were resolved with:
D59006 / rL356855

We also have some early evidence in D58872 that using the intrinsics
will lead to better perf. If some target regresses from this, custom
lowering of the intrinsics (as in the above for x86) may be needed.

llvm-svn: 357012

5 years ago[WebAssembly] Add CFGStacikfied field to WebAssemblyFunctionInfo
Heejin Ahn [Tue, 26 Mar 2019 17:46:14 +0000 (17:46 +0000)]
[WebAssembly] Add CFGStacikfied field to WebAssemblyFunctionInfo

Summary:
This adds `CFGStackified` field and its serialization to
WebAssemblyFunctionInfo.

Reviewers: dschuff

Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

llvm-svn: 357011

5 years ago[coroutines] Add std::experimental::task<T> type
Brian Gesiak [Tue, 26 Mar 2019 17:46:06 +0000 (17:46 +0000)]
[coroutines] Add std::experimental::task<T> type

Summary:
Adds the coroutine `std::experimental::task<T>` type described in proposal P1056R0.
See https://wg21.link/P1056R0.

This implementation allows customization of the allocator used to allocate the
coroutine frame by passing std::allocator_arg as the first argument, followed by
the allocator to use.

This supports co_awaiting the same task multiple times. The second and
subsequent times it returns a reference to the already-computed value.

This diff also adds some implementations of other utilities that have potential for
standardization as helpers within the test/... area:
- `sync_wait(awaitable)` - See P1171R0
- `manual_reset_event`

Move the definition of the __aligned_allocation_size helper function
from <experimental/memory_resource> to <experimental/__memory>
so it can be more widely used without pulling in memory_resource.

Outstanding work:
- Use C++14 keywords directly rather than macro versions
  eg. use `noexcept` instead of `_NOEXCEPT`).
- Add support for overaligned coroutine frames.
  This may need wording in the Coroutines TS to support passing the extra `std::align_val_t`.
- Eliminate use of `if constexpr` if we want it to compile under C++14.

Patch by @lewissbaker (Lewis Baker).

llvm-svn: 357010

5 years ago[WebAssembly] Support WebAssemblyFunctionInfo serialization
Heejin Ahn [Tue, 26 Mar 2019 17:35:35 +0000 (17:35 +0000)]
[WebAssembly] Support WebAssemblyFunctionInfo serialization

Summary:
The framework for supporting target-specific MachineFunctionInfo was
added in r356215. This adds serialization support for
WebAssemblyFunctionInfo on top of that. This patch only adds the
framework and does not actually serialize anything at this point; we
have to add YAML mapping later for the fields in WebAssemblyFunctionInfo
we want to serialize if necessary.

Reviewers: dschuff, arsenm

Subscribers: sunfish, wdng, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

llvm-svn: 357009

5 years ago[WebAssembly] Fix a bug when mixing TRY/LOOP markers
Heejin Ahn [Tue, 26 Mar 2019 17:29:55 +0000 (17:29 +0000)]
[WebAssembly] Fix a bug when mixing TRY/LOOP markers

Summary:
When TRY and LOOP markers are in the same BB and END_TRY and END_LOOP
markers are in the same BB, END_TRY should be _before_ END_LOOP, because
LOOP is always before TRY if they are in the same BB. (TRY is placed in
the latest possible position, whereas LOOP is in the earliest possible
position.)

Reviewers: dschuff

Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

llvm-svn: 357008

5 years ago[WebAssembly] Fix bugs in BLOCK/TRY placement
Heejin Ahn [Tue, 26 Mar 2019 17:15:55 +0000 (17:15 +0000)]
[WebAssembly] Fix bugs in BLOCK/TRY placement

Summary:
Before we placed all TRY/END_TRY markers before placing BLOCK/END_BLOCK
markers. This couldn't handle this case:
```
bb0:
  br bb2
bb1:          // nearest common dominator of bb3 and bb4
  br_if ... bb3
  br bb4
bb2:
  ...
bb3:
  call @foo   // unwinds to ehpad
bb4:
  call @bar   // unwinds to ehpad
ehpad:
  catch
  ...
```

When we placed TRY markers, we placed it in bb1 because it is the
nearest common dominator of bb3 and bb4. But because bb0 jumps to bb2,
when we placed block markers, we ended up with interleaved scopes like
```
block
try
end_block
catch
end_try
```
which was not correct.

This patch fixes the bug by placing BLOCK and TRY markers in one pass
while iterating BBs in a function. This also adds some more routines to
`placeTryMarkers`, because we now have to assume that there can be
previously placed BLOCK and END_BLOCK.

Reviewers: dschuff

Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

llvm-svn: 357007

5 years ago[ScriptInterpreterPython] Try to make the sanitizer bot green again.
Davide Italiano [Tue, 26 Mar 2019 16:43:58 +0000 (16:43 +0000)]
[ScriptInterpreterPython] Try to make the sanitizer bot green again.

Removing a use-after-free error.

llvm-svn: 357006

5 years ago[InstCombine] add tests for uaddsat using min; NFC
Sanjay Patel [Tue, 26 Mar 2019 16:19:13 +0000 (16:19 +0000)]
[InstCombine] add tests for uaddsat using min; NFC

llvm-svn: 357005

5 years ago[InstCombine] update tests to use FileCheck; NFC
Sanjay Patel [Tue, 26 Mar 2019 15:58:33 +0000 (15:58 +0000)]
[InstCombine] update tests to use FileCheck; NFC

llvm-svn: 357004

5 years ago[llvm-exegesis] Allow the target to disable the selection of some registers.
Clement Courbet [Tue, 26 Mar 2019 15:44:57 +0000 (15:44 +0000)]
[llvm-exegesis] Allow the target to disable the selection of some registers.

Summary:
This prevents "Cannot encode high byte register in REX-prefixed instruction"
from happening on instructions that require REX encoding when AH & co
get selected.
On the down side, these 4 registers can no longer be selected
automatically, but this avoids having to expose all the X86 encoding
complexity.

Reviewers: gchatelet

Subscribers: tschuett, jdoerfert, llvm-commits, bdb

Tags: #llvm

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

llvm-svn: 357003

5 years ago[RISCV] Update setcc-logic.ll codegen test
Luis Marques [Tue, 26 Mar 2019 15:41:45 +0000 (15:41 +0000)]
[RISCV] Update setcc-logic.ll codegen test

This should have been updated as part of D59753.

llvm-svn: 357002

5 years ago[CodeGen] Delete never used LValueAlign
Fangrui Song [Tue, 26 Mar 2019 15:39:45 +0000 (15:39 +0000)]
[CodeGen] Delete never used LValueAlign

It was added by rC176658 but never used since then.

llvm-svn: 357001

5 years ago[MCA] Correctly update the UsedResourceGroups mask in the InstrBuilder.
Andrea Di Biagio [Tue, 26 Mar 2019 15:38:37 +0000 (15:38 +0000)]
[MCA] Correctly update the UsedResourceGroups mask in the InstrBuilder.

Found by inspection when looking at the debug output of MCA.
This problem was latent, and none of the upstream models were affected by it.
No functional change intended.

llvm-svn: 357000

5 years agoTest commit: fix typo
Ronald Wampler [Tue, 26 Mar 2019 15:26:15 +0000 (15:26 +0000)]
Test commit: fix typo

llvm-svn: 356999

5 years ago[libomptarget] Introduce LIBOMPTARGET_ENABLE_DEBUG cmake option.
Michael Kruse [Tue, 26 Mar 2019 15:19:15 +0000 (15:19 +0000)]
[libomptarget] Introduce LIBOMPTARGET_ENABLE_DEBUG cmake option.

At the moment, support for runtime debug output using the
OMPTARGET_DEBUG=1 environment variable is only available with
CMAKE_BUILD_TYPE=Debug builds. The patch allows setting it independently
using the LIBOMPTARGET_ENABLE_DEBUG option, which is enabled by default
depending on CMAKE_BUILD_TYPE. That is, unless this option is set
explicitly, nothing changes. This is the same mechanism used by LLVM for
LLVM_ENABLE_ASSERTIONS.

This patch also removes adding -g -O0 in debug builds, it should be
handled by cmake's CMAKE_{C|CXX}_FLAGS_DEBUG configuration option.

Idea by Hal Finkel

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

llvm-svn: 356998

5 years ago[SystemZ] Remove LRMux pseudo instruction.
Jonas Paulsson [Tue, 26 Mar 2019 15:13:48 +0000 (15:13 +0000)]
[SystemZ]  Remove LRMux pseudo instruction.

This instruction is unused and not needed.

Review: Ulrich Weigand.
llvm-svn: 356997

5 years ago[DAG] Avoid smart constructor-based dangling nodes.
Nirav Dave [Tue, 26 Mar 2019 15:08:14 +0000 (15:08 +0000)]
[DAG] Avoid smart constructor-based dangling nodes.

Various SelectionDAG non-combine operations (e.g. the getNode smart
constructor and legalization) may leave dangling nodes by applying
optimizations or not fully pruning unused result values. This can
result in nodes that are never added to the worklist and therefore can
not be pruned.

Add a node inserter as the current node deleter to make sure such
nodes have the chance of being pruned.

Many minor changes, mostly positive.

llvm-svn: 356996

5 years agopython 2/3 compat: commands vs subprocess
Serge Guelton [Tue, 26 Mar 2019 14:46:15 +0000 (14:46 +0000)]
python 2/3 compat: commands vs subprocess

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

llvm-svn: 356995

5 years agoMoved body of methods dump to .cpp file to fix compilation when modules
Mikhail R. Gadelha [Tue, 26 Mar 2019 14:25:12 +0000 (14:25 +0000)]
Moved body of methods dump to .cpp file to fix compilation when modules
are enabled

llvm-svn: 356994

5 years agoRemove the TypePair class
Pavel Labath [Tue, 26 Mar 2019 13:35:54 +0000 (13:35 +0000)]
Remove the TypePair class

Summary:
After D59297, the TypePair class kind of lost its purpose as it was no
longer a "pair". This finishes the job started in that patch and deletes
the class altogether. All usages have been updated to use CompilerType
class directly.

Reviewers: clayborg, jingham, zturner

Subscribers: mehdi_amini, dexonsmith, jdoerfert, lldb-commits

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

llvm-svn: 356993

5 years agoMinidump: Use minidump types defined in llvm
Pavel Labath [Tue, 26 Mar 2019 13:23:01 +0000 (13:23 +0000)]
Minidump: Use minidump types defined in llvm

This is the next step in moving the minidump parsing into llvm. I remove
the minidump structures already defined in the llvm Object library and
convert our parser to use those. NFC.

llvm-svn: 356992

5 years ago[RISCV] Improve codegen for icmp {ne,eq} with a constant
Luis Marques [Tue, 26 Mar 2019 12:55:00 +0000 (12:55 +0000)]
[RISCV] Improve codegen for icmp {ne,eq} with a constant

Adds two patterns to improve the codegen of GPR value comparisons with small
constants. Instead of first loading the constant into another register and then
doing an XOR of those registers, these patterns directly use the constant as an
XORI immediate.

llvm-svn: 356990

5 years ago[TargetLowering] Add SimplifyDemandedBits support for ISD::INSERT_VECTOR_ELT
Simon Pilgrim [Tue, 26 Mar 2019 12:32:01 +0000 (12:32 +0000)]
[TargetLowering] Add SimplifyDemandedBits support for ISD::INSERT_VECTOR_ELT

This helps us relax the extension of a lot of scalar elements before they are inserted into a vector.

Its exposes an issue in DAGCombiner::convertBuildVecZextToZext as some/all the zero-extensions may be relaxed to ANY_EXTEND, so we need to handle that case to avoid a couple of AVX2 VPMOVZX test regressions.

Once this is in it should be easier to fix a number of remaining failures to fold loads into VBROADCAST nodes.

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

llvm-svn: 356989

5 years agoFix nondeterminism introduced in r353954
Yi Kong [Tue, 26 Mar 2019 12:18:08 +0000 (12:18 +0000)]
Fix nondeterminism introduced in r353954

DenseMap iteration order is not guaranteed, use MapVector instead.

Fix provided by srhines.

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

llvm-svn: 356988

5 years ago[OpenCL] Allow variadic macros as Clang feature.
Anastasia Stulova [Tue, 26 Mar 2019 11:22:37 +0000 (11:22 +0000)]
[OpenCL] Allow variadic macros as Clang feature.

llvm-svn: 356987

5 years ago[TableGen] Let list elements have a trailing comma
Javed Absar [Tue, 26 Mar 2019 11:16:01 +0000 (11:16 +0000)]
[TableGen] Let list elements have a trailing comma

Let lists have an trailing comma to allow cleaner diffs e.g:
  def : Features<[FeatureA,
                  FeatureB,
                 ]>;
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D59247

llvm-svn: 356986

5 years ago[TableGen] Give meaningful msg for def use in multiclass
Javed Absar [Tue, 26 Mar 2019 10:49:09 +0000 (10:49 +0000)]
[TableGen] Give meaningful msg for def use in multiclass

When one mistakenly specifies 'def' instead of using 'defm',
the error message is quite misleading: 'Couldn't find class..'
Instead, it should recommend using defm if the multiclass of
same name exists.

Reviewed By: hfinkel

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

llvm-svn: 356985

5 years ago[ARM][Asm] Accept upper case coprocessor number and registers
Oliver Stannard [Tue, 26 Mar 2019 10:24:03 +0000 (10:24 +0000)]
[ARM][Asm] Accept upper case coprocessor number and registers

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

llvm-svn: 356984

5 years agoupdate the release notes after the change of 'clang -dumpversion'
Sylvestre Ledru [Tue, 26 Mar 2019 09:48:23 +0000 (09:48 +0000)]
update the release notes after the change of 'clang -dumpversion'

llvm-svn: 356983

5 years ago[llvm-dlltool] Set a proper machine type for weak symbol object files
Martin Storsjo [Tue, 26 Mar 2019 09:02:44 +0000 (09:02 +0000)]
[llvm-dlltool] Set a proper machine type for weak symbol object files

This makes GNU binutils not reject the libraries outright.

GNU ld handles weak externals slightly differently though, so it
can't use them for aliases in import libraries, but this makes GNU
ld able to use the rest of the import libraries.

LLD accepted object files with machine type 0 aka
IMAGE_FILE_MACHINE_UNKNOWN.

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

llvm-svn: 356982

5 years ago[RISCV] Pass -target-abi to -cc1as
Roger Ferrer Ibanez [Tue, 26 Mar 2019 08:01:18 +0000 (08:01 +0000)]
[RISCV] Pass -target-abi to -cc1as

The RISC-V assembler needs the target ABI because it defines a flag of the ELF
file, as described in [1].

Make clang (the driver) to pass the target ABI to -cc1as in exactly the same
way it does for -cc1.

Currently -cc1as knows about -target-abi but is not handling it. Handle it and
pass it to the MC layer via MCTargetOptions.

[1] https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#file-header

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

llvm-svn: 356981

5 years ago[ADT] Update SmallVectorTest.EmplaceBack tests after rL356312
Fangrui Song [Tue, 26 Mar 2019 05:33:52 +0000 (05:33 +0000)]
[ADT] Update SmallVectorTest.EmplaceBack tests after rL356312

rL356312 changed the return type of emplace_back from void to reference.
Update the tests to check the behavior.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 356980

5 years ago[X86] In matchBitExtract, place all of the new nodes before Node's position in the...
Craig Topper [Tue, 26 Mar 2019 05:31:32 +0000 (05:31 +0000)]
[X86] In matchBitExtract, place all of the new nodes before Node's position in the DAG for the topological sort.

We were using OrigNBits, but that put all the nodes before the node we used to start the control computation. This caused some node earlier than the sequence we inserted to be selected before the sequence we created. We want our new sequence to be selected first since it depends on OrigNBits.

I don't have a test case. Found by reviewing the code.

llvm-svn: 356979

5 years ago[X86] In matchBitExtract, if we need to truncate the BEXTR make sure we put the BEXTR...
Craig Topper [Tue, 26 Mar 2019 05:12:23 +0000 (05:12 +0000)]
[X86] In matchBitExtract, if we need to truncate the BEXTR make sure we put the BEXTR at Node's position in the DAG for the topological sort.

We were using OrigNBits, but that doesn't guarantee that it will be selected before the nodes that make up X.

llvm-svn: 356978

5 years ago[X86] Remove unneeded FIXME. NFC
Craig Topper [Tue, 26 Mar 2019 05:12:21 +0000 (05:12 +0000)]
[X86] Remove unneeded FIXME. NFC

We do fold loads right below this.

llvm-svn: 356977

5 years agoReland "[WebAssembly] Add linker options to control feature checking"
Thomas Lively [Tue, 26 Mar 2019 04:11:05 +0000 (04:11 +0000)]
Reland "[WebAssembly] Add linker options to control feature checking"

Do not pipe binary data between processes in lit tests this time,
since it turns out that can break on Windows.

This reverts commit 84c8652fc3085155d0f9c355455e5a797c6d9db6.

llvm-svn: 356975

5 years ago[clangd][xpc][cmake] Respect explicit value of CLANGD_BUILD_XPC
Jan Korous [Tue, 26 Mar 2019 03:48:25 +0000 (03:48 +0000)]
[clangd][xpc][cmake] Respect explicit value of CLANGD_BUILD_XPC

We shouldn't prevent user from disabling XPC framework build on Darwin.
However, by keeping it on by default our CI systems also test
it by default on macOS.

Based on user request:
http://lists.llvm.org/pipermail/cfe-dev/2019-March/061778.html

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

llvm-svn: 356974

5 years agoX86Parser: Fix potential reference to deleted object
Craig Topper [Tue, 26 Mar 2019 03:12:43 +0000 (03:12 +0000)]
X86Parser: Fix potential reference to deleted object

Within the MatchFPUWaitAlias function, Operands[0] is potentially overwritten leading to &Op referencing a deleted object. To fix this, assign the reference after the function.

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

llvm-svn: 356973

5 years agoX86AsmParser: Do not process a non-existent token
Craig Topper [Tue, 26 Mar 2019 03:12:41 +0000 (03:12 +0000)]
X86AsmParser: Do not process a non-existent token

This error can only happen if an unfinished operation is at Eof.

Patch by Brandon Jones

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

llvm-svn: 356972

5 years ago[Python] Define empty SWIG wrapper for unit testin"
Jonas Devlieghere [Tue, 26 Mar 2019 01:11:15 +0000 (01:11 +0000)]
[Python] Define empty SWIG wrapper for unit testin"

The python plugin uses wrappers generated by swig. For the symbols to be
available, we'd need to link against liblldb, which is not an option
because the symbols could conflict with the static library we are
testing. Instead we define the symbols ourselves in the unit test.

llvm-svn: 356971

5 years ago[CMake][Fuchsia] Merge static libunwind and libc++abi into libc++ on Darwin
Petr Hosek [Tue, 26 Mar 2019 00:43:29 +0000 (00:43 +0000)]
[CMake][Fuchsia] Merge static libunwind and libc++abi into libc++ on Darwin

We want to distribute only a single archive so -lc++ does the right
thing and users don't have to explicitly link -lc++abi and -lunwind.

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

llvm-svn: 356970

5 years ago[CFG] [analyzer] pr41142: C++17: Skip transparent InitListExprs in ExprEngine.
Artem Dergachev [Tue, 26 Mar 2019 00:36:53 +0000 (00:36 +0000)]
[CFG] [analyzer] pr41142: C++17: Skip transparent InitListExprs in ExprEngine.

r356634 didn't fix all the problems caused by r356222 - even though simple
constructors involving transparent init-list expressions are now evaluated
precisely, many more complicated constructors aren't, for other reasons.

The attached test case is an example of a constructor that will never be
evaluated precisely - simply because there isn't a constructor there (instead,
the program invokes run-time undefined behavior by returning without a return
statement that should have constructed the return value).

Fix another part of the problem for such situations: evaluate transparent
init-list expressions transparently, so that to avoid creating ill-formed
"transparent" nonloc::CompoundVals.

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

llvm-svn: 356969

5 years ago[ELF] Change GOT*_FROM_END (relative to end(.got)) to GOTPLT* (start(.got.plt))
Fangrui Song [Mon, 25 Mar 2019 23:46:19 +0000 (23:46 +0000)]
[ELF] Change GOT*_FROM_END (relative to end(.got)) to GOTPLT* (start(.got.plt))

Summary:
This should address remaining issues discussed in PR36555.

Currently R_GOT*_FROM_END are exclusively used by x86 and x86_64 to
express relocations types relative to the GOT base. We have
_GLOBAL_OFFSET_TABLE_ (GOT base) = start(.got.plt) but end(.got) !=
start(.got.plt)

This can have problems when _GLOBAL_OFFSET_TABLE_ is used as a symbol, e.g.
glibc dl_machine_dynamic assumes _GLOBAL_OFFSET_TABLE_ is start(.got.plt),
which is not true.

  extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
  return _GLOBAL_OFFSET_TABLE_[0]; // R_X86_64_GOTPC32

In this patch, we

* Change all GOT*_FROM_END to GOTPLT* to fix the problem.
* Add HasGotPltOffRel to denote whether .got.plt should be kept even if
  the section is empty.
* Simplify GotSection::empty and GotPltSection::empty by setting
  HasGotOffRel and HasGotPltOffRel according to GlobalOffsetTable early.

The change of R_386_GOTPC makes X86::writePltHeader simpler as we don't
have to compute the offset start(.got.plt) - Ebx (it is constant 0).

We still diverge from ld.bfd (at least in most cases) and gold in that
.got.plt and .got are not adjacent, but the advantage doing that is
unclear.

Reviewers: ruiu, sivachandra, espindola

Subscribers: emaste, mehdi_amini, arichardson, dexonsmith, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356968

5 years ago[Python] Move SWIG wrapper dependency into the plugin
Jonas Devlieghere [Mon, 25 Mar 2019 23:36:12 +0000 (23:36 +0000)]
[Python] Move SWIG wrapper dependency into the plugin

This should fix the Windows bot (fingers crossed).

llvm-svn: 356967

5 years agoUse a class instead of lambda-based callbacks to organize garbage collector.
Rui Ueyama [Mon, 25 Mar 2019 23:28:47 +0000 (23:28 +0000)]
Use a class instead of lambda-based callbacks to organize garbage collector.

lld's mark-sweep garbage collector was written in the visitor pattern.
There are functions that traverses a given graph, and the functions calls
callback functions to dispatch according to node type.

The code was originaly pretty simple, and lambdas worked pretty
well. However, as we add more features to the garbage collector, that became
more like a callback hell. We now have a callback function that wraps
another callback function, for example. It is not easy to follow the flow of
the control.

This patch rewrites it as a regular class. What was once a lambda is now a
regular class member function. I think this change fixes the readability
issue.

No functionality change intended.

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

llvm-svn: 356966

5 years agoMoving ManagedMemoryRewritePass when hybrid option is selected
Michael Kruse [Mon, 25 Mar 2019 23:26:59 +0000 (23:26 +0000)]
Moving ManagedMemoryRewritePass when hybrid option is selected

Compiling with -polly-target=hybrid was causing Polly to occur two times
in the pipeline. The reason was how the ManagedMemoryRewritePass was
registered in the pass manager. ManagedMemoryRewritePass being a
ModulePass was forcing all previous passes to get recomputed. This
commit avoids Polly to appear two times in the pipeline registering the
ManagedMemoryRewritePass later in the pass manager.

Patch by Lorenzo Chelini <l.chelini@icloud.com>

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

llvm-svn: 356965

5 years ago[MS] Add frontend support for __declspec(allocator)
Reid Kleckner [Mon, 25 Mar 2019 23:20:18 +0000 (23:20 +0000)]
[MS] Add frontend support for __declspec(allocator)

The intention is to add metadata to direct call sites of functions
marked with __declspec(allocator), which will ultimately result in some
S_HEAPALLOCSITE debug info records when emitting codeview.

This is a piece of PR38491

llvm-svn: 356964

5 years ago[ARM] Add missing memory operands to a bunch of instructions.
Eli Friedman [Mon, 25 Mar 2019 22:42:30 +0000 (22:42 +0000)]
[ARM] Add missing memory operands to a bunch of instructions.

This should hopefully lead to minor improvements in code generation, and
more accurate spill/reload comments in assembly.

Also fix isLoadFromStackSlotPostFE/isStoreToStackSlotPostFE so they
don't lead to misleading assembly comments for merged memory operands;
this is technically orthogonal, but in practice the relevant memory
operand lists don't show up without this change.

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

llvm-svn: 356963

5 years ago[OpenMP] Add LLVM license header to file
Jonathan Peyton [Mon, 25 Mar 2019 22:36:31 +0000 (22:36 +0000)]
[OpenMP] Add LLVM license header to file

This file was missing the LLVM license header

llvm-svn: 356962

5 years ago[OpenMP] Add Intel 19.0 to list of compilers in kmp_version.cpp
Jonathan Peyton [Mon, 25 Mar 2019 22:31:00 +0000 (22:31 +0000)]
[OpenMP] Add Intel 19.0 to list of compilers in kmp_version.cpp

llvm-svn: 356961

5 years ago[lldb] [Process/NetBSD] Use nullptr to fix template arg deduction
Michal Gorny [Mon, 25 Mar 2019 22:29:29 +0000 (22:29 +0000)]
[lldb] [Process/NetBSD] Use nullptr to fix template arg deduction

llvm-svn: 356960

5 years ago[x86] add tests for vector cmps; NFC
Sanjay Patel [Mon, 25 Mar 2019 22:08:45 +0000 (22:08 +0000)]
[x86] add tests for vector cmps; NFC

llvm-svn: 356959

5 years agoRevert "AMDGPU: Scavenge register instead of findUnusedReg"
Matt Arsenault [Mon, 25 Mar 2019 21:41:40 +0000 (21:41 +0000)]
Revert "AMDGPU: Scavenge register instead of findUnusedReg"

This reverts r356149.

This is crashing on rocBLAS.

llvm-svn: 356958

5 years ago[Sema] Don't check for array bounds when the types in the base expression are dependent
Bruno Ricci [Mon, 25 Mar 2019 21:37:10 +0000 (21:37 +0000)]
[Sema] Don't check for array bounds when the types in the base expression are dependent

Bail-out of CheckArrayAccess when the types of the base expression before
and after eventual casts are dependent. We will get another chance to check
for array bounds during instantiation. Fixes PR41087.

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

Reviewed By: efriedma

llvm-svn: 356957

5 years agoAMDGPU: Remove unnecessary check for isFullCopy
Matt Arsenault [Mon, 25 Mar 2019 21:28:53 +0000 (21:28 +0000)]
AMDGPU: Remove unnecessary check for isFullCopy

Subregister indexes are not used for physical register operands, so
isFullCopy is implied by the physical register check.

llvm-svn: 356956

5 years agoAMDGPU: Make collapse-endcf test more useful
Matt Arsenault [Mon, 25 Mar 2019 21:28:51 +0000 (21:28 +0000)]
AMDGPU: Make collapse-endcf test more useful

Without a VALU instruction in the return block, these were mostly
testing the path to delete exec mask code before s_endpgm rather than
the end cf handling.

llvm-svn: 356955

5 years ago[AArch64] Prefer "mov" over "orr" to materialize constants.
Eli Friedman [Mon, 25 Mar 2019 21:25:28 +0000 (21:25 +0000)]
[AArch64] Prefer "mov" over "orr" to materialize constants.

This is generally more readable due to the way the assembler aliases
work.

(This causes a lot of test changes, but it's not really as scary as it
looks at first glance; it's just mechanically changing a bunch of checks
for orr to check for mov instead.)

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

llvm-svn: 356954

5 years ago[WebAssembly] Don't use default GetLinkerPath
Sam Clegg [Mon, 25 Mar 2019 21:14:26 +0000 (21:14 +0000)]
[WebAssembly] Don't use default GetLinkerPath

We can't (don't want to) honor the same set of "-fuse-ld" flags with
WebAssembly since the ELF linkers (ld.lld, ld.gnu, etc) don't work with
wasm object files.

Instead we implement our own linker finding logic, similar or other
non-ELF platforms like MSVC.

We've had a few issues with CLANG_DEFAULT_LINKER overriding the
WebAssembly linker which doesn't make sense since there is no generic
linker that can handle WebAssembly today.

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

llvm-svn: 356953

5 years agoAMDGPU: Set hasSideEffects 0 on _term instructions
Matt Arsenault [Mon, 25 Mar 2019 21:10:12 +0000 (21:10 +0000)]
AMDGPU: Set hasSideEffects 0 on _term instructions

These were defaulting to true, but they are just wrappers around bit
operations. This avoids regressions in the exec mask optimization
passes in a future commit.

llvm-svn: 356952

5 years agoRevert "[llvm] Prevent duplicate files in debug line header in dwarf 5."
Ali Tamur [Mon, 25 Mar 2019 21:09:07 +0000 (21:09 +0000)]
Revert "[llvm] Prevent duplicate files in debug line header in dwarf 5."

This reverts commit 312ab05887d0e2caa29aaf843cefe39379a98d36.

My commit broke the build; I will revert and find out what happened.

llvm-svn: 356951

5 years ago[PythonTestSuite] Fix usage of InitializePrivate in PythonTestSuite
Jonas Devlieghere [Mon, 25 Mar 2019 21:07:53 +0000 (21:07 +0000)]
[PythonTestSuite] Fix usage of InitializePrivate in PythonTestSuite

llvm-svn: 356950

5 years agoRevert "[lld] Prevent duplicate files in debug line header in dwarf 5."
Ali Tamur [Mon, 25 Mar 2019 21:06:02 +0000 (21:06 +0000)]
Revert "[lld] Prevent duplicate files in debug line header in dwarf 5."

This reverts commit 5aa7478a55fa86dae45913b82bd05ed32d9c0973.

Some things are broken; I will fix and try to commit again.

llvm-svn: 356949

5 years ago[LLVM-C] Add binding to look up intrinsic by name
Robert Widmann [Mon, 25 Mar 2019 20:58:58 +0000 (20:58 +0000)]
[LLVM-C] Add binding to look up intrinsic by name

Summary: Add a binding to Function::lookupIntrinsicID so clients don't have to go searching the ID table themselves.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 356948

5 years agoAMDGPU: Add support for cross address space synchronization scopes (clang)
Konstantin Zhuravlyov [Mon, 25 Mar 2019 20:54:00 +0000 (20:54 +0000)]
AMDGPU: Add support for cross address space synchronization scopes (clang)

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

llvm-svn: 356947

5 years agoAMDGPU: Add support for cross address space synchronization scopes
Konstantin Zhuravlyov [Mon, 25 Mar 2019 20:50:21 +0000 (20:50 +0000)]
AMDGPU: Add support for cross address space synchronization scopes

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

llvm-svn: 356946

5 years ago[pstl][NFC] Remove some warnings
Louis Dionne [Mon, 25 Mar 2019 20:44:07 +0000 (20:44 +0000)]
[pstl][NFC] Remove some warnings

llvm-svn: 356945

5 years ago[ScriptInterpreterPython] Make SWIG callback private (NFC)
Jonas Devlieghere [Mon, 25 Mar 2019 20:39:08 +0000 (20:39 +0000)]
[ScriptInterpreterPython] Make SWIG callback private (NFC)

With the initialization taking place inside the Python script
interpreter, these function no longer need to be public. The exception
is the g_swig_init_callback which is used from the RAII object.

llvm-svn: 356944

5 years ago[lld] Prevent duplicate files in debug line header in dwarf 5.
Ali Tamur [Mon, 25 Mar 2019 20:18:27 +0000 (20:18 +0000)]
[lld] Prevent duplicate files in debug line header in dwarf 5.

Summary:
Changes to a couple of tests that will start failing after https://reviews.llvm.org/D59515 is submitted.

Reviewers: echristo, ruiu, espindola

Reviewed By: echristo, ruiu

Subscribers: emaste, arichardson, MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 356943

5 years ago[ScriptInterpreterPython] Move SWIG initialization into the Python plugin (NFC)
Jonas Devlieghere [Mon, 25 Mar 2019 20:14:31 +0000 (20:14 +0000)]
[ScriptInterpreterPython] Move SWIG initialization into the Python plugin (NFC)

Abstract initialization of the Python SWIG support in the Python plugin.

llvm-svn: 356942

5 years ago[llvm] Prevent duplicate files in debug line header in dwarf 5.
Ali Tamur [Mon, 25 Mar 2019 20:08:00 +0000 (20:08 +0000)]
[llvm] Prevent duplicate files in debug line header in dwarf 5.

Summary:

Motivation: In previous dwarf versions, file name indexes started from 1, and
the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes
the primary source file to be explicitly given an entry with an index number 0.

The current implementation honors the specification by just duplicating the
main source file, once with index number 0, and later maybe with another
index number. While this is compliant with the letter of the standard, the
duplication causes problems for consumers of this information such as lldb.
(Some files are duplicated, where only some of them have a line table although
all refer to the same file)

With this change, dwarf 5 debug line section files always start from 0, and
the zeroth entry is not duplicated whenever possible. This requires different
handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns
an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5)
However, I think the minor complication is worth it, because it enables all
consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the
file name list homogenously.

Reviewers: dblaikie, probinson, aprantl, espindola

Reviewed By: probinson

Subscribers: emaste, jvesely, nhaehnle, aprantl, javed.absar, arichardson, hiraditya, MaskRay, rupprecht, jdoerfert, llvm-commits

Tags: #llvm, #debug-info

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

llvm-svn: 356941

5 years agoThread Safety: also look at ObjC methods
JF Bastien [Mon, 25 Mar 2019 20:06:32 +0000 (20:06 +0000)]
Thread Safety: also look at ObjC methods

Summary:
SExprBuilder::translateDeclRefExpr was only looking at FunctionDecl and not also looking at ObjCMethodDecl. It should consider both because the attributes can be used on Objective-C as well.

<rdar://problem/48941331>

Reviewers: dexonsmith, erik.pilkington

Subscribers: jkorous, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 356940

5 years ago[SLPVectorizer] Merge reorderAltShuffleOperands into reorderInputsAccordingToOpcode
Simon Pilgrim [Mon, 25 Mar 2019 20:05:27 +0000 (20:05 +0000)]
[SLPVectorizer] Merge reorderAltShuffleOperands into reorderInputsAccordingToOpcode

As discussed on D59738, this generalizes reorderInputsAccordingToOpcode to handle multiple + non-commutative instructions so we can get rid of reorderAltShuffleOperands and make use of the extra canonicalizations that reorderInputsAccordingToOpcode brings.

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

llvm-svn: 356939

5 years ago[SelectionDAG] Add icmp UNDEF handling to SelectionDAG::FoldSetCC
Simon Pilgrim [Mon, 25 Mar 2019 18:51:57 +0000 (18:51 +0000)]
[SelectionDAG] Add icmp UNDEF handling to SelectionDAG::FoldSetCC

First half of PR40800, this patch adds DAG undef handling to icmp instructions to match the behaviour in llvm::ConstantFoldCompareInstruction and SimplifyICmpInst, this permits constant folding of vector comparisons where some elements had been reduced to UNDEF (by SimplifyDemandedVectorElts etc.).

This involved a lot of tweaking to reduced tests as bugpoint loves to reduce icmp arguments to undef........

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

llvm-svn: 356938

5 years ago[CGP] Build the DominatorTree lazily
Teresa Johnson [Mon, 25 Mar 2019 18:38:48 +0000 (18:38 +0000)]
[CGP] Build the DominatorTree lazily

Summary:
In r355512 CGP was changed to build the DominatorTree only once per
function traversal, to avoid repeatedly building it each time it was
accessed. This solved one compile time issue but introduced another. In
the second case, we now were building the DT unnecessarily many times
when we performed many function traversals (i.e. more than once per
function when running CGP because of changes made each time).

Change to saving the DT in the CodeGenPrepare object, and building it
lazily when needed. It is reset whenever we need to rebuild it.

The case that exposed the issue there are 617 functions, and we walk
them (i.e. execute the "while (MadeChange)" loop in runOnFunction) a
total of 12083 times (so previously we were building the DT 12083
times). With this patch we only build the DT 844 times (average of 1.37
times per function). We dropped the total time to compile this file from
538.11s without this patch to 339.63s with it.

There is still an issue as CGP is taking much longer than all other
passes even with this patch, and before a recent compiler release cut at
r355392 the total time to this compile was only 97 sec with a huge
reduction in CGP time. I suspect that one of the other recent changes to
CGP led to iterating each function many more times on average, but I
need to do some more investigation.

Reviewers: spatel

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356937

5 years agoFix interoperability test compilation on FreeBSD
Dimitry Andric [Mon, 25 Mar 2019 18:37:49 +0000 (18:37 +0000)]
Fix interoperability test compilation on FreeBSD

Summary:
While building the 8.0 releases on FreeBSD, I encountered the following
error in the regression tests, where ompt/misc/interoperability.cpp
failed to compile, with:

```
projects/openmp/runtime/test/ompt/misc/interoperability.cpp:7:10: fatal error: 'alloca.h' file not found
#include <alloca.h>
         ^~~~~~~~~~
```

Like on NetBSD, alloca(3) is defined in <stdlib.h> instead.

Reviewers: emaste, jlpeyton, krytarowski, mgorny, protze.joachim

Reviewed By: jlpeyton

Subscribers: jdoerfert, openmp-commits

Tags: #openmp

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

llvm-svn: 356936

5 years ago[pstl] Gate usage of TBB in test on whether TBB is used as a backend
Louis Dionne [Mon, 25 Mar 2019 18:37:28 +0000 (18:37 +0000)]
[pstl] Gate usage of TBB in test on whether TBB is used as a backend

__PSTL_USE_PAR_POLICIES is the wrong macro to use there, since the PSTL
could conceivably be using parallel policies but not TBB as a backend.

llvm-svn: 356935

5 years agoFix gettid warnings on FreeBSD
Dimitry Andric [Mon, 25 Mar 2019 18:37:14 +0000 (18:37 +0000)]
Fix gettid warnings on FreeBSD

Summary:
[Split off from D59451 to get this fix in separately]

While building the 8.0 releases on FreeBSD, I encountered the following
warnings in openmp quite a few times:

```
In file included from projects/openmp/runtime/src/kmp_settings.cpp:27:
projects/openmp/runtime/src/kmp_wrapper_getpid.h:35:2: warning: #warning is a language extension [-Wpedantic]
#warning No gettid found, use getpid instead
 ^
projects/openmp/runtime/src/kmp_wrapper_getpid.h:35:2: warning: No gettid found, use getpid instead [-W#warnings]
2 warnings generated.
```

I added a gettid wrapper that uses FreeBSD's pthread_getthreadid_np(3)
function for this.

Reviewers: emaste, jlpeyton, krytarowski, mgorny, protze.joachim

Reviewed By: jlpeyton

Subscribers: jfb, jdoerfert, openmp-commits

Tags: #openmp

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

llvm-svn: 356934

5 years ago[OpenMP] Fix pause check with version info
Jonathan Peyton [Mon, 25 Mar 2019 18:17:55 +0000 (18:17 +0000)]
[OpenMP] Fix pause check with version info

Add 5.0 guard to pause code for now.

Patch by Terry Wilmarth

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

llvm-svn: 356933

5 years agoRevert "[WebAssembly] Add linker options to control feature checking"
Thomas Lively [Mon, 25 Mar 2019 18:10:26 +0000 (18:10 +0000)]
Revert "[WebAssembly] Add linker options to control feature checking"

This reverts commit 5991328c96b6146999cfa74ede42901f8c01f2fa.

llvm-svn: 356932

5 years agoclang -dumpversion returns 4.2.1 for legacy reason, update it
Sylvestre Ledru [Mon, 25 Mar 2019 18:06:20 +0000 (18:06 +0000)]
clang -dumpversion returns 4.2.1 for legacy reason, update it

Summary:
It has been introduced in 2011 for gcc compat:
https://github.com/llvm-mirror/clang/commit/95a907fc0f2f717dca38a379c1d2353bfea06d4f
it is probably time to remove it to remove the confusion.

reported: https://bugs.llvm.org/show_bug.cgi?id=38836
https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1810860

Reviewers: ddunbar, rnk

Reviewed By: rnk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 356931

5 years ago[x86] add another vector zext test; NFC
Sanjay Patel [Mon, 25 Mar 2019 17:53:56 +0000 (17:53 +0000)]
[x86] add another vector zext test; NFC

Goes with the proposal in D59777

llvm-svn: 356930

5 years agoMoved everything SMT-related to LLVM and updated the cmake scripts.
Mikhail R. Gadelha [Mon, 25 Mar 2019 17:47:45 +0000 (17:47 +0000)]
Moved everything SMT-related to LLVM and updated the cmake scripts.

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

llvm-svn: 356929

5 years ago[clang-format] Refine structured binding detection
Krasimir Georgiev [Mon, 25 Mar 2019 17:29:16 +0000 (17:29 +0000)]
[clang-format] Refine structured binding detection

Summary:
Revision r356575 had the unfortunate consequence that now clang-format never
detects an ObjC call expression after `&&`.

This patch tries harder to distinguish between C++17 structured bindings and
ObjC call expressions and adds a few regression tests.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 356928

5 years ago[Args] Handle backticks to prevent crash.
Jonas Devlieghere [Mon, 25 Mar 2019 17:27:14 +0000 (17:27 +0000)]
[Args] Handle backticks to prevent crash.

Currently LLDB crashes when autocompleting a command that ends with a
backtick because the quote character wasn't handled. This fixes that and
adds a unit test for this function.

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

llvm-svn: 356927

5 years agoMISched: Don't schedule regions with 0 instructions
Matt Arsenault [Mon, 25 Mar 2019 17:15:44 +0000 (17:15 +0000)]
MISched: Don't schedule regions with 0 instructions

I think this is correct, but may not necessarily be the correct fix
for the assertion I'm really trying to solve. If a scheduling region
was found that only has dbg_value instructions, the RegPressure
tracker would end up in an inconsistent state because it would skip
over any debug instructions and point to an instruction outside of the
scheduling region. It may still be possible for this to happen if
there are some real schedulable instructions between dbg_values, but I
haven't managed to break this.

The testcase is extremely sensitive and I'm not sure how to make it
more resistent to future scheduler changes that would avoid stressing
this situation.

llvm-svn: 356926

5 years ago[Sema][NFCI] Don't allocate storage for the various CorrectionCandidateCallback unles...
Bruno Ricci [Mon, 25 Mar 2019 17:08:51 +0000 (17:08 +0000)]
[Sema][NFCI] Don't allocate storage for the various CorrectionCandidateCallback unless we are going to do some typo correction

The various CorrectionCandidateCallbacks are currently heap-allocated
unconditionally. This was needed because of delayed typo correction.
However these allocations represent currently 15.4% of all allocations
(number of allocations) when parsing all of Boost (!), mostly because
of ParseCastExpression, ParseStatementOrDeclarationAfterAttrtibutes
and isCXXDeclarationSpecifier. Note that all of these callback objects
are small. Let's not do this.

Instead initially allocate the callback on the stack, and only do a
heap allocation if we are going to do some typo correction. Do this by:

1. Adding a clone function to each callback, which will do a polymorphic
   clone of the callback. This clone function is required to be implemented
   by every callback (of which there is a fair amount). Make sure this is
   the case by making it pure virtual.

2. Use this clone function when we are going to try to correct a typo.

This additionally cut the time of -fsyntax-only on all of Boost by 0.5%
(not that much, but still something). No functional changes intended.

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

Reviewed By: rnk

llvm-svn: 356925

5 years agomerge-request.sh: Update 8.0 metabug for 8.0.1
Tom Stellard [Mon, 25 Mar 2019 17:01:29 +0000 (17:01 +0000)]
merge-request.sh: Update 8.0 metabug for 8.0.1

llvm-svn: 356924