platform/upstream/llvm.git
4 years agoTemporarily Revert "[libc++] Fix -Wdeprecated-copy warnings in __bit_reference"
Eric Christopher [Thu, 12 Dec 2019 08:22:07 +0000 (00:22 -0800)]
Temporarily Revert "[libc++] Fix -Wdeprecated-copy warnings in __bit_reference"
as it's causing test failures due to mismatched visibility.

This reverts commit 02bb20223bda5add729402962c70d0ebd0d98af2.

4 years ago[DWARF5][DWARFVerifier] Check that Skeleton compilation unit does not have children.
Alexey Lapshin [Tue, 10 Dec 2019 10:00:19 +0000 (13:00 +0300)]
[DWARF5][DWARFVerifier] Check that Skeleton compilation unit does not have children.

  That patch adds checking into DWARFVerifier that the Skeleton
compilation unit does not have children.

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

4 years agoRevert "[ARM][MVE] Sink vector shift operand"
Sam Parker [Thu, 12 Dec 2019 07:52:18 +0000 (07:52 +0000)]
Revert "[ARM][MVE] Sink vector shift operand"

This reverts commit e0b966643fc2030442ffbae9b677247be697673b.

Instruction selection is failing with expensive checks.

4 years ago[libc++] Fix -Wdeprecated-copy warnings in __bit_reference
Eric Christopher [Thu, 12 Dec 2019 07:49:07 +0000 (23:49 -0800)]
[libc++] Fix -Wdeprecated-copy warnings in __bit_reference

Add a couple of default copy constructors to fix the warning.

Reviewed By: dblaikie

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

4 years ago[ARM][MVE] Sink vector shift operand
Sam Parker [Thu, 12 Dec 2019 07:34:49 +0000 (07:34 +0000)]
[ARM][MVE] Sink vector shift operand

The shift amount operand can be provided in a general purpose
register so sink it. Flip the vdup and negate so the existing
patterns can be used for matching.

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

4 years agoFix an error in the block ABI documentation sample code
Akira Hatanaka [Thu, 12 Dec 2019 07:17:49 +0000 (23:17 -0800)]
Fix an error in the block ABI documentation sample code

rdar://problem/38663011

4 years ago[Syntax] Build nodes for simple cases of top level declarations
Ilya Biryukov [Thu, 12 Dec 2019 07:04:21 +0000 (08:04 +0100)]
[Syntax] Build nodes for simple cases of top level declarations

Summary:
More complicated nodes (e.g. template declarations) will be implemented
in the follow-up patches.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

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

4 years ago[OpenMP][Docs] Mark 5.0 features worked on and list 5.1 features
Johannes Doerfert [Thu, 12 Dec 2019 05:59:46 +0000 (23:59 -0600)]
[OpenMP][Docs] Mark 5.0 features worked on and list 5.1 features

4 years ago[AutoFDO] Statistic for context sensitive profile guided inlining
Wenlei He [Fri, 22 Nov 2019 07:59:41 +0000 (23:59 -0800)]
[AutoFDO] Statistic for context sensitive profile guided inlining

Summary: AutoFDO compilation has two places that do inlining - the sample profile loader that does inlining with context sensitive profile, and the regular inliner as CGSCC pass. Ideally we want most inlining to come from sample profile loader as that is driven by context sensitive profile and also retains context sensitivity after inlining. However the reality is most of the inlining actually happens during regular inliner. To track the number of inline instances from sample profile loader and help move more inlining to sample profile loader, I'm adding statistics and optimization remarks for sample profile loader's inlining.

Reviewers: wmi, davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agogn build: (manually) merge 5d986953c8b917bacfaa1f800fc1e242559f76be
Nico Weber [Thu, 12 Dec 2019 03:48:38 +0000 (22:48 -0500)]
gn build: (manually) merge 5d986953c8b917bacfaa1f800fc1e242559f76be

4 years ago[llvm][MIRVRegNamerUtils] Adding hashing on memoperands.
Puyan Lotfi [Wed, 11 Dec 2019 06:39:17 +0000 (01:39 -0500)]
[llvm][MIRVRegNamerUtils] Adding hashing on memoperands.

No more hash collisions for memoperands. Now the MIRCanonicalization
pass shouldn't hit hash collisions when dealing with nearly identical
memory accessing instructions when their memoperands are in fact different.

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

4 years ago[AArch64][SVE] Add patterns for scalable vselect
Cameron McInally [Wed, 11 Dec 2019 23:07:07 +0000 (17:07 -0600)]
[AArch64][SVE] Add patterns for scalable vselect

This patch matches scalable vector selects to predicated move instructions.

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

4 years ago[IR] Split out target specific intrinsic enums into separate headers
Reid Kleckner [Wed, 11 Dec 2019 15:55:26 +0000 (07:55 -0800)]
[IR] Split out target specific intrinsic enums into separate headers

This has two main effects:
- Optimizes debug info size by saving 221.86 MB of obj file size in a
  Windows optimized+debug build of 'all'. This is 3.03% of 7,332.7MB of
  object file size.
- Incremental step towards decoupling target intrinsics.

The enums are still compact, so adding and removing a single
target-specific intrinsic will trigger a rebuild of all of LLVM.
Assigning distinct target id spaces is potential future work.

Part of PR34259

Reviewers: efriedma, echristo, MaskRay

Reviewed By: echristo, MaskRay

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

4 years agoRename TTI::getIntImmCost for instructions and intrinsics
Reid Kleckner [Wed, 11 Dec 2019 19:54:58 +0000 (11:54 -0800)]
Rename TTI::getIntImmCost for instructions and intrinsics

Soon Intrinsic::ID will be a plain integer, so this overload will not be
possible.

Rename both overloads to ensure that downstream targets observe this as
a build failure instead of a runtime failure.

Split off from D71320

Reviewers: efriedma

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

4 years ago[Remarks][Driver] Ask for line tables when remarks are enabled
Francis Visoiu Mistrih [Tue, 10 Dec 2019 23:10:52 +0000 (15:10 -0800)]
[Remarks][Driver] Ask for line tables when remarks are enabled

Serialized remarks contain debug locations for each remark, by storing a
file path, a line, and a column.

Also, remarks support being embedded in a .dSYM bundle using a separate
section in object files, that is found by `dsymutil` through the debug
map.

In order for tools to map addresses to source and display remarks in the
source, we need line tables, and in order for `dsymutil` to find the
object files containing the remark section, we need to keep the debug
map around.

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

4 years agogn build: (manually) merge d23c61490c
Nico Weber [Thu, 12 Dec 2019 01:41:18 +0000 (20:41 -0500)]
gn build: (manually) merge d23c61490c

4 years ago[libc++abi] Fix non-constant initialization of default terminate
Eric Fiselier [Thu, 12 Dec 2019 01:32:14 +0000 (20:32 -0500)]
[libc++abi] Fix non-constant initialization of default terminate
handlers.

