platform/upstream/llvm.git
5 years ago[OpenMP] Shutdown library on Windows if possible for better OMPT behavior
Jonathan Peyton [Tue, 2 Oct 2018 19:15:04 +0000 (19:15 +0000)]
[OpenMP] Shutdown library on Windows if possible for better OMPT behavior

On Windows, child workers are terminated by the parent during the normal
program exit process (ExitProcess()) and they are not able to finish generating
their OpenMP events. We can force manual library shut down in __kmpc_end() to
fix this at least for the cases where __kmpc_end() is properly inserted.

Patch by Hansang Bae

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

llvm-svn: 343619

5 years ago[OpenMP][NVPTX] Simplify codegen for orphaned parallel, NFCI.
Jonas Hahnfeld [Tue, 2 Oct 2018 19:12:54 +0000 (19:12 +0000)]
[OpenMP][NVPTX] Simplify codegen for orphaned parallel, NFCI.

Worker threads fork off to the compiler generated worker function
directly after entering the kernel function. Hence, there is no
need to check whether the current thread is the master if we are
outside of a parallel region (neither SPMD nor parallel_level > 0).

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

llvm-svn: 343618

5 years ago[OpenMP] Simplify code for reductions on distribute directives, NFC.
Jonas Hahnfeld [Tue, 2 Oct 2018 19:12:47 +0000 (19:12 +0000)]
[OpenMP] Simplify code for reductions on distribute directives, NFC.

Only need to care about the 'distribute simd' case, all other composite
directives are handled elsewhere. This was already reflected in the
outer 'if' condition, so all other inner conditions could never be true.

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

llvm-svn: 343617

5 years agoRevert "X86, AArch64, ARM: Do not attach debug location to spill/reload instructions"
Matt Morehouse [Tue, 2 Oct 2018 18:35:44 +0000 (18:35 +0000)]
Revert "X86, AArch64, ARM: Do not attach debug location to spill/reload instructions"

This reverts r343520 due to breakage of HWASan tests on Android.

llvm-svn: 343616

5 years ago[llvm-mca] Constify the 'notify' routines. NFC.
Matt Davis [Tue, 2 Oct 2018 18:26:33 +0000 (18:26 +0000)]
[llvm-mca] Constify the 'notify' routines. NFC.

Also fixed up some whitespace formatting in DispatchStage.cpp.

llvm-svn: 343615

5 years ago[X86][Disassembler] Add bizarro versions of the MOVSXD instruction that sign extend...
Craig Topper [Tue, 2 Oct 2018 18:16:19 +0000 (18:16 +0000)]
[X86][Disassembler] Add bizarro versions of the MOVSXD instruction that sign extend from a GR32 to GR32 or GR16.

The 0x63 opcodes in 64-bit mode have a fixed source size of 32-bits, but the destination size is controlled by REX.W and the 0x66 opsize prefix. This instruction is normally used with a REX.W prefix which provides desired behavior. The other encodings are interpretted as valid by the processor, but aren't useful.

This patch makes us recognize them for the disassembler to match objdump.

llvm-svn: 343614

5 years ago[globalisel][verifier] Run the MachineVerifier from IRTranslator onwards
Daniel Sanders [Tue, 2 Oct 2018 17:56:58 +0000 (17:56 +0000)]
[globalisel][verifier] Run the MachineVerifier from IRTranslator onwards

-verify-machineinstrs inserts the MachineVerifier after every MachineInstr-based
pass. However, GlobalISel creates MachineInstr-based passes earlier than DAGISel
and the corresponding verifiers are not being added. This patch fixes that.

If GlobalISel triggers the fallback path then the MIR can be left in a bad
state that is going to be cleared by ResetMachineFunctions. In this situation
verifying between GlobalISel passes will prevent the fallback path from
recovering from this. As a result, we bail out of verifying a function if the
FailedISel attribute is present.

llvm-svn: 343613

5 years agoDWARFExpression: Resolve file addresses in the linked module
Adrian Prantl [Tue, 2 Oct 2018 17:50:42 +0000 (17:50 +0000)]
DWARFExpression: Resolve file addresses in the linked module

This is a follow-up to https://reviews.llvm.org/D46362.

When evaluating a complex expression in DWARFExpression::Evaluate,
file addresses must be resolved to load addresses before we can
perform operations such as DW_OP_deref on them.

For this the address goes through three steps

1. Read the file address as stored in the DWARF
2. Link/relocate the file address (when reading from a .dSYM, this is a no-op)
3. Convert the file address to a load address.

D46362 implemented step (3) by resolving the file address using the
Module that the original DWARF came from. In the case of a dSYM that
is correct, but when reading from .o files, we need to look up
relocated/linked addresses, so the right place to look them up is the
current frame's module. This patch fixes that by setting the
expression's Module to point to the linked debugmap object.

A word a bout the unorthodox testcase: The motivating testcase for
this fix is in Swift, but I managed to hand-modify LLVM-IR for a
trivial C program to exhibit the same problem, so we can fix this in
llvm.org.

rdar://problem/44689915

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

llvm-svn: 343612

5 years ago[HIP] Support early finalization of device code for -fno-gpu-rdc
Yaxun Liu [Tue, 2 Oct 2018 17:48:54 +0000 (17:48 +0000)]
[HIP] Support early finalization of device code for -fno-gpu-rdc

This patch renames -f{no-}cuda-rdc to -f{no-}gpu-rdc and keeps the original
options as aliases. When -fgpu-rdc is off,
clang will assume the device code in each translation unit does not call
external functions except those in the device library, therefore it is possible
to compile the device code in each translation unit to self-contained kernels
and embed them in the host object, so that the host object behaves like
usual host object which can be linked by lld.

The benefits of this feature is: 1. allow users to create static libraries which
can be linked by host linker; 2. amortized device code linking time.

This patch modifies HIP action builder to insert actions for linking device
code and generating HIP fatbin, and pass HIP fatbin to host backend action.
It extracts code for constructing command for generating HIP fatbin as
a function so that it can be reused by early finalization. It also modifies
codegen of HIP host constructor functions to embed the device fatbin
when it is available.

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

llvm-svn: 343611

