platform/upstream/llvm.git
4 years ago[llvm-cov] Add option to whitelist filenames
Vedant Kumar [Tue, 29 Oct 2019 22:47:23 +0000 (15:47 -0700)]
[llvm-cov] Add option to whitelist filenames

Add the `-whitelist-filename-regex` option to restrict coverage
reporting to file paths that match a whitelist regex.

Patch by Michael Daniels!

rdar://56720320

4 years ago[lit] Refactor ordering of tests
Julian Lettner [Mon, 25 Feb 2019 05:49:42 +0000 (21:49 -0800)]
[lit] Refactor ordering of tests

4 years ago[ADT] add equality operator for SmallSet
Fedor Sergeev [Thu, 24 Oct 2019 19:24:44 +0000 (12:24 -0700)]
[ADT] add equality operator for SmallSet

Makes it easier to migrate existing code that uses std::set.

Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D69417

4 years agoBreak out OrcError and RPC
Chris Bieneman [Wed, 9 Oct 2019 21:27:52 +0000 (14:27 -0700)]
Break out OrcError and RPC

Summary:
When createing an ORC remote JIT target the current library split forces the target process to link large portions of LLVM (Core, Execution Engine, JITLink, Object, MC, Passes, RuntimeDyld, Support, Target, and TransformUtils). This occurs because the ORC RPC interfaces rely on the static globals the ORC Error types require, which starts a cycle of pulling in more and more.

This patch breaks the ORC RPC Error implementations out into an "OrcError" library which only depends on LLVM Support. It also pulls the ORC RPC headers into their own subdirectory.