4 years ago[libc++] Require C++14 in all cases.
Eric Fiselier [Thu, 12 Dec 2019 01:26:30 +0000 (20:26 -0500)]
[libc++] Require C++14 in all cases.

LLVM has moved to C++14, and the libc++ build should too.
C++14 is needed to provide constant initialization for certain global
objects.

I suspect this change may break some older GCC buildbots, and I'll clean
those up as they fall.

4 years ago[analyzer] Do not cache out on some shared implicit AST nodes
Gabor Horvath [Wed, 11 Dec 2019 19:34:44 +0000 (11:34 -0800)]
[analyzer] Do not cache out on some shared implicit AST nodes

Some AST nodes which stands for implicit initialization is shared. The analyzer
will do the same evaluation on the same nodes resulting in the same state. The
analyzer will "cache out", i.e. it thinks that it visited an already existing
node in the exploded graph. This is not true in this case and we lose coverage.
Since these nodes do not really require any processing from the analyzer
we just omit them from the CFG.

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

4 years ago[AArch64][x86] add tests for possible infinite loops in DAGCombiner; NFC
Sanjay Patel [Thu, 12 Dec 2019 00:38:37 +0000 (19:38 -0500)]
[AArch64][x86] add tests for possible infinite loops in DAGCombiner; NFC

This is a reduction of a test that failed (infinite looped)
with rGd1f0bdf2d2df (subsequently reverted). I've duplicated
it for 2 targets to increase coverage - everything down here
is wobbly.

4 years agoRevert "[clang][clang-scan-deps] Aggregate the full dependency information."
Michael Spencer [Thu, 12 Dec 2019 00:34:31 +0000 (16:34 -0800)]
Revert "[clang][clang-scan-deps] Aggregate the full dependency information."

This reverts commit f978ea498309adaebab8fbf1cd6e520e7e0e11f1.

It broke clang-ppc64be-linux, but not sure why yet.

4 years agoRevert "[DWARF] Allow cross-CU references of subprogram definitions"
Vedant Kumar [Wed, 11 Dec 2019 23:55:48 +0000 (15:55 -0800)]
Revert "[DWARF] Allow cross-CU references of subprogram definitions"

This reverts commit 30038da15b18ac4e34b9ea7a648382ae481e4770. It causes
the stage2 thinLTO bot to fail with:

Assertion failed: (CU.getDIE(CalleeSP) && "Expected declaration subprogram DIE for callee")

rdar://57840415

4 years ago[OpenMP] Use the OpenMP-IR-Builder
Johannes Doerfert [Tue, 5 Nov 2019 05:00:36 +0000 (23:00 -0600)]
[OpenMP] Use the OpenMP-IR-Builder

This is a follow up patch to use the OpenMP-IR-Builder, as discussed on
the mailing list ([1] and later) and at the US Dev Meeting'19.

[1] http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/2019-May/000197.html

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny

Tags: #clang

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

4 years ago[clang][clang-scan-deps] Aggregate the full dependency information.
Michael Spencer [Mon, 28 Oct 2019 21:26:45 +0000 (14:26 -0700)]
[clang][clang-scan-deps] Aggregate the full dependency information.

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

4 years ago[lit] Improve formatting of error messages. NFC
Julian Lettner [Tue, 26 Feb 2019 06:41:52 +0000 (22:41 -0800)]
[lit] Improve formatting of error messages. NFC

4 years ago[lldb/CMake] Simplify linking against curses
Jonas Devlieghere [Wed, 11 Dec 2019 22:27:58 +0000 (14:27 -0800)]
[lldb/CMake] Simplify linking against curses

Centralize the logic to determine what libraries to link against for
curses in the CMake file where it is actually being used. Use
target_include_directories instead of include_directories.

4 years agoSuppress false-positive -Wuninitialized warnings in the constructor of a
Richard Smith [Wed, 11 Dec 2019 22:25:43 +0000 (14:25 -0800)]
Suppress false-positive -Wuninitialized warnings in the constructor of a
templated but non-template class.

4 years agoDon't call export_symbols.py with duplicate libs
David Tenty [Wed, 11 Dec 2019 22:21:54 +0000 (17:21 -0500)]
Don't call export_symbols.py with duplicate libs

Summary:
export_symbols.py discards duplicate symbols, assuming they have public definitions, so if we end
up calling it with duplicate libraries we will end up with an inaccurate export list.

Reviewers: jasonliu, stevewan, john.brawn

Reviewed By: john.brawn

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Host] Use Host/Config.h for LibXML2 instead of a global define
Jonas Devlieghere [Wed, 11 Dec 2019 22:10:38 +0000 (14:10 -0800)]
[lldb/Host] Use Host/Config.h for LibXML2 instead of a global define

Rename LIBXML2_DEFINED to LLDB_ENABLE_LIBXML2 and pass it through
Config.h instead of a global define.

4 years ago[lldb][dotest] Add `#include <algorithm>` to libc++ detection
Jordan Rupprecht [Wed, 11 Dec 2019 22:02:22 +0000 (14:02 -0800)]
[lldb][dotest] Add `#include <algorithm>` to libc++ detection

Summary: Speculative fix after 34ef51b5f979 broke the lldb buildbot on libc++ tests.

Reviewers: echristo, EricWF

Subscribers: ldionne, lldb-commits

Tags: #lldb

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

4 years agoFix detection of __attribute__((may_alias)) to properly look through
Richard Smith [Wed, 11 Dec 2019 22:03:35 +0000 (14:03 -0800)]
Fix detection of __attribute__((may_alias)) to properly look through
type sugar.

We previously missed the attribute in a lot of cases in C++, because
there's often other type sugar there (eg, ElaboratedType).

4 years agoRevert "[SDAG] remove use restriction in isNegatibleForFree() when called from getNeg...
Sanjay Patel [Wed, 11 Dec 2019 21:56:18 +0000 (16:56 -0500)]
Revert "[SDAG] remove use restriction in isNegatibleForFree() when called from getNegatedExpression()"

This reverts commit d1f0bdf2d2df9bdf11ee2ddfff3df50e53f2f042.
The patch can cause infinite loops in DAGCombiner.

4 years ago[lldb][dotest] Improve libc++ detection
Jordan Rupprecht [Wed, 11 Dec 2019 00:48:33 +0000 (16:48 -0800)]
[lldb][dotest] Improve libc++ detection

Summary: The test logic for running libc++ tests only looks to see if `/usr/include/c++/v1` exists. This adds a fallback for including libc++ tests as long as `$(CC) -stdlib=libc++` works.

Reviewers: labath, EricWF

Subscribers: ldionne, lldb-commits

Tags: #lldb

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

4 years ago[libc++] Fix fuzzing tests with older GCC compilers.
Eric Fiselier [Wed, 11 Dec 2019 21:36:21 +0000 (16:36 -0500)]
[libc++] Fix fuzzing tests with older GCC compilers.