5 years agoRevert r343589 "[clangd] Dex: add Corpus factory for iterators, rename, fold constant...
Reid Kleckner [Tue, 2 Oct 2018 17:31:43 +0000 (17:31 +0000)]
Revert r343589 "[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC"

Declaring a field with the same name as a type causes GCC to error out:

Dex.h:104:10: error: declaration of 'clang::clangd::dex::Corpus clang::clangd::dex::Dex::Corpus' [-fpermissive]
   Corpus Corpus;
          ^
Iterator.h:127:7: error: changes meaning of 'Corpus' from 'class clang::clangd::dex::Corpus' [-fpermissive]
 class Corpus {

llvm-svn: 343610

5 years agoRemove GetPythonDir declaration from HostInfoBase class
Tatyana Krasnukha [Tue, 2 Oct 2018 17:24:58 +0000 (17:24 +0000)]
Remove GetPythonDir declaration from HostInfoBase class

llvm-svn: 343609

5 years ago[clangd] Don't make check-clangd as a dependency in check-clang-tools
Haojian Wu [Tue, 2 Oct 2018 17:22:11 +0000 (17:22 +0000)]
[clangd] Don't make check-clangd as a dependency in check-clang-tools

Summary:
check-clang-tools will run check-clangd first, and then run the rest
tests. If clangd tests fails, check-clang-tools would be stopped.

This would block other clang-tools developers if clangd is broken.

Reviewers: sammccall

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

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

llvm-svn: 343608

5 years ago[lib/fuzzer] Fix logging for Fuchsia
Petr Hosek [Tue, 2 Oct 2018 17:21:04 +0000 (17:21 +0000)]
[lib/fuzzer] Fix logging for Fuchsia

This change fixes two aspects of logging on Fuchsia:

1. When logging to stdout, the output file descriptor should not be
closed in ExecuteCommand, as it prevent fdio_spawn_etc from succeeding
in subsequent calls.
2. When logging to a file in anything other than standalone Zircon, the
log file needs to be created in mutable storage. The best indicator
where this is relative to the Fuchsia component will be given by
'-artifact_prefix=...', so save the log file relative to that path.

Patch by: aarongreen
Differential Revision: https://reviews.llvm.org/D52562

llvm-svn: 343607

5 years agoReland r342652 "[winasan] Unpoison the stack in NtTerminateThread"
David Major [Tue, 2 Oct 2018 17:17:12 +0000 (17:17 +0000)]
Reland r342652 "[winasan] Unpoison the stack in NtTerminateThread"

In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall.

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

llvm-svn: 343606

5 years ago[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output
Vitaly Buka [Tue, 2 Oct 2018 17:01:18 +0000 (17:01 +0000)]
[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output

Summary:
Behavior for existing used is not changing as the first line is going
to be the same, and it was invalid to try to read more lines.

New clients can read until they get empty string.

Reviewers: eugenis, morehouse

Subscribers: kubamracek, eraman, llvm-commits

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

llvm-svn: 343605

5 years ago[NFC][BUG-FIX][ARM] Add missing data symbol
Diogo N. Sampaio [Tue, 2 Oct 2018 16:53:12 +0000 (16:53 +0000)]
[NFC][BUG-FIX][ARM] Add missing data symbol

llvm rL343594: [ARM] Emmit data symbol
for constant pool data fixed a bug that ommited
required data symbols.
Such change breaked a test case in lld:
test/ELF/arm-thunk-largesection.s

llvm-svn: 343604

5 years ago[codeview] Fix 32-bit x86 variable locations in realigned stack frames
Reid Kleckner [Tue, 2 Oct 2018 16:43:52 +0000 (16:43 +0000)]
[codeview] Fix 32-bit x86 variable locations in realigned stack frames

Add the .cv_fpo_stackalign directive so that we can define $T0, or the
VFRAME virtual register, with it. This was overlooked in the initial
implementation because unlike MSVC, we push CSRs before allocating stack
space, so this value is only needed to describe local variable
locations. Variables that the compiler now addresses via ESP are instead
described as being stored at offsets from VFRAME, which for us is ESP
after alignment in the prologue.

This adds tests that show that we use the VFRAME register properly in
our S_DEFRANGE records, and that we emit the correct FPO data to define
it.

Fixes PR38857

llvm-svn: 343603

5 years agoclang-format: better handle statement macros
Francois Ferrand [Tue, 2 Oct 2018 16:37:51 +0000 (16:37 +0000)]
clang-format: better handle statement macros

Summary:
Some macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new line, and not get merged with the next line. This is for example the case with Qt's Q_UNUSED macro:

  void foo(int a, int b) {
    Q_UNUSED(a)
    return b;
  }

This patch deals with these cases by introducing a new option to specify list of statement macros. This re-uses the system already in place for foreach macros, to ensure there is no impact on performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: krasimir

Subscribers: acoomans, mgrang, alexfh, klimek, cfe-commits

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

llvm-svn: 343602

5 years ago[Arm builtins] Remove non-necessary IS check
Kristina Brooks [Tue, 2 Oct 2018 16:32:32 +0000 (16:32 +0000)]
[Arm builtins] Remove non-necessary IS check

This patch removes the instruction set check to make the msr APSR_nzcvq,
ip instruction only execute if Thumb2 is used.
The APSR is a subset of the bits of the CPSR
(B.1.3.3 of the Arm v7 A and R ARM [1]) and is only available for A and
R profiles.
However in section B.9.3.11 of the same document we see that:

"In the A and R profiles, APSR_nzcvq is the same as CPSR_f"
"ARM recommends the APSR forms when only the N, Z, C, V, Q, and GE[3:0]
bits are being written."

This patch also make those files assemble for Armv8-M Mainline
architecture profile.

The builtins were cross-compiled for Arm, Aarch64 and Armv6-M, Armv7-M
and Armv7E-M targets.
Cross-compiled tests were executed for Arm target.

[1]: https://developer.arm.com/docs/ddi0406/latest/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition

Patch by hug-dev (Hugues de Valon).

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

llvm-svn: 343601

5 years agoRevert "[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output"
Jessica Paquette [Tue, 2 Oct 2018 16:28:52 +0000 (16:28 +0000)]
Revert "[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output"

This reverts r343554.

It was breaking some bots:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/49997/

llvm-svn: 343600

5 years ago[sanitizer] Use -Wl,-z,global on Android for sanitizers except UBsan
Stephen Hines [Tue, 2 Oct 2018 16:19:42 +0000 (16:19 +0000)]
[sanitizer] Use -Wl,-z,global on Android for sanitizers except UBsan

Summary:
This essentially reverts r337010 since it breaks UBSan, which is used
for a few platform libraries. The "-z global" flag is now added for
Scudo as well. The only other sanitizer shared libraries are for asan
and hwasan, which have also been reinstated to use the global flag.

Reviewers: cryptoad, eugenis

Reviewed By: cryptoad

Subscribers: kubamracek, mgorny, delcypher, #sanitizers, nickdesaulniers, chh, kongyi, pirama, llvm-commits

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

llvm-svn: 343599

5 years ago[X86][Btver2] Fix BLENDV and AESDEC schedules
Simon Pilgrim [Tue, 2 Oct 2018 15:13:18 +0000 (15:13 +0000)]
[X86][Btver2] Fix BLENDV and AESDEC schedules

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343597

5 years ago[Hexagon] Fix extracting subvectors of non-HVX vNi1
Krzysztof Parzyszek [Tue, 2 Oct 2018 15:05:43 +0000 (15:05 +0000)]
[Hexagon] Fix extracting subvectors of non-HVX vNi1

Patch by Brendon Cahoon.

llvm-svn: 343596

5 years ago[InstCombine] add tests with undef elements; NFC
Sanjay Patel [Tue, 2 Oct 2018 15:00:56 +0000 (15:00 +0000)]
[InstCombine] add tests with undef elements; NFC

See discussion in D52747.

llvm-svn: 343595

5 years ago[ARM] Emmit data symbol for constant pool data
Diogo N. Sampaio [Tue, 2 Oct 2018 14:55:48 +0000 (14:55 +0000)]
[ARM] Emmit data symbol for constant pool data

The ARM elf emitter would omit printing data
symbol when constant data. This patch
overrides the emitFill method as to enforce that
the symbol is correctly printed.

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

llvm-svn: 343594

5 years ago[clangd] Add a #include completion test that triggers an assertion.
Haojian Wu [Tue, 2 Oct 2018 14:46:08 +0000 (14:46 +0000)]
[clangd] Add a #include completion test that triggers an assertion.

Summary: Test for https://reviews.llvm.org/D52774.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 343593

5 years ago[Preprocesssor] Filename should fall back to the written name when typo correction...
Haojian Wu [Tue, 2 Oct 2018 14:42:51 +0000 (14:42 +0000)]
[Preprocesssor] Filename should fall back to the written name when typo correction fails.

Summary:
The test is added in  Testcase is at https://reviews.llvm.org/D52775. I tried to add the test to clang's code
completion test, it doesn't reproduce the crash.

Reviewers: sammccall, kristina

Reviewed By: sammccall

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

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

llvm-svn: 343592

5 years ago[Preprocessor] Hide include typo correction behind SpellChecking.
Haojian Wu [Tue, 2 Oct 2018 13:59:49 +0000 (13:59 +0000)]
[Preprocessor] Hide include typo correction behind SpellChecking.

Summary:
Similar to Sema typo correction, the Preprocessor typo correction should
also be hidden behind the SpellChecking flag.

Reviewers: sammccall

Subscribers: cfe-commits

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

llvm-svn: 343591

5 years ago[clangd] Zap TODONEs
Sam McCall [Tue, 2 Oct 2018 13:51:43 +0000 (13:51 +0000)]
[clangd] Zap TODONEs

llvm-svn: 343590

5 years ago[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC
Sam McCall [Tue, 2 Oct 2018 13:44:26 +0000 (13:44 +0000)]
[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC

Summary:
- Corpus avoids having to pass size to the true iterator, and (soon) any
  iterator that might optimize down to true.
- Shorten names of factory functions now they're scoped to the Corpus.
  intersect() and unionOf() rather than createAnd() or createOr() as this
  seems to read better to me, and fits with other short names. Opinion wanted!
- DEFAULT_BOOST_SCORE --> 1. This is a multiplier, don't obfuscate identity.
- Simplify variadic templates in Iterator.h

Reviewers: ioeric

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

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

llvm-svn: 343589

5 years ago[NFC][CodeGen][X86] fma.ll, lwp-intrinsics.ll: actually spell --check-prefixes corre...
Roman Lebedev [Tue, 2 Oct 2018 13:34:50 +0000 (13:34 +0000)]
[NFC][CodeGen][X86] fma.ll, lwp-intrinsics.ll: actually spell  --check-prefixes correctly :/

llvm-svn: 343588

5 years ago[InstCombine] add more insert/extract vector tests with FP types; NFC
Sanjay Patel [Tue, 2 Oct 2018 13:34:05 +0000 (13:34 +0000)]
[InstCombine] add more insert/extract vector tests with FP types; NFC

These are candidates for the same fold that was implemented in
D52439, but FP types require bitcasting (and that changes the
extra uses profitability calculation).

llvm-svn: 343587

5 years ago[X86] Remove unnecessary BT(C/R/S)m(i/r) scheduler overrides
Simon Pilgrim [Tue, 2 Oct 2018 13:11:59 +0000 (13:11 +0000)]
[X86] Remove unnecessary BT(C/R/S)m(i/r) scheduler overrides

Some SchedAlias remain due to some badly setup RMW tags - but at least the overrides are all removed

llvm-svn: 343586

5 years ago[NFC][CodeGen][X86] lwp-intrinsics.ll: fix check prefixes
Roman Lebedev [Tue, 2 Oct 2018 13:11:08 +0000 (13:11 +0000)]
[NFC][CodeGen][X86] lwp-intrinsics.ll: fix check prefixes

llvm-svn: 343585

5 years ago[NFC][CodeGen][X86] fma.ll: fix check prefixes for -mcpu=bdver2
Roman Lebedev [Tue, 2 Oct 2018 13:10:55 +0000 (13:10 +0000)]
[NFC][CodeGen][X86] fma.ll: fix check prefixes for -mcpu=bdver2

llvm-svn: 343584

5 years ago[OpenCL] Add block argument CodeGen test
Sven van Haastregt [Tue, 2 Oct 2018 13:02:27 +0000 (13:02 +0000)]
[OpenCL] Add block argument CodeGen test

r326937 ("[OpenCL] Remove block invoke function from emitted block
literal struct", 2018-03-07) broke block argument handling.  In
particular the commit was causing a crash during code generation, see
the discussion in https://reviews.llvm.org/D43783 .

The offending commit has just been reverted; add a test to avoid
breaking this again in the future.

llvm-svn: 343583

5 years agoRevert r326937 "[OpenCL] Remove block invoke function from emitted block literal...
Sven van Haastregt [Tue, 2 Oct 2018 13:02:24 +0000 (13:02 +0000)]
Revert r326937 "[OpenCL] Remove block invoke function from emitted block literal struct"

This reverts r326937 as it broke block argument handling in OpenCL.
See the discussion on https://reviews.llvm.org/D43783 .

The next commit will add a test case that revealed the issue.

llvm-svn: 343582

5 years ago[analyzer] Improvements to the SMT API
Mikhail R. Gadelha [Tue, 2 Oct 2018 12:55:48 +0000 (12:55 +0000)]
[analyzer] Improvements to the SMT API

Summary:
Several improvements in preparation for the new backends.

Refactoring:

- Removed duplicated methods `fromBoolean`, `fromAPSInt`, `fromInt` and `fromAPFloat`. The methods `mkBoolean`, `mkBitvector` and `mkFloat` are now used instead.
- The names of the functions that convert BVs to FPs were swapped (`mkSBVtoFP`, `mkUBVtoFP`, `mkFPtoSBV`, `mkFPtoUBV`).
- Added a couple of comments in function calls.

Crosscheck encoding:

- Changed how constraints are encoded in the refutation manager so it doesn't start with (false OR ...). This change introduces one duplicated line (see file `BugReporterVisitors.cpp`, the `SMTConv::getRangeExpr is called twice, so I can remove this change if the duplication is a problem.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

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

llvm-svn: 343581

5 years ago[clangd] Dex iterator printer shows query structure, not iterator state.
Sam McCall [Tue, 2 Oct 2018 11:51:36 +0000 (11:51 +0000)]
[clangd] Dex iterator printer shows query structure, not iterator state.

Summary:
This makes it suitable for logging (which immediately found a bug, to
be fixed in the next patch...)

Reviewers: ioeric

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

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

llvm-svn: 343580

5 years ago[AST] Pack the bit-fields of FunctionProtoType into Type.
Bruno Ricci [Tue, 2 Oct 2018 11:46:38 +0000 (11:46 +0000)]
[AST] Pack the bit-fields of FunctionProtoType into Type.

Move the bit-fields of FunctionProtoType into FunctionTypeBitfields.
This cuts the size of FunctionProtoType by a pointer. Additionally use
llvm::TrailingObjects instead of manually doing the casts + arithmetic.

This patch is bigger then what could be expected for the following reasons:

1. As discussed before in D50631 it would be nice if there was some space left
   in FunctionTypeBitfields for future additions. This patch introduces an
   extra structure FunctionTypeExtraBitfields which is supposed to hold
   uncommon bits and is stored in a trailing object. The number of exception
   types NumExceptions is moved to this struct. As of this patch this trailing
   struct will only be allocated if we have > 0 types in a dynamic exception
   specification.

2. TrailingObjects cannot handle repeated types. Therefore the QualType
   representing an exception type is wrapped in a struct ExceptionType.
   The ExceptionType * is then reinterpret_cast'd to QualType *.

3. TrailingObjects needs the definition of the various trailing classes.
   Therefore ExtParameterInfo, ExceptionType and FunctionTypeExtraBitfields
   are put in FunctionType.

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

Reviewed By: rjmccall

llvm-svn: 343579

5 years ago[clang-tidy] Ignore singe bit bitfield -> bool conversion in readability-implicit...
Alexander Kornienko [Tue, 2 Oct 2018 11:38:41 +0000 (11:38 +0000)]
[clang-tidy] Ignore singe bit bitfield -> bool conversion in readability-implicit-bool-conversion

llvm-svn: 343578

5 years ago[X86] Add APInt constant assembly printer helper
Simon Pilgrim [Tue, 2 Oct 2018 11:32:33 +0000 (11:32 +0000)]
[X86] Add APInt constant assembly printer helper

llvm-svn: 343577

5 years ago[clangd] Cache FS stat() calls when building preamble.
Eric Liu [Tue, 2 Oct 2018 10:43:55 +0000 (10:43 +0000)]
[clangd] Cache FS stat() calls when building preamble.

Summary:
The file stats can be reused when preamble is reused (e.g. code
completion). It's safe to assume that cached status is not outdated as we
assume preamble files to remain unchanged.

On real file system, this made code completion ~20% faster on a measured file
(with big preamble). The preamble build time doesn't change much.

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

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

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

llvm-svn: 343576

5 years ago[CodeComplete] Re-fix accessibilty of protected members from base class.
Eric Liu [Tue, 2 Oct 2018 10:29:00 +0000 (10:29 +0000)]
[CodeComplete] Re-fix accessibilty of protected members from base class.

Summary:
The initial fix (r337453) had bug and was partially reverted (r338255).
This simplies the original fix by explicitly passing the naming class to the
completion consumer.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 343575

5 years agoRevert untintentionally commited changes
Eric Liu [Tue, 2 Oct 2018 10:28:54 +0000 (10:28 +0000)]
Revert untintentionally commited changes

llvm-svn: 343574

5 years ago[Lex] TokenConcatenation now takes const Preprocessor
Eric Liu [Tue, 2 Oct 2018 10:28:50 +0000 (10:28 +0000)]
[Lex] TokenConcatenation now takes const Preprocessor

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

llvm-svn: 343573

5 years ago[AArch64][v8.5A] Add Memory Tagging instructions
Oliver Stannard [Tue, 2 Oct 2018 10:04:39 +0000 (10:04 +0000)]
[AArch64][v8.5A] Add Memory Tagging instructions

This adds new instructions to manipluate tagged pointers, and to load
and store the tags associated with memory.

Patch by Pablo Barrio, David Spickett and Oliver Stannard!

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

llvm-svn: 343572

5 years ago[AArch64][v8.5A] Add Memory Tagging system registers
Oliver Stannard [Tue, 2 Oct 2018 09:54:35 +0000 (09:54 +0000)]
[AArch64][v8.5A] Add Memory Tagging system registers

This adds new system registers introduced by the Memory Tagging
extension.

Patch by Pablo Barrio!

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

llvm-svn: 343571

5 years ago[AArch64][v8.5A] Add MTE system instructions
Oliver Stannard [Tue, 2 Oct 2018 09:48:43 +0000 (09:48 +0000)]
[AArch64][v8.5A] Add MTE system instructions

The Memory Tagging Extension adds system instructions for data cache
maintenance, implemented as new operands to the DC instruction.

Patch by Pablo Barrio!

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

llvm-svn: 343570

5 years ago[InstCombine] Fold ~A - Min/Max(~A, O) -> Max/Min(A, ~O) - A
David Green [Tue, 2 Oct 2018 09:48:34 +0000 (09:48 +0000)]
[InstCombine] Fold ~A - Min/Max(~A, O) -> Max/Min(A, ~O) - A

This is an attempt to get out of a local-minimum that instcombine currently
gets stuck in. We essentially combine two optimisations at once, ~a - ~b = b-a
and min(~a, ~b) = ~max(a, b), only doing the transform if the result is at
least neutral. This involves using IsFreeToInvert, which has been expanded a
little to include selects that can be easily inverted.

This is trying to fix PR35875, using the ideas from Sanjay. It is a large
improvement to one of our rgb to cmy kernels.

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

llvm-svn: 343569

5 years ago[clang] Implement Override Suggestions in Sema.
Kadir Cetinkaya [Tue, 2 Oct 2018 09:42:31 +0000 (09:42 +0000)]
[clang] Implement Override Suggestions in Sema.

Summary:
In clangd we had a new type of completion suggestions for cpp
class/struct/unions that will show override signatures for virtual methods in
base classes. This patch implements it in sema because it is hard to deduce more
info about completion token outside of Sema and handle itchy cases.

See the patch D50898 for more info on the functionality.

In addition to above patch this one also converts the suggestion into a
CK_Pattern with whole insertion text as the name of the suggestion and factors
out CodeCompletionString generation for declerations so that it can be re-used
by others.

Reviewers: ioeric, ilya-biryukov

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 343568

5 years ago[clangd] Remove override result handling logic from clangd
Kadir Cetinkaya [Tue, 2 Oct 2018 09:42:17 +0000 (09:42 +0000)]
[clangd] Remove override result handling logic from clangd

Summary:
Since we plan to move handling of override suggestions to Sema with
D52225 this patch just makes sure clangd-side has no logic related to that
anymore and updates tests.

Reviewers: ioeric, ilya-biryukov

Reviewed By: ioeric

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 343567

5 years ago[AArch64][v8.5A] Test clang option for the Memory Tagging Extension
Oliver Stannard [Tue, 2 Oct 2018 09:38:59 +0000 (09:38 +0000)]
[AArch64][v8.5A] Test clang option for the Memory Tagging Extension

The implementation of this is in TargetParser, so we only need to add a
test for it in clang.

Patch by Pablo Barrio!

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

llvm-svn: 343566

5 years ago[clang-tidy] NFC use CHECK-NOTES in test for cppgoreguidelines-avoid-goto
Jonas Toth [Tue, 2 Oct 2018 09:38:26 +0000 (09:38 +0000)]
[clang-tidy] NFC use CHECK-NOTES in test for cppgoreguidelines-avoid-goto

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

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

llvm-svn: 343565

5 years ago[clang-tidy] NFC use CHECK-NOTES in tests for cppcoreguidelines-owning-memory
Jonas Toth [Tue, 2 Oct 2018 09:38:20 +0000 (09:38 +0000)]
[clang-tidy] NFC use CHECK-NOTES in tests for cppcoreguidelines-owning-memory

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

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

llvm-svn: 343564

5 years ago[AArch64][v8.5A] Add MTE as an optional AArch64 extension
Oliver Stannard [Tue, 2 Oct 2018 09:36:28 +0000 (09:36 +0000)]
[AArch64][v8.5A] Add MTE as an optional AArch64 extension

This adds the memory tagging extension, which is an optional extension
introduced in v8.5A. The new instructions and registers will be added by
subsequent patches.

Patch by Pablo Barrio!

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

llvm-svn: 343563

5 years ago[X86] Standardize floating point assembly comments
Simon Pilgrim [Tue, 2 Oct 2018 09:08:51 +0000 (09:08 +0000)]
[X86] Standardize floating point assembly comments

Consistently try to use APFloat::toString for floating point constant comments to get rid of differences between Constant / ConstantDataSequential values - it should help stop some of the linux-windows buildbot failures matching NaN/INF etc. as well.

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

llvm-svn: 343562

5 years ago[InstCombine] Tests for ~A - Min/Max(~A, O) -> Max/Min(A, ~O) - A. NFC
David Green [Tue, 2 Oct 2018 09:06:49 +0000 (09:06 +0000)]
[InstCombine] Tests for ~A - Min/Max(~A, O) -> Max/Min(A, ~O) - A. NFC

llvm-svn: 343561

5 years agoAdded warning for unary minus used with unsigned type
David Bolvansky [Tue, 2 Oct 2018 06:02:30 +0000 (06:02 +0000)]
Added warning for unary minus used with unsigned type

Summary:
Inspired by MSVC, which found some occurrences of this expression on our code base.

Fixes PR38950

Reviewers: rsmith, craig.topper, spatel, RKSimon, aaron.ballman, thakis

Reviewed By: rsmith

Subscribers: joerg, Quuxplusone, lebedev.ri, craig.topper, RKSimon, cfe-commits

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

llvm-svn: 343560

5 years agoAMDGPU: Expand atomicrmw nand in IR
Matt Arsenault [Tue, 2 Oct 2018 03:50:56 +0000 (03:50 +0000)]
AMDGPU: Expand atomicrmw nand in IR

llvm-svn: 343559

5 years ago[WebAssembly] Restore slashes in SIMD conversion names
Thomas Lively [Tue, 2 Oct 2018 01:52:21 +0000 (01:52 +0000)]
[WebAssembly] Restore slashes in SIMD conversion names

Summary: Depends on D52372 and D52442.

Reviewers: aheejin, dschuff, aardappel

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

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

llvm-svn: 343558

5 years ago[CodeGen] Before entering the loop that copies a non-trivial array field
Akira Hatanaka [Tue, 2 Oct 2018 01:00:44 +0000 (01:00 +0000)]
[CodeGen] Before entering the loop that copies a non-trivial array field
of a non-trivial C struct, copy the preceding trivial fields that
haven't been copied.

This commit fixes a bug where the instructions used to copy the
preceding trivial fields were emitted inside the loop body.

rdar://problem/44185064

llvm-svn: 343556

5 years ago[MCA] Remove SM.hasNext() call in FetchStage::execute.
Owen Rodley [Tue, 2 Oct 2018 00:40:08 +0000 (00:40 +0000)]
[MCA] Remove SM.hasNext() call in FetchStage::execute.

Summary:
This is redundant, as FetchStage::getNextInstruction already checks this
and returns llvm::ErrorSuccess() as appropriate.

NFC.

Reviewers: andreadb

Subscribers: gbedwell, llvm-commits

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

llvm-svn: 343555

5 years ago[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output
Vitaly Buka [Tue, 2 Oct 2018 00:29:41 +0000 (00:29 +0000)]
[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output

Summary:
Behavior for existing used is not changing as the first line is going
to be the same, and it was invalid to try to read more lines.

New clients can read until they get empty string.

Reviewers: eugenis, morehouse

Subscribers: kubamracek, eraman, llvm-commits

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

llvm-svn: 343554

5 years ago[AArch64][DAGCombiner]: change -stop-after=isel to instruction-select
Fangrui Song [Tue, 2 Oct 2018 00:22:51 +0000 (00:22 +0000)]
[AArch64][DAGCombiner]: change -stop-after=isel to instruction-select

"isel" is registered by AMDGPU. The test will break if the AMDGPU target
is not built.

llvm-svn: 343553

5 years ago[ELF] Read the call graph profile from object files.
Michael J. Spencer [Tue, 2 Oct 2018 00:17:15 +0000 (00:17 +0000)]
[ELF] Read the call graph profile from object files.

This uses the call graph profile embedded in the object files to construct the call graph.

This is read from a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight).

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

llvm-svn: 343552

5 years ago[SimplifyCFG] Use Value::hasNUses instead of 'getNumUses() =='. NFCI
Craig Topper [Mon, 1 Oct 2018 23:09:52 +0000 (23:09 +0000)]
[SimplifyCFG] Use Value::hasNUses instead of 'getNumUses() =='. NFCI

getNumUses is linear in the number of uses. Since we're looking for a specific use count, we can use hasNUses which will stop as soon as it determines there are more than N uses instead of walking all of them.

llvm-svn: 343550

5 years ago[llvm-mca] Rename the 'Subtract' method to 'subtract'
Matt Davis [Mon, 1 Oct 2018 23:01:45 +0000 (23:01 +0000)]
[llvm-mca] Rename the 'Subtract' method to 'subtract'

llvm-svn: 343549

5 years ago[SimplifyCFG] Update comments that refer to CondBB to say ThenBB instead. NFC
Craig Topper [Mon, 1 Oct 2018 22:56:11 +0000 (22:56 +0000)]
[SimplifyCFG] Update comments that refer to CondBB to say ThenBB instead. NFC

There is no variable in this function named CondBB, but there is one named ThenBB and I believe the comments are all refering to it.

llvm-svn: 343548

5 years ago[PDB] Add support for more kinds of PDB Sym Tags.
Zachary Turner [Mon, 1 Oct 2018 22:39:19 +0000 (22:39 +0000)]
[PDB] Add support for more kinds of PDB Sym Tags.

DIA SDK is returning several new sym tag types, so we update
the enumeration and printing code to support these.

llvm-svn: 343547

5 years agoRevert: r343521 and r343541: [globalisel] Add a combiner helpers for extending loads...
Daniel Sanders [Mon, 1 Oct 2018 22:32:08 +0000 (22:32 +0000)]
Revert: r343521 and r343541: [globalisel] Add a combiner helpers for extending loads and use them in a pre-legalize combiner for AArch64

There's a strange assertion on two of the Green Dragon bots that goes away when
this is reverted. The assertion is in RegBankAlloc and if it is this commit then
-verify-machine-instrs should have caught it earlier in the pipeline.

llvm-svn: 343546

5 years agoEnable C++ tests to run in the -gmodules configuration on Darwin.
Adrian Prantl [Mon, 1 Oct 2018 22:27:42 +0000 (22:27 +0000)]
Enable C++ tests to run in the -gmodules configuration on Darwin.

This addresses PR36048 (http://llvm.org/bugs/show_bug.cgi?id=36048)

rdar://problem/36776281

llvm-svn: 343545

5 years ago[codeview] Simplify S_DEFRANGE emission code, NFC
Reid Kleckner [Mon, 1 Oct 2018 22:25:49 +0000 (22:25 +0000)]
[codeview] Simplify S_DEFRANGE emission code, NFC

These assembler directives are still pretty unreadable and it would be
nice to clean them up at some point.

llvm-svn: 343544

5 years ago[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Reid Kleckner [Mon, 1 Oct 2018 21:59:45 +0000 (21:59 +0000)]
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL

Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.

On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.

To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit.  Offsets
to local variables are instead relative to this value.

This is part of PR38857.

Reviewers: hans, zturner, javed.absar

Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits

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

llvm-svn: 343543

5 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Mon, 1 Oct 2018 21:51:28 +0000 (21:51 +0000)]
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

This reapplies r343518 after fixing a use-after-free bug in function
Sema::ActOnBlockStmtExpr where the BlockScopeInfo was dereferenced after
it was popped and deleted.

rdar://problem/39352313

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

llvm-svn: 343542

5 years agoFix the Windows build in GlobalISel
Reid Kleckner [Mon, 1 Oct 2018 21:39:39 +0000 (21:39 +0000)]
Fix the Windows build in GlobalISel

Clang-cl was complaining about some sort of constexpr narrowing bug:

C:\src\llvm-project\llvm\lib\CodeGen\GlobalISel\CombinerHelper.cpp(136,31):  error: non-constant-expression cannot be narrowed from type 'llvm::TargetOpcode::(anonymous enum at C:\src\llvm-project\llvm\include\llvm/CodeGen/TargetOpcodes.h:22:1)' to 'unsigned int' in initializer list [-Wc++11-narrowing]
                              unsigned(MI.getOpcode()) == unsigned(TargetOpcode::G_LOAD)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\src\llvm-project\llvm\lib\CodeGen\GlobalISel\CombinerHelper.cpp(136,31):  note: insert an explicit cast to silence this issue
                              unsigned(MI.getOpcode()) == unsigned(TargetOpcode::G_LOAD)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                              static_cast<unsigned int>(

llvm-svn: 343541

5 years agoRecommit r343499 "[X86] Enable load folding in the test shrinking code"
Craig Topper [Mon, 1 Oct 2018 21:35:28 +0000 (21:35 +0000)]
Recommit r343499 "[X86] Enable load folding in the test shrinking code"

Original message:
This patch adds load folding support to the test shrinking code. This was noticed missing in the review for D52669

llvm-svn: 343540

5 years agoRecommit r343498 "[X86] Improve test instruction shrinking when the sign flag is...
Craig Topper [Mon, 1 Oct 2018 21:35:26 +0000 (21:35 +0000)]
Recommit r343498 "[X86] Improve test instruction shrinking when the sign flag is used and the output of the and is truncated."

This includes a fix to prevent i16 compares with i32/i64 ands from being shrunk if bit 15 of the and is set and the sign bit is used.

Original commit message:
Currently we skip looking through truncates if the sign flag is used. But that's overly restrictive.

It's safe to look through the truncate as long as we ensure one of the 3 things when we shrink. Either the MSB of the mask at the shrunken size isn't set. If the mask bit is set then either the shrunk size needs to be equal to the compare size or the sign

There are still missed opportunities to shrink a load and fold it in here. This will be fixed in a future patch.

llvm-svn: 343539

5 years agoSort expected test output after previous commit
Stephen Kelly [Mon, 1 Oct 2018 21:10:30 +0000 (21:10 +0000)]
Sort expected test output after previous commit

llvm-svn: 343538

5 years ago[MinGW] Allow using ASan
Martin Storsjo [Mon, 1 Oct 2018 20:53:25 +0000 (20:53 +0000)]
[MinGW] Allow using ASan

Linking to ASan for MinGW is similar to MSVC, but MinGW always links
the MSVCRT dynamically, so there is only one of the MSVC cases to
consider.

When linking to a shared compiler runtime library on MinGW, the suffix
of the import library is .dll.a.

The existing case of .dll as suffix for windows in general doesn't
seem correct (since this is used for linking). As long as callers never
actually set the Shared flag, the default static suffix of .lib also
worked fine for import libraries as well.

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

llvm-svn: 343537

5 years ago[clang-query] Test non-code-completion on single letter shortcuts
Stephen Kelly [Mon, 1 Oct 2018 20:45:44 +0000 (20:45 +0000)]
[clang-query] Test non-code-completion on single letter shortcuts

llvm-svn: 343536

5 years ago[clang-query] Add missing quit test
Stephen Kelly [Mon, 1 Oct 2018 20:45:39 +0000 (20:45 +0000)]
[clang-query] Add missing quit test

llvm-svn: 343535

5 years ago[sanitizer] Small buffer tests for __sanitizer_symbolize_pc
Vitaly Buka [Mon, 1 Oct 2018 20:39:49 +0000 (20:39 +0000)]
[sanitizer] Small buffer tests for __sanitizer_symbolize_pc

llvm-svn: 343534

5 years ago[clang-query] Add missing 'l' command handling
Stephen Kelly [Mon, 1 Oct 2018 20:34:21 +0000 (20:34 +0000)]
[clang-query] Add missing 'l' command handling

The `let` command was added in commit 045c15ba (Add new 'let' command to
bind arbitrary values into constants., 2014-04-23).

The `let` command and the non-existant `l` command were documented in
commit 233092a0 (Add 'let' to the help message., 2015-02-27).

Implement the `l` command now for completeness.

llvm-svn: 343533

5 years ago[clang-query] Sort command options
Stephen Kelly [Mon, 1 Oct 2018 20:34:15 +0000 (20:34 +0000)]
[clang-query] Sort command options

llvm-svn: 343532

5 years agoRevert r343518.
Akira Hatanaka [Mon, 1 Oct 2018 20:29:34 +0000 (20:29 +0000)]
Revert r343518.

Bots are still failing.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/24420
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12958

llvm-svn: 343531

5 years agoUpdate CMakeLists.txt snippet so that example compiles
Stephen Kelly [Mon, 1 Oct 2018 20:28:07 +0000 (20:28 +0000)]
Update CMakeLists.txt snippet so that example compiles

Summary: Previous to this the example didn't work out of the box, it seems some cmake config changed between when this was written and now.

Author: Dan Zimmerman <daniel.zimmerman@me.com>

Reviewers: modocache, steveire

Reviewed By: steveire

Subscribers: smeenai, steveire, cfe-commits

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

llvm-svn: 343530

5 years ago[InstCombine] add inverse test for vector trunc canonical form; NFC
Sanjay Patel [Mon, 1 Oct 2018 20:25:49 +0000 (20:25 +0000)]
[InstCombine] add inverse test for vector trunc canonical form; NFC

llvm-svn: 343529

5 years ago[clang-tidy] Build it even without static analyzer
Stephen Kelly [Mon, 1 Oct 2018 20:24:22 +0000 (20:24 +0000)]
[clang-tidy] Build it even without static analyzer

Conditionally compile the parts of clang-tidy which depend on the static
analyzer.

Funnily enough, I made the patch to exclude this from the build in 2013,
and it was committed with the comment that the tool should not be fully
excluded, but only the parts of it which depend on the analyzer should
be excluded.

 http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130617/081797.html

This commit implements that idea.

Reviewed By: aaron.ballman

Tags: #clang-tools-extra

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

llvm-svn: 343528

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Mon, 1 Oct 2018 20:22:28 +0000 (20:22 +0000)]
[InstCombine] regenerate test checks; NFC

These files used an old version of the script.
We regex more now.

llvm-svn: 343527

5 years ago[clangd] exclude check-clangd from check-all, fix buildbot failure.
Haojian Wu [Mon, 1 Oct 2018 20:21:41 +0000 (20:21 +0000)]
[clangd] exclude check-clangd from check-all, fix buildbot failure.

check-clangd is included via check-clang-tools, otherwise we will run two
instances of check-clangd in parallel when running 'check-all',
which may have race condition.

llvm-svn: 343526

5 years ago[PowerPC] Folding XForm to DForm loads requires alignment for some DForm loads.
Stefan Pintilie [Mon, 1 Oct 2018 20:16:27 +0000 (20:16 +0000)]
[PowerPC] Folding XForm to DForm loads requires alignment for some DForm loads.

Going from XForm Load to DSForm Load requires that the immediate be 4 byte
aligned.
If we are not aligned we must leave the load as LDX (XForm).
This bug is causing a compile-time failure in the benchmark h264ref.

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

llvm-svn: 343525

5 years agoRemove a path-length limitation for the xray logfile.
Douglas Yung [Mon, 1 Oct 2018 20:03:53 +0000 (20:03 +0000)]
Remove a path-length limitation for the xray logfile.

Reviewers: MaskRay

Subscribers: llvm-commits

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

Patch by Jeremy Morse!

llvm-svn: 343524

5 years agoSwitch syscall(2)/__syscall(2) calls to libc calls on NetBSD
Kamil Rytarowski [Mon, 1 Oct 2018 19:50:12 +0000 (19:50 +0000)]
Switch syscall(2)/__syscall(2) calls to libc calls on NetBSD

Summary:
When possible, switch syscall(2)/__syscall(2) calls
to direct calls of internal libc symbols.

Add a new function to detect address of a libc
symbol of a function that could be intercepted.
With the address detector in GetRealLibcAddress(),
an optional interceptor of libc call will be bypassed.

The original approach with syscall(2)/__syscall(2)
wasn't portable across supported ABIs and CPU
architectures. The indirect syscall interface is
also a candidate for removal in future revisions
of NetBSD, as the C language ABI is not a good
domain for serialization of arbitrary functions
arguments.

Switch the following functions to libc calls:
 - internal_mmap()
 - internal_munmap()
 - internal_mprotect()
 - internal_close()
 - internal_open()
 - internal_read()
 - internal_write()
 - internal_ftruncate()
 - internal_stat()
 - internal_lstat()
 - internal_fstat()
 - internal_dup2()
 - internal_readlink()
 - internal_unlink()
 - internal_rename()
 - internal_sched_yield()
 - internal__exit()
 - internal_sleep()
 - internal_execve()
 - NanoTime()
 - internal_clock_gettime()
 - internal_waitpid()
 - internal_getpid()
 - internal_getppid()
 - internal_getdents()
 - internal_lseek()
 - internal_sigaltstack()
 - internal_fork()
 - internal_sigprocmask()
 - internal_sysctl()
 - internal_sigemptyset()
 - internal_sigfillset()
 - GetTid()
 - TgKill()

This revision leaves room for refactoring in subsequent commits.

Reviewers: vitalybuka, kcc, joerg

Reviewed By: vitalybuka

Subscribers: mgorny, fedor.sergeev, jfb, loverszhaokai, devnexen, kubamracek, llvm-commits, ro, #sanitizers

Tags: #sanitizers

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

llvm-svn: 343523

5 years agoTemporarily revert "[GVNHoist] Re-enable GVNHoist by default"
Eric Christopher [Mon, 1 Oct 2018 18:57:08 +0000 (18:57 +0000)]
Temporarily revert "[GVNHoist] Re-enable GVNHoist by default"

This reverts commit r342387 as it's showing significant performance
regressions in a number of benchmarks. Followed up with the
committer and original thread with an example and will get performance
numbers before recommitting.

llvm-svn: 343522

5 years ago[globalisel] Add a combiner helpers for extending loads and use them in a pre-legaliz...
Daniel Sanders [Mon, 1 Oct 2018 18:56:47 +0000 (18:56 +0000)]
[globalisel] Add a combiner helpers for extending loads and use them in a pre-legalize combiner for AArch64

Summary: Depends on D45541

Reviewers: ab, aditya_nandakumar, bogner, rtereshin, volkan, rovka, javed.absar, aemerson

Subscribers: aemerson, rengolin, mgorny, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 343521

5 years agoX86, AArch64, ARM: Do not attach debug location to spill/reload instructions
Matthias Braun [Mon, 1 Oct 2018 18:56:39 +0000 (18:56 +0000)]
X86, AArch64, ARM: Do not attach debug location to spill/reload instructions

Spill/reload instructions are artificially generated by the compiler and
have no relation to the original source code. So the best thing to do is
not attach any debug location to them (instead of just taking the next
debug location we find on following instructions).

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

llvm-svn: 343520

5 years ago[X86] Add more test shrinking with truncate and sign bit usage tests. NFC
Craig Topper [Mon, 1 Oct 2018 18:52:19 +0000 (18:52 +0000)]
[X86] Add more test shrinking with truncate and sign bit usage tests. NFC

llvm-svn: 343519

5 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Mon, 1 Oct 2018 18:50:14 +0000 (18:50 +0000)]
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

This reapplies r341754, which was reverted in r341757 because it broke a
couple of bots. r341754 was calling markEscapingByrefs after the call to
PopFunctionScopeInfo, which caused the popped function scope to be
cleared out when the following code was compiled, for example:

$ cat test.m
struct A {
  id data[10];
};

void foo() {
  __block A v;
  ^{ (void)v; };
}

This commit calls markEscapingByrefs before calling PopFunctionScopeInfo
to prevent that from happening.

rdar://problem/39352313

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

llvm-svn: 343518

5 years ago[clang-format] Update comment, NFCI
Krasimir Georgiev [Mon, 1 Oct 2018 18:41:21 +0000 (18:41 +0000)]
[clang-format] Update comment, NFCI

The initializer of `ParameterCount` was updated from 1 to 0 in r175165,
but the comment was never touched:
https://github.com/llvm-mirror/clang/commit/9fc56f2636137fcde8acb38865555ed6c7b84dfd

llvm-svn: 343517