With this patch code can include the Orc/RPC/*.h headers and will only incur link dependencies on LLVMOrcError and LLVMSupport.

Reviewers: lhames

Reviewed By: lhames

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoSuppress useless GCC "bitfield is too small to hold all values of enum class" warning.
Richard Smith [Wed, 30 Oct 2019 00:05:40 +0000 (17:05 -0700)]
Suppress useless GCC "bitfield is too small to hold all values of enum class" warning.

4 years agoAMDGPU/GlobalISel: Legalize FDIV32
Austin Kerbow [Tue, 29 Oct 2019 16:55:49 +0000 (09:55 -0700)]
AMDGPU/GlobalISel: Legalize FDIV32

Reviewers: arsenm

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

Tags: #llvm

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

4 years ago[MS] Fix constexpr data member pointer conversions
Reid Kleckner [Tue, 29 Oct 2019 00:05:34 +0000 (17:05 -0700)]
[MS] Fix constexpr data member pointer conversions

Constexpr data member conversions work by starting with the class that
originally introduced the field, and converting from there to the type
that the user desires. Before this change, Clang was using the
inheritance model from the final destination class type instead of the
model from the class that originally introduced the field. To fix this,
find the relevant FieldDecl and take its parent class instead of using
the member pointer type the user provided.

Indirect field decls require some special handling to find the parent
class.

Fixes PR43803

4 years ago[lldbsuite] Remove unused test_event files
Jonas Devlieghere [Tue, 29 Oct 2019 23:35:28 +0000 (16:35 -0700)]
[lldbsuite] Remove unused test_event files

These files don't appear to be used anywhere and the corresponding tests
are not run.

4 years ago[lldbsuite] Remove the DumpFormatter
Jonas Devlieghere [Tue, 29 Oct 2019 23:30:37 +0000 (16:30 -0700)]
[lldbsuite] Remove the DumpFormatter

This formatter is never used or referenced.

4 years ago[lldbsuite] Remove pre_kill_hook package
Jonas Devlieghere [Tue, 29 Oct 2019 23:29:12 +0000 (16:29 -0700)]
[lldbsuite] Remove pre_kill_hook package

This package was only used by dosep.py which has since been removed.

4 years ago[lldbsuite] Remove unused support files
Jonas Devlieghere [Tue, 29 Oct 2019 23:26:49 +0000 (16:26 -0700)]
[lldbsuite] Remove unused support files

To the best of my understanding these files or their content is nowhere
referenced.

4 years ago[lit] Small improvements in cl_arguments.py
Julian Lettner [Thu, 21 Feb 2019 07:33:15 +0000 (23:33 -0800)]
[lit] Small improvements in cl_arguments.py

*) `--max-tests` should be positive integer
*) `--max-time` should be positive integer
*) Remove unnecessary defaults for command line option parsing

4 years agoThread safety analysis: Peel away NoOp implicit casts in initializers
Aaron Puchert [Tue, 29 Oct 2019 23:37:06 +0000 (00:37 +0100)]
Thread safety analysis: Peel away NoOp implicit casts in initializers

Summary:
This happens when someone initializes a variable with guaranteed copy
elision and an added const qualifier. Fixes PR43826.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

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

4 years ago[LLD][ELF] Support --[no-]mmap-output-file with F_no_mmap
Nick Terrell [Tue, 29 Oct 2019 22:46:22 +0000 (15:46 -0700)]
[LLD][ELF] Support --[no-]mmap-output-file with F_no_mmap

Summary:
Add a flag `F_no_mmap` to `FileOutputBuffer` to support
`--[no-]mmap-output-file` in ELF LLD. LLD currently explicitly ignores
this flag for compatibility with GNU ld and gold.

We need this flag to speed up link time for large binaries in certain
scenarios. When we link some of our larger binaries we find that LLD
takes 50+ GB of memory, which causes memory pressure. The memory
pressure causes the VM to flush dirty pages of the output file to disk.
This is normally okay, since we should be flushing cold pages. However,
when using BtrFS with compression we need to write 128KB at a time when
we flush a page. If any page in that 128KB block is written again, then
it must be flushed a second time, and so on. Since LLD doesn't write
sequentially this causes write amplification. The same 128KB block will
end up being flushed multiple times, causing the linker to many times
more IO than necessary. We've observed 3-5x faster builds with
-no-mmap-output-file when we hit this scenario.

The bad scenario only applies to compressed filesystems, which group
together multiple pages into a single compressed block. I've tested
BtrFS, but the problem will be present for any compressed filesystem
on Linux, since it is caused by the VM.

Silently ignoring --no-mmap-output-file caused a silent regression when
we switched from gold to lld. We pass --no-mmap-output-file to fix this
edge case, but since lld silently ignored the flag we didn't realize it
wasn't being respected.

Benchmark building a 9 GB binary that exposes this edge case. I linked 3
times with --mmap-output-file and 3 times with --no-mmap-output-file and
took the average. The machine has 24 cores @ 2.4 GHz, 112 GB of RAM,
BtrFS mounted with -compress-force=zstd, and an 80% full disk.

| Mode    | Time  |
|---------|-------|
| mmap    | 894 s |
| no mmap | 126 s |

When compression is disabled, BtrFS performs just as well with and
without mmap on this benchmark.

I was unable to reproduce the regression with any binaries in
lld-speed-test.

Reviewed By: ruiu, MaskRay

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

4 years agoReplace std::function in PrintingPolicy with a callbacks object.
Richard Smith [Wed, 16 Oct 2019 00:51:08 +0000 (17:51 -0700)]
Replace std::function in PrintingPolicy with a callbacks object.

This makes PrintingPolicy significantly more lightweight and provides
groundwork for more printing customization hooks.

4 years ago[LLDB][breakpoints] ArgInfo::count -> ArgInfo::max_positional_args
Lawrence D'Anna [Tue, 29 Oct 2019 20:42:38 +0000 (13:42 -0700)]
[LLDB][breakpoints] ArgInfo::count -> ArgInfo::max_positional_args

Summary:
Move breakpoints from the old, bad ArgInfo::count to the new, better
ArgInfo::max_positional_args.   Soon ArgInfo::count will be no more.

It looks like this functionality is already well tested by
`TestBreakpointCommandsFromPython.py`, so there's no need to write
additional tests for it.

Reviewers: labath, jingham, JDevlieghere

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[Headers] Fix compatibility between arm_acle.h and intrin.h
Eli Friedman [Tue, 29 Oct 2019 21:52:56 +0000 (14:52 -0700)]
[Headers] Fix compatibility between arm_acle.h and intrin.h

Make sure they don't both define __nop.

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

4 years agoAccept __is_same_as as a GCC-compatibility synonym for the proper trait name __is_same.
Richard Smith [Tue, 29 Oct 2019 21:44:38 +0000 (14:44 -0700)]
Accept __is_same_as as a GCC-compatibility synonym for the proper trait name __is_same.

4 years ago[DWARF5] Added support for deleted C++ special member functions.
Adrian Prantl [Tue, 29 Oct 2019 16:20:14 +0000 (09:20 -0700)]
[DWARF5] Added support for deleted C++ special member functions.

This patch adds support for deleted C++ special member functions in
clang and llvm. Also added Defaulted member encodings for future
support for defaulted member functions.

Patch by Sourabh Singh Tomar!

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

4 years ago[globalisel][docs] Fix warning treated as error
Daniel Sanders [Tue, 29 Oct 2019 20:27:48 +0000 (13:27 -0700)]
[globalisel][docs] Fix warning treated as error

I had hoped that I could have some
```
.. code-block:: MIR
```
sections for MIR examples which causes a warning about pygments not
supporting it but we have warnings treated as errors

4 years ago[globalisel][docs] Rewrite the IRTranslator documentation
Daniel Sanders [Sat, 26 Oct 2019 02:54:01 +0000 (19:54 -0700)]
[globalisel][docs] Rewrite the IRTranslator documentation

Summary:
I haven't refreshed the Function Calls section as I don't feel I have
sufficient knowledge of that area. It would be appreciated if someone could
review that section.

Note: I'm aware that pygments doesn't support 'mir' as used in one of the
code-block directives. This currently emits a warning and I decided to
keep it to enable finding them later. Maybe we can teach pygments to
support it.

Depends on D69456

Reviewers: volkan, aditya_nandakumar

Subscribers: rovka, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years agoFix argument numbering confusion when diagnosing a non-viable operator().
Richard Smith [Tue, 29 Oct 2019 20:06:34 +0000 (13:06 -0700)]
Fix argument numbering confusion when diagnosing a non-viable operator().

This could lead to crashes if operator() is a variadic template, as we
could end up asking for an out-of-bounds argument.

4 years ago[ValueObjectDisplay] Generalize the description of an option.
Davide Italiano [Tue, 29 Oct 2019 20:05:56 +0000 (13:05 -0700)]
[ValueObjectDisplay] Generalize the description of an option.

4 years ago[SelectionDAG] Enable lowering unordered atomics loads w/LoadSDNode (and stores w...
Philip Reames [Tue, 29 Oct 2019 18:07:36 +0000 (11:07 -0700)]
[SelectionDAG] Enable lowering unordered atomics loads w/LoadSDNode (and stores w/StoreSDNode) by default

Enable the new SelectionDAG representation for unordered loads and stores introduced in r371441 by default.  As a reminder, the new lowering changes the representation of an unordered atomic load from an AtomicSDNode - which is essentially a black box which gets passed through without combines messing with it - to a LoadSDNode w/a atomic marker on the MMO. The later parallels the way we handle volatiles, and I've audited the code to ensure that every location which checks one checks the other.

This has been fairly heavily fuzzed, and I examined diffs in a reasonable large corpus of assembly by hand, so I'm reasonable sure this is correct for the common case.  Late in the review for this, it was discovered that I hadn't correctly handled cases which could be legalized into CAS operations.  This points out that there's a strong bias in the IR of the frontend I'm working with towards only legal atomics.  If there are problems with this patch, the most likely area will be legalization.

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

4 years ago[Docs] Reflect the slow migration from guard to widenable condition which is currentl...
Philip Reames [Fri, 25 Oct 2019 21:50:39 +0000 (14:50 -0700)]
[Docs] Reflect the slow migration from guard to widenable condition which is currently in progress.

4 years ago[lit] Extend internal diff to support `-` argument
Joel E. Denny [Thu, 17 Oct 2019 14:03:06 +0000 (14:03 +0000)]
[lit] Extend internal diff to support `-` argument

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-` as a command-line option.  This patch adds support for
`-` to mean stdin.

Reviewed By: probinson, rnk

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

4 years ago[lit] Make internal diff work in pipelines
Joel E. Denny [Thu, 17 Oct 2019 14:02:42 +0000 (14:02 +0000)]
[lit] Make internal diff work in pipelines

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
 # RUN: not diff file1 file2 | FileCheck %s
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Also, when lit's `diff` prints differences to stdout in Windows, this
patch ensures it always terminate lines with `\n` not `\r\n`.  That
way, strict FileCheck directives checking the `diff` output succeed in
both Linux and Windows.  This wasn't an issue when `diff` was internal
to lit because `diff` didn't then write to the true stdout, which is
where the `\n` -> `\r\n` conversion happened in Python.

Reviewed By: probinson, stella.stamenova

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

4 years ago[X86] Narrow i64 compares with constant to i32 when the upper 32-bits are known zero.
Craig Topper [Tue, 29 Oct 2019 17:47:02 +0000 (10:47 -0700)]
[X86] Narrow i64 compares with constant to i32 when the upper 32-bits are known zero.

This catches some cases. There are probably ways to improve this.
I tried doing it as a combine on the setcc, but that broke
some cases involving flag reuse in place of test.

I renamed the isX86CCUnsigned to isX86CCSigned and flipped its
polarity to make it consistent with the similar functions for
ISD::SETCC. This avoids calling EQ/NE as being signed or unsigned.

Fixes PR43823.

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

4 years ago[LLDB] Fix for windows bots broken by unsupported tests
shafik [Tue, 29 Oct 2019 18:33:11 +0000 (11:33 -0700)]
[LLDB] Fix for windows bots broken by unsupported tests

4 years ago[globalisel][docs] Rewrite the pipeline overview
Daniel Sanders [Sat, 26 Oct 2019 01:16:40 +0000 (18:16 -0700)]
[globalisel][docs] Rewrite the pipeline overview

Summary:
Rewrite the pipeline overview to be more focused on the structure and
flexibility as well as highlight the increased usefulness of
MachineVerifier and increased testability resulting from the smaller
incremental passes approach.

The diagrams are lifted from the slides for the LLVMDev 2019 talk
'Generating Optimized Code with GlobalISel' and adapted to be readable on
the white background used in the docs.

Reviewers: volkan

Subscribers: rovka, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years ago[X86][VBMI2] Add vector funnel shift tests
Simon Pilgrim [Tue, 29 Oct 2019 17:53:03 +0000 (17:53 +0000)]
[X86][VBMI2] Add vector funnel shift tests

Demonstrates missed opportunity to combine to the VBMI2 SHLDV/SHRDV ops - combineOrShiftToFunnelShift should handle vector ops (and we should eventually move this to DAGCombine).

4 years ago[libc++] Force the ABI namespace to be a reserved identifier
Louis Dionne [Thu, 24 Oct 2019 21:16:37 +0000 (14:16 -0700)]
[libc++] Force the ABI namespace to be a reserved identifier

Summary:
When the ABI namespace isn't a reserved identifier, we were issuing a
warning, but this should have been an error since the beginning. This
commit enforces that the ABI namespace is a reserved identifier, and
changes the ABI namespace used by LibFuzzer.

Reviewers: phosek, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, #sanitizers, libcxx-commits, llvm-commits

Tags: #sanitizers, #libc, #llvm

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

4 years agoRevert "[clang-format] Remove the dependency on frontend"
Vlad Tsyrklevich [Tue, 29 Oct 2019 17:20:38 +0000 (10:20 -0700)]
Revert "[clang-format] Remove the dependency on frontend"

This reverts commit ec66603ac7ea655be5c2c5f508c5bf0d5eaeb65b. It was
causing ubsan failures like the following on the ubsan bot:
llvm/lib/Support/SourceMgr.cpp:440:48: runtime error: pointer index expression with base 0x000000000000 overflowed to 0xfffffffffffffffa

4 years ago[SVE][AArch64] Adding pattern matching for some SVE instructions.
Ehsan Amiri [Tue, 29 Oct 2019 16:08:00 +0000 (12:08 -0400)]
[SVE][AArch64] Adding pattern matching for some SVE instructions.

Adding patten matching for two SVE intrinsics: frecps and frsqrts.
Also added patterns for fsub and fmul - these SDNodes directly correspond
to machine instructions.

Review: https://reviews.llvm.org/D68476
Patch authored by mgudim (Mikhail Gudim).

4 years ago[ELF] Delete redundant comment after D56554. NFC
Fangrui Song [Tue, 29 Oct 2019 17:00:46 +0000 (10:00 -0700)]
[ELF] Delete redundant comment after D56554. NFC

4 years ago[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK
Michał Górny [Mon, 21 Oct 2019 17:27:51 +0000 (19:27 +0200)]
[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK

Add a new '-z nognustack' option that suppresses emitting PT_GNU_STACK
segment.  This segment is not supported at all on NetBSD (stack is
always non-executable), and the option is meant to be used to disable
emitting it.

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

4 years ago[LLDB][Python] fix another fflush issue on NetBSD
Lawrence D'Anna [Tue, 29 Oct 2019 04:59:04 +0000 (21:59 -0700)]
[LLDB][Python] fix another fflush issue on NetBSD

Summary:
Here's another instance where we were calling fflush on an input
stream, which is illegal on NetBSD.

Reviewers: labath, mgorny

Reviewed By: mgorny

Subscribers: krytarowski, lldb-commits

Tags: #lldb

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

4 years ago[SLP] Fix -Wunused-variable. NFC
Fangrui Song [Tue, 29 Oct 2019 16:38:33 +0000 (09:38 -0700)]
[SLP] Fix -Wunused-variable. NFC

4 years agoisBuiltinFunc() uses StringRef instead of const char*
Guillaume Chatelet [Tue, 29 Oct 2019 16:28:34 +0000 (17:28 +0100)]
isBuiltinFunc() uses StringRef instead of const char*

Summary: This prevents a bug when passing nullptr, StringRef ctor would call strlen(nullptr).

Reviewers: vlad.tsyrklevich

Subscribers: cfe-commits

Tags: #clang

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

4 years agoReland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)
Sander de Smalen [Tue, 29 Oct 2019 12:49:34 +0000 (12:49 +0000)]
Reland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)

llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir failed with
EXPENSIVE_CHECKS enabled, causing the patch to be reverted in
rG2c496bb5309c972d59b11f05aee4782ddc087e71.

This patch relands the patch with a proper fix to the
live-debug-values-reg-copy.mir tests, by ensuring the MIR encodes the
callee-saves correctly so that the CalleeSaved info is taken from MIR
directly, rather than letting it be recalculated by the PEI pass. I've
done this by running `llc -stop-before=prologepilog` on the LLVM
IR as captured in the test files, adding the extra MOV instructions
that were manually added in the original test file, then running `llc
-run-pass=prologepilog` and finally re-added the comments for the MOV
instructions.

4 years ago[SLP] Generalization of stores vectorization.
Alexey Bataev [Mon, 28 Oct 2019 17:46:10 +0000 (13:46 -0400)]
[SLP] Generalization of stores vectorization.

Stores are vectorized with maximum vectorization factor of 16. Patch
tries to improve the situation and use maximal vectorization factor.

Reviewers: spatel, RKSimon, mkuper, hfinkel

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

4 years agoFix missing memcpy builtin on ppc64be
Guillaume Chatelet [Tue, 29 Oct 2019 15:35:11 +0000 (16:35 +0100)]
Fix missing memcpy builtin on ppc64be
See D68028

4 years ago[X86] Pull out combineOrShiftToFunnelShift helper. NFCI.
Simon Pilgrim [Tue, 29 Oct 2019 15:29:32 +0000 (15:29 +0000)]
[X86] Pull out combineOrShiftToFunnelShift helper. NFCI.

4 years agobuild: make standalone builds work again
Saleem Abdulrasool [Tue, 29 Oct 2019 15:24:10 +0000 (08:24 -0700)]
build: make standalone builds work again

Apple's greendragon bot uses a standalone build of lldb which would
fail to build after a recent change to LLVM as it relied on LLVM setting
global flags for its build.  Attempt to repair the standalone build for
greendragon bot.

4 years agobuild: workaround stale caches (NFC)
Saleem Abdulrasool [Tue, 29 Oct 2019 15:20:58 +0000 (08:20 -0700)]
build: workaround stale caches (NFC)

`LLVM_DEFAULT_TARGET_TRIPLE` is a cached variable, which means that it
may actually be unset.  Furthermore, in standalone builds, the variable
may be fully undefined.  Apply the regular expression over the empty
string in such a case.  This should improve the state of the green
dragon bot.

4 years ago[InstCombine] make icmp vector canonicalization safe for constant with undef elements
Sanjay Patel [Tue, 29 Oct 2019 14:39:59 +0000 (10:39 -0400)]
[InstCombine] make icmp vector canonicalization safe for constant with undef elements

This is a fix for:
https://bugs.llvm.org/show_bug.cgi?id=43730
...and as shown there, we have existing test cases that show potential miscompiles.

We could just bail out for vector constants that contain any undef elements, or we can do as shown here:
allow the transform, but replace the undefs with a safe value.

For most of the tests shown, this results in a full splat constant (no undefs) which is probably a win
for further IR analysis because we conservatively don't match undefs in most cases. Codegen can probably
recover these kinds of undef lanes via demanded elements analysis if that's profitable.

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

4 years ago[clang] Add no_builtin attribute
Guillaume Chatelet [Wed, 25 Sep 2019 09:31:28 +0000 (11:31 +0200)]
[clang] Add no_builtin attribute

Summary:
This is a follow up on https://reviews.llvm.org/D61634
This patch is simpler and only adds the no_builtin attribute.

Reviewers: tejohnson, courbet, theraven, t.p.northover, jdoerfert

Subscribers: mgrang, cfe-commits

Tags: #clang

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

This is a re-submit after it got reverted in https://reviews.llvm.org/rGbd8791610948 since the breakage doesn't seem to come from this patch.

4 years ago[lldb][NFC] Make LLVMUserExpression::DoExecute return early
Raphael Isemann [Tue, 29 Oct 2019 14:13:02 +0000 (15:13 +0100)]
[lldb][NFC] Make LLVMUserExpression::DoExecute return early

The giant if-else isn't conforming to LLVM code style.

4 years ago[OPENMP]Fix PR43772: No warning in non-combined target regions.
Alexey Bataev [Tue, 29 Oct 2019 14:06:11 +0000 (10:06 -0400)]
[OPENMP]Fix PR43772: No warning in non-combined target regions.

Need to analyze inner target regions in case of implicit mapping of the
data members when target region is created in one of the class member
functions.

4 years ago[bugpoint] Try to reduce passes after reducing everything.
Florian Hahn [Tue, 29 Oct 2019 13:41:19 +0000 (13:41 +0000)]
[bugpoint] Try to reduce passes after reducing everything.

In some cases, we fail to reduce the pass list earlier because of
complex pass dependencies, but we can reduce it after we simplified the
reproducer.

An example of that is PR43474, which can limit the crash to
-loop-interchange. Adding a test case would require at least 2
interacting Loop passes I think.

Reviewers: davide, reames, modocache

Reviewed By: reames

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

4 years ago[InstCombine] add tests for icmp predicate canonicalization with vector types; NFC
Sanjay Patel [Tue, 29 Oct 2019 13:39:46 +0000 (09:39 -0400)]
[InstCombine] add tests for icmp predicate canonicalization with vector types; NFC

Increase coverage for D69519.

4 years ago[Hexagon] Handle remaining registers in getRegisterByName()
Krzysztof Parzyszek [Mon, 28 Oct 2019 20:12:43 +0000 (15:12 -0500)]
[Hexagon] Handle remaining registers in getRegisterByName()

This fixes https://llvm.org/PR43829.

4 years ago[BitVector] Define BitWord as uintptr_t
Simon Pilgrim [Tue, 29 Oct 2019 13:52:32 +0000 (13:52 +0000)]
[BitVector] Define BitWord as uintptr_t

Define BitVector::BitWord as uintptr_t instead of unsigned long, as long does not necessarily translates to a pointer size (especially on 64-bit Visual Studio).

Committed on behalf of @ekatz (Ehud Katz)

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

4 years ago[IR] move/change null-check to assert
Sanjay Patel [Tue, 29 Oct 2019 13:25:36 +0000 (09:25 -0400)]
[IR] move/change null-check to assert

This should trigger a dereference before null-check warning,
but I don't see it when building with clang. In any case, the
current and known future users of this helper require non-null
args, so I'm converting the 'if' to an assert.

4 years ago[BitVector] Cast integer literals to BitWord [NFC]
Simon Pilgrim [Tue, 29 Oct 2019 12:56:13 +0000 (12:56 +0000)]
[BitVector] Cast integer literals to BitWord [NFC]

Associate the integer literals with BitWord, instead of the embedded UL suffix.

Required for https://reviews.llvm.org/D69336.

Committed on behalf of @ekatz (Ehud Katz)

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

4 years ago[IR] move helper function to replace undef constant (elements) with fixed constants
Sanjay Patel [Tue, 29 Oct 2019 11:41:41 +0000 (07:41 -0400)]
[IR] move helper function to replace undef constant (elements) with fixed constants

This is the NFC part of D69519.
We had this functionality locally in instcombine, but it can be used
elsewhere, so hoisting it to Constant class.

4 years ago[LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections
Martin Storsjö [Mon, 21 Oct 2019 06:26:55 +0000 (09:26 +0300)]
[LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections

The virtual container/header section caused the section list to be
offset by one, but by using FindSectionByID, the layout of the
section list shouldn't matter.

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

4 years agoFix some spelling mistakes in comments. NFC
Greg Bedwell [Tue, 29 Oct 2019 12:40:57 +0000 (12:40 +0000)]
Fix some spelling mistakes in comments. NFC

4 years agoFix a spelling mistake in a comment. NFC
Greg Bedwell [Tue, 29 Oct 2019 12:32:01 +0000 (12:32 +0000)]
Fix a spelling mistake in a comment. NFC

(I'm currently trying to debug a strange error message I get when
pushing to github, despite the pushes being successful).

4 years agoFix a spelling mistake in a comment. NFC
Greg Bedwell [Mon, 28 Oct 2019 14:28:00 +0000 (14:28 +0000)]
Fix a spelling mistake in a comment. NFC

4 years agoRevert "[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap"
Andrea Di Biagio [Tue, 29 Oct 2019 12:04:32 +0000 (12:04 +0000)]
Revert "[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap"

This reverts commit 8af5ada09319e5a021d57a1a03715b2fd022e415.

As Bjorn pointed out in D68816, the iteration over `UserVals` may not be safe.

Reverting on behalf of Orlando.

4 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Tue, 29 Oct 2019 12:12:16 +0000 (12:12 +0000)]
Fix unused variable warning. NFCI.

4 years ago[clangd] Add a hidden tweak to dump symbol under the cursor.
Haojian Wu [Mon, 28 Oct 2019 15:27:42 +0000 (16:27 +0100)]
[clangd] Add a hidden tweak to dump symbol under the cursor.

Summary:
This provides a convenient way to see the SymbolID/USR of the symbol, mainly
for debugging purpose.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[LCSSA] Forget values we create LCSSA phis for
Florian Hahn [Tue, 29 Oct 2019 11:54:18 +0000 (11:54 +0000)]
[LCSSA] Forget values we create LCSSA phis for

Summary:
Currently we only forget the loop we added LCSSA phis for. But SCEV
expressions in other loops could also depend on the instruction we added
a PHI for and currently we do not invalidate those expressions. This can
happen when we use ScalarEvolution before converting a function to LCSSA
form. The SCEV expressions will refer to the non-LCSSA value. If this
SCEV expression is then used with the expander, we do not preserve LCSSA
form.

This patch properly forgets the values we created PHIs for. Those need
to be recomputed again. This patch fixes PR43458.

Currently SCEV::verify does not catch this mismatch and any test would
need to run multiple passes to trigger the error (e.g. -loop-reduce
-loop-unroll). I will also look into catching this kind of mismatch in
the verifier. Also, we currently forget the whole loop in LCSSA and I'll
check if we can be more surgical.

Reviewers: efriedma, sanjoy.google, reames

Reviewed By: efriedma

Subscribers: zzheng, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years agoRevert rG70f5aecedef9a6e347e425eb5b843bf797b95319 - "Reland [AArch64][DebugInfo]...
Simon Pilgrim [Tue, 29 Oct 2019 11:54:38 +0000 (11:54 +0000)]
Revert rG70f5aecedef9a6e347e425eb5b843bf797b95319 - "Reland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)"

This fails on EXPENSIVE_CHECKS builds

4 years ago[BranchFolding] skip debug instr to avoid code change
Jeremy Morse [Tue, 29 Oct 2019 11:38:20 +0000 (11:38 +0000)]
[BranchFolding] skip debug instr to avoid code change

Use the existing helper function in BranchFolding, "countsAsInstruction",
to skip over non-instructions. Otherwise debug instructions can be
identified as the last real instruction in a block, leading to different
codegen decisions when debug is enabled as demonstrated by the test case.

Patch by: yechunliang (Chris Ye)!

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

4 years ago[ConstantFold] Push extractelement into getelementptr's operands
Jay Foad [Tue, 29 Oct 2019 10:31:52 +0000 (10:31 +0000)]
[ConstantFold] Push extractelement into getelementptr's operands

This fixes a minor oversight mentioned in the review of D69379:
we should push extractelement into the operands of getelementptr
regardless of whether that enables further folding.

4 years ago[clangd] NFC, use URI::resolve to simplify the code.
Haojian Wu [Tue, 29 Oct 2019 09:49:27 +0000 (10:49 +0100)]
[clangd] NFC, use URI::resolve to simplify the code.

4 years ago[obj2yaml] - Update a comment in a test case. NFC.
Georgii Rymar [Tue, 29 Oct 2019 08:58:19 +0000 (11:58 +0300)]
[obj2yaml] - Update a comment in a test case. NFC.

Addresses post-commit comments for D69160.

4 years ago[llvm-readobj] - Fix a comment in stack-sizes.test. NFC.
Georgii Rymar [Tue, 29 Oct 2019 08:49:19 +0000 (11:49 +0300)]
[llvm-readobj] - Fix a comment in stack-sizes.test. NFC.

To address post commit review comment for D69167.

4 years ago[clangd] Add missing highlights for using decls.
Haojian Wu [Mon, 28 Oct 2019 12:42:20 +0000 (13:42 +0100)]
[clangd] Add missing highlights for using decls.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.
Georgii Rymar [Mon, 28 Oct 2019 10:47:44 +0000 (13:47 +0300)]
[yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.

Before this change .symtab section was required for SHT_REL[A] section
declarations. yaml2obj automatically defined it in case when YAML document
did not have it.

With this change it is now possible to produce an object that
has a relocation section, but has no symbol table.

It simplifies the code and also it is inline with how we handle Link fields
for another special sections.

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

4 years ago[yaml2obj] - Improve handling of the SHT_GROUP section.
Georgii Rymar [Mon, 28 Oct 2019 10:30:05 +0000 (13:30 +0300)]
[yaml2obj] - Improve handling of the SHT_GROUP section.

Currently, when we do not specify "Info" field in a YAML description
for SHT_GROUP section, yaml2obj reports an error:
"error: unknown symbol referenced: '' by YAML section '.group1'"

Also, we do not link it with a symbol table by default,
though it is what we do for AddrsigSection, HashSection, RelocationSection.
(http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_link)

The patch fixes missings mentioned.

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

4 years ago[JITLink] Tighten section sorting criteria to fix a flaky test case.
Lang Hames [Tue, 29 Oct 2019 05:56:13 +0000 (22:56 -0700)]
[JITLink] Tighten section sorting criteria to fix a flaky test case.

Sections may have zero size and zero-sized sections may share a start address
with other zero-sized sections. For the section overlap test to function
correctly zero-sized sections must be ordered before any non-zero sized ones.

This should fix the intermittent failures in the
test/ExecutionEngine/JITLink/X86/MachO_zero_fill_alignment.s test case that
have been observed on some builders.

4 years agoAMDGPU: Make VReg_1 only include 1 artificial register
Matt Arsenault [Mon, 28 Oct 2019 19:26:27 +0000 (12:26 -0700)]
AMDGPU: Make VReg_1 only include 1 artificial register

When TableGen is inferring register classes from contexts, it uses a
sorting function based on the number of registers in the class. Since
this was being treated as an alias of VGPR_32, they had exactly the
same size. The sort used wasn't a stable sort, and even if it were, I
believe the tie breaker would effectively end up being the
alphabetical ordering of the class name. There appear to be issues
trying to use an empty set of registers, so add only one so this will
always sort to the end.

Also add a comment explaining how VReg_1 is a dirty hack for
SelectionDAG.

This does end up changing the behavior of i1 with inline asm and VGPR
constraints, but the existing behavior was was already nonsensical and
inconsistent. It should probably be disallowed anyway.

Fixes bug 43699

4 years ago[RISCV] Remove RA from reserved register to use as callee saved register
Shiva Chen [Tue, 15 Oct 2019 02:38:11 +0000 (10:38 +0800)]
[RISCV] Remove RA from reserved register to use as callee saved register

Remove RA from reserved register list, so we could use it as callee saved register

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

4 years ago[lit] Remove callback indirection
Julian Lettner [Thu, 21 Feb 2019 07:05:11 +0000 (23:05 -0800)]
[lit] Remove callback indirection

The callback provides no benefits since `run.execute()` does not take
any arguments anymore.

4 years agoFix a few typos in lld/ELF to cycle bots
Nico Weber [Tue, 29 Oct 2019 01:41:38 +0000 (21:41 -0400)]
Fix a few typos in lld/ELF to cycle bots

4 years ago[Attributor] Make IntegerState more flexible
Johannes Doerfert [Mon, 21 Oct 2019 03:28:49 +0000 (22:28 -0500)]
[Attributor] Make IntegerState more flexible

To make IntegerState more flexible but also less error prone we split it
up into (1) incrementing, (2) decrementing, and (3) bit-tracking states.
This adds functionality compared to before and disallows misuse, e.g.,
"incrementing" updates on a bit-tracking state.

Part of the change is a single operator in the base class which
simplifies helper functions that deal with states.

There are certain functional changes but all of which should actually be
corrections.

4 years agogn build: Merge 38839d08b8e
LLVM GN Syncbot [Tue, 29 Oct 2019 01:06:42 +0000 (01:06 +0000)]
gn build: Merge 38839d08b8e

4 years agoPR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.
David Blaikie [Tue, 29 Oct 2019 01:03:59 +0000 (18:03 -0700)]
PR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.

4 years agogn build: fix bad merge of 75f72f6b done in 3431f1ba
Nico Weber [Tue, 29 Oct 2019 00:58:53 +0000 (20:58 -0400)]
gn build: fix bad merge of 75f72f6b done in 3431f1ba

4 years ago[msan] Remove more attributes from sanitized functions.
Evgenii Stepanov [Tue, 29 Oct 2019 00:49:57 +0000 (17:49 -0700)]
[msan] Remove more attributes from sanitized functions.

Summary:
MSan instrumentation adds stores and loads even to pure
readonly/writeonly functions. It is removing some of those attributes
from instrumented functions and call targets, but apparently not enough.

Remove writeonly, argmemonly and speculatable in addition to readonly /
readnone.

Reviewers: pcc, vitalybuka

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agogn build: (manually) merge 75f72f6b
Nico Weber [Tue, 29 Oct 2019 00:56:21 +0000 (20:56 -0400)]
gn build: (manually) merge 75f72f6b

4 years ago[clang][clang-scan-deps] Add -fcxx-modules to test for Darwin.
Michael Spencer [Tue, 29 Oct 2019 00:37:25 +0000 (17:37 -0700)]
[clang][clang-scan-deps] Add -fcxx-modules to test for Darwin.

4 years ago[PowerPC] Emit scalar fp min/max instructions
Nemanja Ivanovic [Mon, 28 Oct 2019 23:33:31 +0000 (18:33 -0500)]
[PowerPC] Emit scalar fp min/max instructions

VSX provides floating point minimum and maximum instructions that conform
to IEEE semantics. This legalizes the respective nodes and emits VSX code
for them. Furthermore, on Power9 cores we have xsmaxcdp and xsmincdp
instructions that conform to language semantics for the conditional operator
even in the presence of NaNs.

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

4 years ago[NFC] Fix some indentation disturbed in D67368
Reid Kleckner [Tue, 29 Oct 2019 00:07:58 +0000 (17:07 -0700)]
[NFC] Fix some indentation disturbed in D67368

4 years agoReplace abort with llvm_unreachable.
Joerg Sonnenberger [Tue, 29 Oct 2019 00:08:11 +0000 (01:08 +0100)]
Replace abort with llvm_unreachable.

The former depended on header pollution to be found and doesn't fit the
LLVM style of error handling.

4 years agoRecommit "Add a heap alloc site marker field to the ExtraInfo in MachineInstrs"
Amy Huang [Mon, 28 Oct 2019 21:53:32 +0000 (14:53 -0700)]
Recommit "Add a heap alloc site marker field to the ExtraInfo in MachineInstrs"

Summary:
Fixes some things from original commit at https://reviews.llvm.org/D69136. The main
change is that the heap alloc marker is always stored as ExtraInfo in the machine
instruction instead of in the PointerSumType because it cannot hold more than
4 pointer types.

Add instruction marker to MachineInstr ExtraInfo. This does almost the
same thing as Pre/PostInstrSymbols, except that it doesn't create a label until
printing instructions. This allows for labels to be put around instructions that
are deleted/duplicated somewhere.
Use this marker to track heap alloc site call instructions.

Reviewers: rnk

Subscribers: MatzeB, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb] move package generation from python to cmake
Haibo Huang [Wed, 16 Oct 2019 05:22:53 +0000 (22:22 -0700)]
[lldb] move package generation from python to cmake

Summary: This is the last part. And we can remove the python script.

Subscribers: lldb-commits, mgorny

Tags: #lldb

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

4 years agoModernize TestThreadStepOut.py
Jim Ingham [Mon, 28 Oct 2019 23:15:09 +0000 (16:15 -0700)]
Modernize TestThreadStepOut.py

This test was timing out on the swift CI bots.  I didn't see any obvious reason
for that, and the test hasn't had problems on greendragon.  OTOH, it was a bit
oddly written, and needed modernizing, so I did that.

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

4 years ago[AArch64][GlobalISel] Fix assertion fail in C++ selection for vector zext of <4 x s8>
Amara Emerson [Mon, 28 Oct 2019 00:04:47 +0000 (17:04 -0700)]
[AArch64][GlobalISel] Fix assertion fail in C++ selection for vector zext of <4 x s8>

We bailed out of dealing with vectors only after the assertion, move it before.

Fixes PR43794

4 years ago[debugserver] Detect arch from LLVM_DEFAULT_TARGET_TRIPLE
Vedant Kumar [Mon, 28 Oct 2019 18:35:36 +0000 (11:35 -0700)]
[debugserver] Detect arch from LLVM_DEFAULT_TARGET_TRIPLE

The debugserver build needs to conditionally include files depending on the
target architecture.

Switch on the architecture specified by LLVM_DEFAULT_TARGET_TRIPLE, as
the llvm and swift build systems use this variable to identify the
target (the latter, indirectly, through LLVM_HOST_TRIPLE).

It would be possible to switch on CMAKE_OSX_ARCHITECTURES, but the swift
build does not provide it, preferring instead to pass arch-specific
CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option,
but it breaks down when cross-compiling.

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

4 years ago[Builtins] Teach Clang about memccpy
Dávid Bolvanský [Sun, 27 Oct 2019 14:57:54 +0000 (15:57 +0100)]
[Builtins] Teach Clang about memccpy

Summary: Hopefully, -fno-builtin-memccpy will work now. Required for https://reviews.llvm.org/D67986.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: RKSimon, kristina, cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Do not emit HW loop if the body contains calls to lrint/lround
Nemanja Ivanovic [Mon, 28 Oct 2019 21:08:30 +0000 (16:08 -0500)]
[PowerPC] Do not emit HW loop if the body contains calls to lrint/lround

These two intrinsics are lowered to calls so should prevent the formation of
CTR loops. In a subsequent patch, we will handle all currently known intrinsics
and prevent the formation of HW loops if any unknown intrinsics are encountered.

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

4 years agoRevert "[clang] Add no_builtin attribute"
Vlad Tsyrklevich [Mon, 28 Oct 2019 22:21:38 +0000 (15:21 -0700)]
Revert "[clang] Add no_builtin attribute"

This reverts commit bd87916109483d33455cbf20da2309197b983cdd. It was
causing ASan/MSan failures on the sanitizer buildbots.

4 years ago[scudo][standalone] Lists fix
Kostya Kortchinsky [Mon, 28 Oct 2019 22:06:10 +0000 (15:06 -0700)]
[scudo][standalone] Lists fix

Summary:
Apparently during the review of D69265, and my flailing around with
git, a somewhat important line disappeared.

On top of that, there was no test exercising that code path, and
while writing the follow up patch I intended to write, some `CHECK`s
were failing.

Re-add the missing line, and add a test that fails without said line.

Reviewers: hctim, morehouse, pcc, cferris

Reviewed By: hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[NFCI][XCOFF][AIX] Skip empty Section during object file generation
jasonliu [Mon, 28 Oct 2019 21:46:22 +0000 (21:46 +0000)]
[NFCI][XCOFF][AIX] Skip empty Section during object file generation

This is a fix to D69112 where we common up the logic of writing CsectGroup.
However, we forget to skip the Sections that are empty in that patch.

Reviewed by: daltenty, xingxue

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

4 years ago[Docs] Repurpose 'sources' page as 'contributing'.
Jonas Devlieghere [Mon, 28 Oct 2019 22:01:27 +0000 (15:01 -0700)]
[Docs] Repurpose 'sources' page as 'contributing'.

The page describing how to get the sources was more about contributing
to LLDB than getting the actual source. This patch moves some things
around and repurposes this page as a contributing to LLDB landing page.

4 years agoRevert "[Concepts] Constraint Enforcement & Diagnostics"
Vlad Tsyrklevich [Mon, 28 Oct 2019 21:36:31 +0000 (14:36 -0700)]
Revert "[Concepts] Constraint Enforcement & Diagnostics"

This reverts commit ffa214ef22892d75340dc6720271863901dc2c90, it was
causing ASAN test failures on sanitizer-x86_64-linux-bootstrap.