GCC 5 doesn't support `if constexpr`, so we need to do old-style tag
dispatching.

4 years agoAdd resurrecting Type Validators to projects.rst
Adrian Prantl [Wed, 11 Dec 2019 21:30:05 +0000 (13:30 -0800)]
Add resurrecting Type Validators to projects.rst

4 years ago[libc++] Fix fuzzing unit tests with exceptions disabled.
Eric Fiselier [Wed, 11 Dec 2019 21:21:23 +0000 (16:21 -0500)]
[libc++] Fix fuzzing unit tests with exceptions disabled.

We simply turn off the parts of the tests that require exceptions.

4 years ago[OPENMP50]Add if clause in teams distribute parallel for simd directive.
Alexey Bataev [Wed, 11 Dec 2019 20:26:38 +0000 (15:26 -0500)]
[OPENMP50]Add if clause in teams distribute parallel for simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years ago[TSan] Pacify flaky test on Darwin
Julian Lettner [Wed, 11 Dec 2019 20:49:19 +0000 (12:49 -0800)]
[TSan] Pacify flaky test on Darwin

This flaky test that I added really gives our CI a lot of headaches.
Although I was never able to reproduce this locally, it sporadically
hangs/fails on our bots.  I decided to silently pass the test whenever
we are unable to setup the proper test condition after 10 retries.  This
is of course suboptimal and a last recourse.  Please let me know if you
know how to test this better.

rdar://57844626

4 years ago[LegalizeTypes] In SoftenFloatRes_FP_EXTEND, move the check for input already being...
Craig Topper [Wed, 11 Dec 2019 20:45:54 +0000 (12:45 -0800)]
[LegalizeTypes] In SoftenFloatRes_FP_EXTEND, move the check for input already being promoted above the check for fp16 converting to something other than fp32.

The fp16 to larger than fp32 inserts an extend that need to
re-legalized if fp16 is promoted. But if we check for fp16
promotion first, then we can avoid emiting the fp_extend all
together.

4 years ago[libc++] Add fuzzing tests for parts of <random>.
Eric Fiselier [Wed, 11 Dec 2019 20:45:48 +0000 (15:45 -0500)]
[libc++] Add fuzzing tests for parts of <random>.

This patch also re-names the existing fuzzing unit tests so they
actually run.

4 years ago[ADT] Fix SmallDenseMap assertion with large InlineBuckets
Nikita Popov [Wed, 11 Dec 2019 20:17:29 +0000 (21:17 +0100)]
[ADT] Fix SmallDenseMap assertion with large InlineBuckets

Fixes issue encountered in D56362, where I tried to use a
SmallSetVector<Instruction*, 128> with an excessively large number
of inline elements. This triggers an "Must allocate more buckets
than are inline" assertion inside allocateBuckets() under certain
usage patterns.

The issue is as follows: The grow() method is used either to grow
the map, or to rehash it and remove tombstones. The latter is done
if the fraction of empty (non-used, non-tombstone) elements is
below 1/8. In this case grow() is invoked with the current number
of buckets.

This is currently incorrectly handled for dense maps using the small
rep. The current implementation will switch them over to the large
rep, which violates the invariant that the large rep is only used
if there are more than InlineBuckets buckets.

This patch fixes the issue by staying in the small rep and only
moving the buckets. An alternative, if we do want to switch to the
large rep in this case, would be to relax the assertion in
allocateBuckets().

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

4 years ago[OpenMP] Introduce the OpenMP-IR-Builder
Johannes Doerfert [Wed, 6 Nov 2019 00:57:44 +0000 (18:57 -0600)]
[OpenMP] Introduce the OpenMP-IR-Builder

This is the initial patch for the OpenMP-IR-Builder, as discussed on the
mailing list ([1] and later) and at the US Dev Meeting'19.

The design is similar to D61953 but:
  - in a non-WIP status, with proper documentation and working.
  - using a OpenMPKinds.def file to manage lists of directives, runtime
    functions, types, ..., similar to the current Clang implementation.
  - restricted to handle only (simple) barriers, to implement most
    `#pragma omp barrier` directives and most implicit barriers.
  - properly hooked into Clang to be used if possible (D69922).
  - compatible with the remaining code generation.

Parts have been extracted into D69853.

The plan is to have multiple people working on moving logic from Clang
here once the initial scaffolding (=this patch) landed.

[1] http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/2019-May/000197.html

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: mgorny, hiraditya, bollu, guansong, jfb, cfe-commits, llvm-commits, penzn, ppenzin

Tags: #clang, #llvm

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

4 years agoreturn-object-by-reference ("non trivial") xfail on arm64 in TestTrivialABI.py
Jason Molenda [Wed, 11 Dec 2019 19:43:35 +0000 (11:43 -0800)]
return-object-by-reference ("non trivial") xfail on arm64 in TestTrivialABI.py

I don't think this test case can be handled correctly on AAPCS64.
The ABI says that the caller passes the address of the return object
in x8.  x8 is a caller-spilled (aka "volatile") register, and the
function is not required to preserve x8 or to copy the address back
into x8 on function exit like the SysV x86_64 ABI does with rax.
(from aapcs64: "there is no requirement for the callee to preserve the
value stored in x8")

From my quick reading of ABISysV_arm64, I worry that it may actually be
using the value in x8 at function exit, assuming it still has the
address of the return object -

    if (is_return_value) {
      // We are assuming we are decoding this immediately after returning from
      // a function call and that the address of the structure is in x8
      reg_info = reg_ctx->GetRegisterInfoByName("x8", 0);

This will work on trivial test programs / examples, but if the function
does another function call, or overwrites x8 as a scratch register, lldb
will provide incorrect values to the user.

ABIMacOSX_arm64 doesn't do this, but it also doesn't flag the value
as unavailable so we're providing incorrect values to the user all
the time.  I expect my fix will be to make ABIMacOSX_arm64 flag
the return value as unretrievable, unless I've misread the ABI.

4 years ago[WebAssembly] Add new `export_name` clang attribute for controlling wasm export names
Sam Clegg [Tue, 5 Nov 2019 18:15:56 +0000 (10:15 -0800)]
[WebAssembly] Add new `export_name` clang attribute for controlling wasm export names

This is equivalent to the existing `import_name` and `import_module`
attributes which control the import names in the final wasm binary
produced by lld.

This maps the existing

This attribute currently requires a string rather than using the
symbol name for a couple of reasons:

1. Avoid confusion with static and dynamic linking which is
   based on symbol name.  Exporting a function from a wasm module using
   this directive is orthogonal to both static and dynamic linking.
2. Avoids name mangling.

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

4 years ago[InstCombine] Optimize overflow check base on uadd.with.overflow result
Nikita Popov [Sun, 3 Nov 2019 09:50:56 +0000 (10:50 +0100)]
[InstCombine] Optimize overflow check base on uadd.with.overflow result

Fix for https://bugs.llvm.org/show_bug.cgi?id=40846.

This adds a combine for cases where a (a + b) < a style overflow
check is performed, but with a + b being the result of
uadd.with.overflow, so the overflow result is also already available
and we can just use it. Subsequently GVN/CSE will deduplicate the extracts.

We can run into this situation if you have both a uadd.with.overflow
and a manual add + overflow check in the same function (on the same
operands), in which case GVN will rewrite the add to the with.overflow
result and leave you with this pattern.

The implementation is a bit ugly because I'm handling the various
canonicalization edge cases.

This does not yet handle the negated version of this pattern.

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

4 years ago[analyzer] Escape symbols conjured into specific regions during a conservative EvalCall
Gabor Horvath [Tue, 10 Dec 2019 00:26:38 +0000 (16:26 -0800)]
[analyzer] Escape symbols conjured into specific regions during a conservative EvalCall

This patch introduced additional PointerEscape callbacks after conservative
calls for output parameters. This should not really affect the current
checkers but the upcoming FuchsiaHandleChecker relies on this heavily.

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

4 years ago[ValueTracking] Pointer is known nonnull after load/store
Danila Kutenin [Wed, 11 Dec 2019 19:30:54 +0000 (20:30 +0100)]
[ValueTracking] Pointer is known nonnull after load/store

If the pointer was loaded/stored before the null check, the check
is redundant and can be removed. For now the optimizers do not
remove the nullptr check, see https://gcc.godbolt.org/z/H2r5GG.
The patch allows to use more nonnull constraints. Also, it found
one more optimization in some PowerPC test. This is my first llvm
review, I am free to any comments.

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

4 years ago[ValueTracking] Add tests for non-null check after load/store; NFC
Danila Kutenin [Wed, 11 Dec 2019 19:24:02 +0000 (20:24 +0100)]
[ValueTracking] Add tests for non-null check after load/store; NFC

Tests for D71177.

4 years ago[analyzer] LocalizationChecker: Fix a crash on synthesized accessor stubs.
Artem Dergachev [Wed, 11 Dec 2019 19:03:38 +0000 (11:03 -0800)]
[analyzer] LocalizationChecker: Fix a crash on synthesized accessor stubs.

The checker was trying to analyze the body of every method in Objective-C
@implementation clause but the sythesized accessor stubs that were introduced
into it by 2073dd2d have no bodies.

4 years ago[analyzer] CStringChecker: Fix overly eager assumption that memcmp args overlap.
Artem Dergachev [Wed, 11 Dec 2019 02:23:39 +0000 (18:23 -0800)]
[analyzer] CStringChecker: Fix overly eager assumption that memcmp args overlap.

While analyzing code `memcmp(a, NULL, n);', where `a' has an unconstrained
symbolic value, the analyzer was emitting a warning about the *first* argument
being a null pointer, even though we'd rather have it warn about the *second*
argument.

This happens because CStringChecker first checks whether the two argument
buffers are in fact the same buffer, in order to take the fast path.
This boils down to assuming `a == NULL' to true. Then the subsequent check
for null pointer argument "discovers" that `a' is null.

Don't take the fast path unless we are *sure* that the buffers are the same.
Otherwise proceed as normal.

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

4 years ago[analyzer] CStringChecker: Improve warning messages.
Artem Dergachev [Wed, 11 Dec 2019 00:48:17 +0000 (16:48 -0800)]
[analyzer] CStringChecker: Improve warning messages.

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

4 years ago[MergeFuncs] Remove incorrect attribute copying
Nikita Popov [Sun, 8 Dec 2019 11:13:52 +0000 (12:13 +0100)]
[MergeFuncs] Remove incorrect attribute copying

Fix for https://bugs.llvm.org/show_bug.cgi?id=44236. This code was
originally introduced in rG36512330041201e10f5429361bbd79b1afac1ea1.
However, the attribute copying was done in the wrong place (in general
call replacement, not thunk generation) and a proper fix was
implemented in D12581.

Previously this code was just unnecessary but harmless (because
FunctionComparator ensured that the attributes of the two functions
are exactly the same), but since byval was changed to accept a type
this copying is actively wrong and may result in malformed IR.

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

4 years agoFix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D65958 and D70450
Fangrui Song [Wed, 11 Dec 2019 18:59:45 +0000 (10:59 -0800)]
Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D65958 and D70450

4 years agoAdd intrinsics for unary narrowing operations
Andrzej Warzynski [Tue, 10 Dec 2019 14:32:34 +0000 (14:32 +0000)]
Add intrinsics for unary narrowing operations

Summary:
The following intrinsics for unary narrowing operations are added:
 * @llvm.aarch64.sve.sqxtnb
 * @llvm.aarch64.sve.uqxtnb
 * @llvm.aarch64.sve.sqxtunb
 * @llvm.aarch64.sve.sqxtnt
 * @llvm.aarch64.sve.uqxtnt
 * @llvm.aarch64.sve.sqxtunt

Reviewers: sdesmalen, rengolin, efriedma

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[VFS] Disable check for ../foo on Windows
Jonas Devlieghere [Wed, 11 Dec 2019 18:52:37 +0000 (10:52 -0800)]
[VFS] Disable check for ../foo on Windows

I'm not sure how .. is resolved on Windows. Disable it for now to make
the bots happy again.

4 years ago[AArch64] Be more careful to skip debug operands in LdSt Optimizier.
Florian Hahn [Wed, 11 Dec 2019 17:17:29 +0000 (17:17 +0000)]
[AArch64] Be more careful to skip debug operands in LdSt Optimizier.

This fixes crashes with $noreg operands.

4 years ago[StringRef] Test all default characters in unit test
Jonas Devlieghere [Wed, 11 Dec 2019 18:43:31 +0000 (10:43 -0800)]
[StringRef] Test all default characters in unit test

The default characters for trim, ltrim and rtrim are " \t\n\v\f\r" but
only spaces were tested. Test that the others are trimmed as well.

4 years ago[SDAG] remove use restriction in isNegatibleForFree() when called from getNegatedExpr...
Sanjay Patel [Wed, 11 Dec 2019 16:18:09 +0000 (11:18 -0500)]
[SDAG] remove use restriction in isNegatibleForFree() when called from getNegatedExpression()

This is an alternate fix for the bug discussed in D70595.
This also includes minimal tests for other in-tree targets
to show the problem more generally.

We check the number of uses as a predicate for whether some
value is free to negate, but that use count can change as we
rewrite the expression in getNegatedExpression(). So something
that was marked free to negate during the cost evaluation
phase becomes not free to negate during the rewrite phase (or
the inverse - something that was not free becomes free).
This can lead to a crash/assert because we expect that
everything in an expression that is negatible to be handled
in the corresponding code within getNegatedExpression().

This patch skips the use check during the rewrite phase.
So we determine that some expression isNegatibleForFree
(identically to without this patch), but during the rewrite,
don't rely on use counts to decide how to create the optimal
expression.

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

4 years ago[OPENMP50]Fix capturing of if condition in target parallel for simd
Alexey Bataev [Wed, 11 Dec 2019 17:59:01 +0000 (12:59 -0500)]
[OPENMP50]Fix capturing of if condition in target parallel for simd
directive.

Fixed capturing of the if condition if no modifer was specified in this
condition. Previously could capture it only in outer region and it could
lead to a compiler crash.

4 years ago[profile] Avoid allocating a page on the stack, NFC
Vedant Kumar [Wed, 11 Dec 2019 02:17:28 +0000 (18:17 -0800)]
[profile] Avoid allocating a page on the stack, NFC

When writing out a profile, avoid allocating a page on the stack for the
purpose of writing out zeroes, as some embedded environments do not have
enough stack space to accomodate this.

Instead, use a small, fixed-size zero buffer that can be written
repeatedly.

For a synthetic file with >100,000 functions, I did not measure a
significant difference in profile write times. We are removing a
page-length zero-fill `memset()` in favor of several smaller buffered
`fwrite()` calls: in practice, I am not sure there is much of a
difference. The performance impact is only expected to affect the
continuous sync mode (%c) -- zero padding is less than 8 bytes in all
other cases.

rdar://57810014

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

4 years ago[profile] Delete stale profiles in test/profile/instrprof-value-prof.test, NFC
Vedant Kumar [Wed, 11 Dec 2019 02:16:59 +0000 (18:16 -0800)]
[profile] Delete stale profiles in test/profile/instrprof-value-prof.test, NFC

4 years ago[profile] Delete stale profile in test/profile/instrprof-set-filename.c, NFC
Vedant Kumar [Tue, 10 Dec 2019 23:47:31 +0000 (15:47 -0800)]
[profile] Delete stale profile in test/profile/instrprof-set-filename.c, NFC

4 years ago[VFS] Extend virtual working directory test
Jonas Devlieghere [Wed, 11 Dec 2019 17:50:00 +0000 (09:50 -0800)]
[VFS] Extend virtual working directory test

Extend the virtual working directory test with a few edge cases that are
not currently tested.

4 years ago[OPENMP50]Add if clause in teams distribute simd directive.
Alexey Bataev [Wed, 11 Dec 2019 16:20:47 +0000 (11:20 -0500)]
[OPENMP50]Add if clause in teams distribute simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years agoRemove TypeValidators (NFC in terms of the testsuite)
Adrian Prantl [Tue, 10 Dec 2019 23:32:57 +0000 (15:32 -0800)]
Remove TypeValidators (NFC in terms of the testsuite)

This is a half-implemented feature that as far as we can tell was
never used by anything since its original inclusion in 2014. This
patch removes it to make remaining the code easier to understand.

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

4 years ago[ELF][AArch64] Rename --force-bti to -z force-bti and --pac-plt to -z pac-plt
Fangrui Song [Wed, 11 Dec 2019 06:07:17 +0000 (22:07 -0800)]
[ELF][AArch64] Rename --force-bti to -z force-bti and --pac-plt to -z pac-plt

Summary:
The original design used --foo but the upstream complained that ELF only
options should be -z foo. See https://sourceware.org/ml/binutils/2019-04/msg00151.html
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=8bf6d176b0a442a8091d338d4af971591d19922c
made the rename.

Our --force-bti and --pac-plt implement the same functionality, so it
seems wise to be consistent with GNU ld.

Reviewed By: peter.smith

Subscribers: emaste, arichardson, kristof.beyls, llvm-commits

Tags: #llvm

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

4 years agoupdate TestThreadStepOut.py to expect correct source line on arm64.
Jason Molenda [Wed, 11 Dec 2019 17:14:52 +0000 (09:14 -0800)]
update TestThreadStepOut.py to expect correct source line on arm64.

4 years ago[DA] Improve dump to show source and sink of the dependence
Bardia Mahjour [Wed, 11 Dec 2019 16:48:16 +0000 (11:48 -0500)]
[DA] Improve dump to show source and sink of the dependence

Summary:
The current da printer shows the dependence without indicating
which instructions are being considered as the src vs dst. It
also silently ignores call instructions, despite the fact that
they create confused dependence edges to other memory
instructions. This patch addresses these two issues plus a
couple of minor non-functional improvements.

Authored By: bmahjour

Reviewer: dmgreen, fhahn, philip.pfaffe, chandlerc

Reviewed By: dmgreen, fhahn

Tags: #llvm

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

4 years agoDon't run expect based tests remotely.
Jason Molenda [Wed, 11 Dec 2019 16:29:18 +0000 (08:29 -0800)]
Don't run expect based tests remotely.

4 years ago[AArch64] Skip debug ops with regsOverlap in AArch64 LD/ST opt.
Florian Hahn [Wed, 11 Dec 2019 16:24:38 +0000 (16:24 +0000)]
[AArch64] Skip debug ops with regsOverlap in AArch64 LD/ST opt.

This fixes a crash when debug instructions are in between 2 stores.

4 years ago[SystemZ] Add llvm.minimum / llvm.maximum tests
Ulrich Weigand [Wed, 11 Dec 2019 15:59:54 +0000 (16:59 +0100)]
[SystemZ] Add llvm.minimum / llvm.maximum tests

The backend already supports the @llvm.minimum and @llvm.maximum
intrinsics, but we had no test cases for those.  Add tests.

4 years ago[X86] Erase dead LEA instruction after converting it to MOV in FixupLEAPass::processI...
Craig Topper [Wed, 11 Dec 2019 15:51:02 +0000 (07:51 -0800)]
[X86] Erase dead LEA instruction after converting it to MOV in FixupLEAPass::processInstrForSlow3OpLEA.

4 years ago[TableGen] Remove unused target intrinsic generation logic
Reid Kleckner [Wed, 11 Dec 2019 15:37:16 +0000 (07:37 -0800)]
[TableGen] Remove unused target intrinsic generation logic

AMDGPU was the last in tree target to use this tablegen mode. I plan to
split up the global intrinsic enum similar to the way that clang
diagnostics are split up today. I don't plan to build on this mode.

Reviewers: arsenm, echristo, efriedma

Reviewed By: echristo

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

4 years ago[SystemZ] Fix 128-bit strict FMA expansion pre-z14
Ulrich Weigand [Wed, 11 Dec 2019 15:28:14 +0000 (16:28 +0100)]
[SystemZ] Fix 128-bit strict FMA expansion pre-z14

Before z14, we did not have any FMA instruction for 128-bit
floating-point, so the @llvm.fma.f128 intrinsic needs to be
expanded to a libcall on those platforms.

This worked correctly for regular FMA, but was implemented
incorrectly for the strict version.  This was not noticed
because we did not have test coverage for this case.

This patch fixes that incorrect expansion and adds the
missing test cases.

4 years ago[Loop] Add isRotated method to Loop class.
Kit Barton [Tue, 3 Dec 2019 19:20:08 +0000 (14:20 -0500)]
[Loop] Add isRotated method to Loop class.

Summary:
This patch adds a method to determine if a loop is in rotated form (the latch is
an exiting block). It also modifies the getLoopGuardBranch method to use this
new method. This method can also be used in Loopfusion. Once this patch lands I
will make the corresponding changes there.

Reviewers: jdoerfert, Meinersbur, dmgreen, etiotto, Whitney, fhahn, hfinkel

Reviewed By: Meinersbur

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Support] Add TimeTraceScope constructor without detail arg
Russell Gallop [Wed, 11 Dec 2019 11:49:42 +0000 (11:49 +0000)]
[Support] Add TimeTraceScope constructor without detail arg

This simplifies code where no extra details are required
Also don't write out detail when it is empty.

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

4 years ago[ARM][NFC] Change test to use CHECK-NEXT
Diogo Sampaio [Wed, 11 Dec 2019 14:24:40 +0000 (14:24 +0000)]
[ARM][NFC] Change test to use CHECK-NEXT

4 years agoVerifier: Check frame-pointer attribute values
Matt Arsenault [Tue, 10 Dec 2019 11:12:48 +0000 (16:42 +0530)]
Verifier: Check frame-pointer attribute values

There are a few places that check specific string attributes have
particular values, and assert if they are something else. The verifier
should catch these kinds of cases.

4 years ago[Analyzer] Iterator Checkers: Replace `UnknownVal` in comparison result by a conjured...
Adam Balogh [Fri, 8 Nov 2019 11:52:09 +0000 (12:52 +0100)]
[Analyzer] Iterator Checkers: Replace `UnknownVal` in comparison result by a conjured value

Sometimes the return value of a comparison operator call is
`UnkownVal`. Since no assumptions can be made on `UnknownVal`,
this leeds to keeping impossible execution paths in the
exploded graph resulting in poor performance and false
positives. To overcome this we replace unknown results of
iterator comparisons by conjured symbols.

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

4 years agoAMDGPU: Fix copy-pasted test name error
Matt Arsenault [Tue, 10 Dec 2019 16:21:51 +0000 (21:51 +0530)]
AMDGPU: Fix copy-pasted test name error

4 years ago[LLD][ELF][AArch64][ARM] When errata patching, round thunk size to 4KiB.
Peter Smith [Tue, 10 Dec 2019 08:29:23 +0000 (08:29 +0000)]
[LLD][ELF][AArch64][ARM] When errata patching, round thunk size to 4KiB.

On some edge cases such as Chromium compiled with full instrumentation we
have a .text section over twice the size of the maximum branch range and
the instrumented code generation containing many examples of the erratum
sequence. The combination of Thunks and many erratum sequences causes
finalizeAddressDependentContent() to not converge. We end up with:
start
- Thunk Creation (disturbs addresses after thunks, creating more patches)
- Patch Creation (disturbs addresses after patches, creating more thunks)
- goto start

In most images with few thunks and patches the mutual disturbance does not
cause convergence problems. As the .text size and number of patches go up
the risk increases.

A way to prevent the thunk creation from interfering with patch creation is
to round up the size of the thunks to a 4KiB boundary when the
erratum patch is enabled. As the erratum sequence only triggers when an
instruction sequence starts at 0xff8 or 0xffc modulo (4 KiB) by making the
thunks not affect addresses modulo (4 KiB) we prevent thunks from
interfering with the patch.

The patches themselves could be aggregated in the same way that Thunks are
within ThunkSections and we could round up the size in the same way. This
would reduce the number of patches created in a .text section size >
128 MiB but would not likely help convergence problems.

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

fixes (remaining part of) pr44071, other part in D71242

4 years ago[LLD][ELF][AArch64][ARM] Add missing classof to patch sections.
Peter Smith [Mon, 9 Dec 2019 11:07:54 +0000 (11:07 +0000)]
[LLD][ELF][AArch64][ARM] Add missing classof to patch sections.

The code to insert patch section merges them with a comparison function that
uses logic of the form:
return (isa<PatchSection>(a) && !isa<PatchSection>(b));
If the PatchSections don't implement classof this check fails if b is also
a SyntheticSection. This can result in the patches being out of range if
the SyntheticSection is big, for example a ThunkSection with lots of thunks.

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

fixes (part of) pr44071

4 years ago[lldb] Don't search the metadata map three times when retrieving metadata
Raphael Isemann [Wed, 11 Dec 2019 13:50:34 +0000 (14:50 +0100)]
[lldb] Don't search the metadata map three times when retrieving metadata

HasMetadata checks if our metadata map knows the given object. GetMetadata
also does this check and then does another search to actually retrieve
the value. This can all just be one lookup.

4 years agoRevert "[AArch64][SVE] Implement intrinsics for non-temporal loads & stores"
Kerry McLaughlin [Wed, 11 Dec 2019 13:48:10 +0000 (13:48 +0000)]
Revert "[AArch64][SVE] Implement intrinsics for non-temporal loads & stores"

This reverts commit 3f5bf35f868d1e33cd02a5825d33ed4675be8cb1 as it was
causing build failures in llvm-clang-x86_64-expensive-checks:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/392
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/1045

4 years ago[AArch64] Teach Load/Store optimizier to rename store operands for pairing.
Florian Hahn [Wed, 11 Dec 2019 09:59:18 +0000 (09:59 +0000)]
[AArch64] Teach Load/Store optimizier to rename store operands for pairing.

In some cases, we can rename a store operand, in order to enable pairing
of stores.  For store pairs, that cannot be merged because the first
tored register is defined in between the second store, we try to find
suitable rename register.

First, we check if we can rename the given register:

1. The first store register must be killed at the store, which means we
   do not have to rename instructions after the first store.
2. We scan backwards from the first store, to find the definition of the
   stored register and check all uses in between are renamable. Along
   they way, we collect the minimal register classes of the uses for
   overlapping (sub/super)registers.

Second, we try to find an available register from the minimal physical
register class of the original register. A suitable register must not be

1. defined before FirstMI
2. between the previous definition of the register to rename
3. a callee saved register.

We use KILL flags to clear defined registers while scanning from the
beginning to the end of the block.

This triggers quite often, here are the top changes for MultiSource,
SPEC2000, SPEC2006 compiled with -O3 for iOS:

Metric: aarch64-ldst-opt.NumPairCreated

Program                                        base     patch    diff
 test-suite...nch/fourinarow/fourinarow.test     2.00    39.00   1850.0%
 test-suite...s/ASC_Sequoia/IRSmk/IRSmk.test    46.00    80.00   73.9%
 test-suite...chmarks/Olden/power/power.test    70.00    96.00   37.1%
 test-suite...cations/hexxagon/hexxagon.test    29.00    39.00   34.5%
 test-suite...nchmarks/McCat/05-eks/eks.test   100.00   132.00   32.0%
 test-suite.../Trimaran/enc-rc4/enc-rc4.test    46.00    59.00   28.3%
 test-suite...T2006/473.astar/473.astar.test   160.00   200.00   25.0%
 test-suite.../Trimaran/enc-md5/enc-md5.test     8.00    10.00   25.0%
 test-suite...telecomm-gsm/telecomm-gsm.test   113.00   139.00   23.0%
 test-suite...ediabench/gsm/toast/toast.test   113.00   139.00   23.0%
 test-suite...Source/Benchmarks/sim/sim.test    91.00   111.00   22.0%
 test-suite...C/CFP2000/179.art/179.art.test    41.00    49.00   19.5%
 test-suite...peg2/mpeg2dec/mpeg2decode.test   245.00   279.00   13.9%
 test-suite...marks/Olden/health/health.test    16.00    18.00   12.5%
 test-suite...ks/Prolangs-C/cdecl/cdecl.test    90.00   101.00   12.2%
 test-suite...fice-ispell/office-ispell.test    91.00   100.00    9.9%
 test-suite...oxyApps-C/miniGMG/miniGMG.test   430.00   465.00    8.1%
 test-suite...lowfish/security-blowfish.test    39.00    42.00    7.7%
 test-suite.../Applications/spiff/spiff.test    42.00    45.00    7.1%
 test-suite...arks/mafft/pairlocalalign.test   2473.00  2646.00   7.0%
 test-suite.../VersaBench/ecbdes/ecbdes.test    29.00    31.00    6.9%
 test-suite...nch/beamformer/beamformer.test   220.00   235.00    6.8%
 test-suite...CFP2000/177.mesa/177.mesa.test   2110.00  2252.00   6.7%
 test-suite...ve-susan/automotive-susan.test   109.00   116.00    6.4%
 test-suite...s-C/unix-smail/unix-smail.test    65.00    69.00    6.2%
 test-suite...CI_Purple/SMG2000/smg2000.test   1194.00  1265.00   5.9%
 test-suite.../Benchmarks/nbench/nbench.test   472.00   500.00    5.9%
 test-suite...oxyApps-C/miniAMR/miniAMR.test   248.00   262.00    5.6%
 test-suite...quoia/CrystalMk/CrystalMk.test    18.00    19.00    5.6%
 test-suite...rks/tramp3d-v4/tramp3d-v4.test   7331.00  7710.00   5.2%
 test-suite.../Benchmarks/Bullet/bullet.test   5651.00  5938.00   5.1%
 test-suite...ternal/HMMER/hmmcalibrate.test   750.00   788.00    5.1%
 test-suite...T2006/456.hmmer/456.hmmer.test   764.00   802.00    5.0%
 test-suite...ications/JM/ldecod/ldecod.test   1028.00  1079.00   5.0%
 test-suite...CFP2006/444.namd/444.namd.test   1368.00  1434.00   4.8%
 test-suite...marks/7zip/7zip-benchmark.test   4471.00  4685.00   4.8%
 test-suite...6/464.h264ref/464.h264ref.test   3122.00  3271.00   4.8%
 test-suite...pplications/oggenc/oggenc.test   1497.00  1565.00   4.5%
 test-suite...T2000/300.twolf/300.twolf.test   742.00   774.00    4.3%
 test-suite.../Prolangs-C/loader/loader.test    24.00    25.00    4.2%
 test-suite...0.perlbench/400.perlbench.test   1983.00  2058.00   3.8%
 test-suite...ications/JM/lencod/lencod.test   4612.00  4785.00   3.8%
 test-suite...yApps-C++/PENNANT/PENNANT.test   995.00   1032.00   3.7%
 test-suite...arks/VersaBench/dbms/dbms.test    54.00    56.00    3.7%

Reviewers: efriedma, thegameg, samparker, dmgreen, paquette, evandro

Reviewed By: paquette

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

4 years agoRemoving an unused selection field from a diagnostic; NFC.
Aaron Ballman [Wed, 11 Dec 2019 13:48:17 +0000 (08:48 -0500)]
Removing an unused selection field from a diagnostic; NFC.

4 years ago[test][llvm-dwarfdump] Add missing testing for some --debug-* options
James Henderson [Wed, 11 Dec 2019 13:41:00 +0000 (13:41 +0000)]
[test][llvm-dwarfdump] Add missing testing for some --debug-* options

A number of the --debug-* options in llvm-dwarfdump are not particularly
well tested. In some cases, the option is only tested as part of testing
another feature, or a specific part of the section that the options
dump. This change adds four new tests to address some of these holes. It
is not aiming to address every hole however.

I kept the --debug-line switch test separate to X86/brief.s because the
latter only considers the parts of the line table that are affected by
verbose printing, thus missing out things like the header and different
values for things like the Line, Column etc registers.

Reviewed by: JDevlieghere

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

4 years ago[Alignment][NFC] Introduce Align in IRBuilder
Guillaume Chatelet [Wed, 11 Dec 2019 11:18:59 +0000 (12:18 +0100)]
[Alignment][NFC] Introduce Align in IRBuilder

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[DebugInfo] Fix printing of DW_LNS_set_isa
James Henderson [Wed, 11 Dec 2019 12:14:11 +0000 (12:14 +0000)]
[DebugInfo] Fix printing of DW_LNS_set_isa

The Isa register is a uint8_t, but at least on Windows this is
internally an unsigned char, which meant that prior to this patch it got
formatted as an ASCII character, rather than a decimal number. This
patch fixes this by casting it to a uint64_t before printing. I did it
this way instead of using a uint8_t formatter because a) it is simpler,
and b) it allows us to change the internal type of Isa in the future
without this code breaking.

I also took the opportunity to test the printing of the other standard
opcodes.

Reviewed by: probinson

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

4 years ago[lldb][NFC] Remove dead metadata code in ClangASTSourceProxy
Raphael Isemann [Wed, 11 Dec 2019 13:17:39 +0000 (14:17 +0100)]
[lldb][NFC] Remove dead metadata code in ClangASTSourceProxy

4 years agoRollback assumeAligned in MemorySanitizer
Guillaume Chatelet [Wed, 11 Dec 2019 10:00:32 +0000 (11:00 +0100)]
Rollback assumeAligned in MemorySanitizer

Summary: Rollback of parts of D71213. After digging more into the code I think we should leave 0 when creating the instructions (CreateMemcpy, CreateMaskedStore, CreateMaskedLoad). It's probably fine for MemorySanitizer because Alignement is resolved but I'm having a hard time convincing myself it has no impact at all (although tests are passing).

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Analyzer] Iterator Modeling: Print Container Data and Iterator Positions when printi...
Adam Balogh [Mon, 2 Dec 2019 18:37:37 +0000 (19:37 +0100)]
[Analyzer] Iterator Modeling: Print Container Data and Iterator Positions when printing the Program State

Debugging the Iterator Modeling checker or any of the iterator checkers
is difficult without being able to see the relations between the
iterator variables and their abstract positions, as well as the abstract
symbols denoting the begin and the end of the container.

This patch adds the checker-specific part of the Program State printing
to the Iterator Modeling checker.

4 years ago[lldb][NFC] Remove ClangExternalASTSourceCommon::g_TotalSizeOfMetadata
Raphael Isemann [Wed, 11 Dec 2019 12:53:39 +0000 (13:53 +0100)]
[lldb][NFC] Remove ClangExternalASTSourceCommon::g_TotalSizeOfMetadata

Turns out this counter is doing literally nothing beside counting.

4 years ago[AArch64][SVE] Add DAG combine rules for gather loads and sext/zext
Andrzej Warzynski [Mon, 25 Nov 2019 13:54:47 +0000 (13:54 +0000)]
[AArch64][SVE] Add DAG combine rules for gather loads and sext/zext

Summary:
These changes allow us to support sign-extending gather loads with the
exisiting intrinsics (i.e. @llvm.aarch64.sve.ld1.gather.*).

Reviewers: sdesmalen, huntergr, kmclaughlin, efriedma, rengolin, rovka, dancgr, mgudim

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[SYCL] Add support for auxiliary triple specification to Frontend
Alexey Bader [Tue, 10 Dec 2019 13:52:58 +0000 (16:52 +0300)]
[SYCL] Add support for auxiliary triple specification to Frontend

Summary:
Add host predefined macros to compilation for SYCL device, which is
required for pre-processing host specific includes (e.g. system
headers).

Reviewers: ABataev, jdoerfert

Subscribers: ebevhan, Anastasia, cfe-commits, keryell, Naghasan, Fznamznon

Tags: #clang

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

Signed-off-by: Alexey Bader <alexey.bader@intel.com>
4 years agoCodeGen: Allow annotations on globals in non-zero address space
Nicolai Hähnle [Wed, 5 Jun 2019 19:35:30 +0000 (21:35 +0200)]
CodeGen: Allow annotations on globals in non-zero address space

Summary:
Attribute annotations are recorded in a special global composite variable
that points to annotation strings and the annotated objects.

As a restriction of the LLVM IR type system, those pointers are all
pointers to address space 0, so let's insert an addrspacecast when the
annotated global is in a non-0 address space.

Since this addrspacecast is only reachable from the global annotations
object, this should allow us to represent annotations on all globals
regardless of which addrspacecasts are usually legal for the target.

Reviewers: rjmccall

Subscribers: cfe-commits

Tags: #clang

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

4 years agogn build: Merge afb13afcf22
LLVM GN Syncbot [Wed, 11 Dec 2019 12:07:57 +0000 (12:07 +0000)]
gn build: Merge afb13afcf22

4 years ago[ARM][MVE] Factor out an IntrinsicMX multiclass.
Simon Tatham [Wed, 11 Dec 2019 12:07:16 +0000 (12:07 +0000)]
[ARM][MVE] Factor out an IntrinsicMX multiclass.

Summary:
The ACLE intrinsics for MVE contain a lot of pairs of functions with
`_m` and `_x` in the name, wrapping a predicated MVE instruction which
only partially overwrites its output register. They have the common
pattern that the `_m` variant takes an initial argument called
'inactive', of the same type as the return value, supplying the input
value of the output register, so that lanes disabled by the
predication will be taken from that parameter; the `_x` variant omits
that initial argument, and simply sets it to undef.

That common pattern is simple enough to wrap into a multiclass, which
should save a lot of effort in setting up all the rest of the `_x`
variants. In this commit I introduce `multiclass IntrinsicMX` in
`arm_mve_defs.td`, and convert existing generation of m/x pairs to use
it.

This allows me to remove the `PredicatedImmediateVectorShift`
multiclass (from D71065) completely, because the new multiclass makes
it so much simpler that it's not worth bothering to define it at all.

Reviewers: MarkMurrayARM, miyuki

Reviewed By: MarkMurrayARM, miyuki

Subscribers: kristof.beyls, dmgreen, cfe-commits

Tags: #clang

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

4 years ago[llvm-readobj][llvm-readelf] - Remove excessive empty lines when reporting errors...
Georgii Rymar [Tue, 10 Dec 2019 10:37:00 +0000 (13:37 +0300)]
[llvm-readobj][llvm-readelf] - Remove excessive empty lines when reporting errors and warnings.

After recent changes it is now seems possible to get rid of
printing '\n' before each error and warning. This makes the output
cleaner.

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

4 years agoRevert "Reland [AArch64][MachineOutliner] Return address signing for outlined functions"
Oliver Stannard [Wed, 11 Dec 2019 12:03:12 +0000 (12:03 +0000)]
Revert "Reland [AArch64][MachineOutliner] Return address signing for outlined functions"

This reverts commit cec2d5c17457722113580251c8a045fa9aca9b1b.

Reverting because this is still creating outlined functions with return
address signing instructions with mismatches SP values. For example:

  int *volatile v;

  void foo(int x) {
    int a[x];
    v = &a[0];
    v = &a[0];
    v = &a[0];
    v = &a[0];
    v = &a[0];
    v = &a[0];
  }

  void bar(int x) {
    int a[x];
    v = 0;
    v = &a[0];
    v = &a[0];
    v = &a[0];
    v = &a[0];
    v = &a[0];
  }

This generates these two outlined functions, both of which modify SP
between the paciasp and retaa instructions:

  $ clang --target=aarch64-arm-none-eabi -march=armv8.3-a -c test2.c -o - -S -Oz -mbranch-protection=pac-ret+leaf
  ...
  OUTLINED_FUNCTION_0:                    // @OUTLINED_FUNCTION_0
          .cfi_sections .debug_frame
          .cfi_startproc
  // %bb.0:
          paciasp
          .cfi_negate_ra_state
          mov     w8, w0
          lsl     x8, x8, #2
          add     x8, x8, #15             // =15
          mov     x9, sp
          and     x8, x8, #0x7fffffff0
          sub     x8, x9, x8
          mov     x29, sp
          mov     sp, x8
          adrp    x9, v
          retaa
  ...
  OUTLINED_FUNCTION_1:                    // @OUTLINED_FUNCTION_1
          .cfi_startproc
  // %bb.0:
          paciasp
          .cfi_negate_ra_state
          str     x8, [x9, :lo12:v]
          str     x8, [x9, :lo12:v]
          str     x8, [x9, :lo12:v]
          str     x8, [x9, :lo12:v]
          str     x8, [x9, :lo12:v]
          mov     sp, x29
          retaa