Commit Graph

314504 Commits

Author SHA1 Message Date
Thomas Anderson 6ab51de08e [libc++] Make __debug_less::operator() constexpr
This is a followup to [1] which added a new `__debug_less::operator()` overload.
[2] added `_LIBCPP_CONSTEXPR_AFTER_CXX17` to the original
`__debug_less::operator()` between the time of writing [1] and landing it.  This
change adds `_LIBCPP_CONSTEXPR_AFTER_CXX17` to the new overload too.

[1] https://reviews.llvm.org/rL358423
[2] https://reviews.llvm.org/rL358252

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

llvm-svn: 358725
2019-04-19 00:52:54 +00:00
Ali Tamur 5377748d54 Add header guard to Reusables.h [NFC]
llvm-svn: 358724
2019-04-19 00:42:54 +00:00
Alina Sbirlea da0f71af7d [LoopUnroll] Move list of params into a struct [NFCI].
Summary: Cleanup suggested in review of r358304.

Reviewers: sanjoy, efriedma

Subscribers: jlebar, zzheng, dmgreen, llvm-commits

Tags: #llvm

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

llvm-svn: 358723
2019-04-18 23:43:49 +00:00
Artem Dergachev 9b02a9b401 [analyzer] Make default bindings to variables actually work.
Default RegionStore bindings represent values that can be obtained by loading
from anywhere within the region, not just the specific offset within the region
that they are said to be bound to. For example, default-binding a character \0
to an int (eg., via memset()) means that the whole int is 0, not just
that its lower byte is 0.

Even though memset and bzero were modeled this way, it didn't work correctly
when applied to simple variables. Eg., in

  int x;
  memset(x, 0, sizeof(x));

we did produce a default binding, but were unable to read it later, and 'x'
was perceived as an uninitialized variable even after memset.

At the same time, if we replace 'x' with a variable of a structure or array
type, accessing fields or elements of such variable was working correctly,
which was enough for most cases. So this was only a problem for variables of
simple integer/enumeration/floating-point/pointer types.

Fix loading default bindings from RegionStore for regions of simple variables.

Add a unit test to document the API contract as well.

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

llvm-svn: 358722
2019-04-18 23:35:56 +00:00
Davide Italiano 185de8eeaa [Python] Simplify the code. NFCI.
llvm-svn: 358721
2019-04-18 23:24:54 +00:00
Artem Dergachev 7cc87be4bb [analyzer] NFC: Make reusable unittest mocks reusable.
Put them in a header for other Analyzer unittests to include.

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

llvm-svn: 358720
2019-04-18 23:24:50 +00:00
Artem Dergachev 6b71e27c94 [analyzer] NFC: MoveChecker: Refactor tests to use -verify=prefix.
This -verify=prefix feature is quite underrated.

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

llvm-svn: 358719
2019-04-18 23:17:58 +00:00
Sanjay Patel 5d281ac9ce [AArch64] add tests for mul-by-element; NFC
llvm-svn: 358718
2019-04-18 21:48:46 +00:00
Davide Italiano 085626a873 [crashlog] Strip trailing `\n` from check_output return.
Generally having spurious `\n` doesn't matter, but here the
returning string is a command which is executed, so  we want
to strip it. Pointed out by Jason.

llvm-svn: 358717
2019-04-18 21:32:36 +00:00
Adrian Prantl fac7875704 Implement sys::fs::copy_file using the macOS copyfile(3) API
to support APFS clones.

This patch adds a Darwin-specific implementation of
llvm::sys::fs::copy_file() that uses the macOS copyfile(3) API to
support APFS copy-on-write clones, which should be faster and much
more space efficient.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/ToolsandAPIs/ToolsandAPIs.html

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

This reapplies 358628 with an additional bugfix handling the case
where the destination file already exists. (Caught by the clang testsuite).

llvm-svn: 358716
2019-04-18 21:22:50 +00:00
Jessica Paquette 0aa9b453c4 [GlobalISel][AArch64] Legalize/select G_(S/Z/ANY)_EXT for v8s8s
This adds legalization for G_SEXT, G_ZEXT, and G_ANYEXT for v8s8s.

We were falling back on G_ZEXT in arm64-vabs.ll before, preventing us from
selecting the @llvm.aarch64.neon.sabd.v8i8 intrinsic.

This adds legalizer support for those 3, which gives us selection via the
importer. Update the relevant tests (legalize-ext.mir, select-int-ext.mir) and
add a GISel line to arm64-vabs.ll.

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

llvm-svn: 358715
2019-04-18 21:15:48 +00:00
Jessica Paquette 3b5119c684 [GlobalISel][AArch64] Legalize v8s8 loads
Add legalizer support for loads of v8s8 and update legalize-load-store.mir.

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

llvm-svn: 358714
2019-04-18 21:13:58 +00:00
Richard Smith a5bbbfef15 [c++2a] Add semantic support for private module fragments.
llvm-svn: 358713
2019-04-18 21:12:54 +00:00
Louis Dionne 4664916017 [libc++] Link against libc++abi in the libc++abi tests
PR27405

llvm-svn: 358712
2019-04-18 20:59:49 +00:00
Gheorghe-Teodor Bercea e94e0eb0c4 [OpenMP][NFC] Fix requires target test.
Summary:
Fix requires target test.


Reviewers: ABataev

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358711
2019-04-18 20:34:43 +00:00
Owen Pan fb73b79a14 [clang-format] Fix incorrect formatting of keyword macro definition
See PR39719

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

llvm-svn: 358710
2019-04-18 20:17:08 +00:00
Gheorghe-Teodor Bercea 411a62403f [OpenMP] Add checks for requires and target directives.
Summary: The requires directive containing target related clauses must appear before any target region in the compilation unit.

Reviewers: ABataev, AlexEichenberger, caomhin

Reviewed By: ABataev

Subscribers: guansong, jfb, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358709
2019-04-18 19:53:43 +00:00
Nico Weber a0ac65c98f llvm-undname: Fix two more asserts-on-invalid, found by oss-fuzz
llvm-svn: 358708
2019-04-18 19:52:32 +00:00
Nico Weber 502cf4bd19 llvm-undname: Fix two asserts-on-invalid
llvm-svn: 358707
2019-04-18 19:30:21 +00:00
Yi Kong 815a4c902d [builtins] Build x86_64 with GENERIC_TF_SOURCES
llvm-svn: 358706
2019-04-18 19:29:03 +00:00
Yitzhak Mandelbaum f1f0b5f791 [LibTooling] Fix build breakage from commit 7b7ce6683ee.
On configurations with -Werror,-Wmissing-field-initializers, the commit does not compile. This commit fixes the offending line.

Original Differential Revision: https://reviews.llvm.org/D60408

llvm-svn: 358705
2019-04-18 19:19:01 +00:00
Philip Reames 137995d8da [GuardWidening] Wire up a NPM version of the LoopGuardWidening pass
llvm-svn: 358704
2019-04-18 19:17:14 +00:00
Jonathan Metzman 139e216e66 Summary:
Add close_fd_mask functionality to AFL driver.

Summary:
Add support for env var AFL_DRIVER_CLOSE_FD_MASK which behaves
the same as libFuzzer's -close_fd_mask=1.

Also add tests.

Reviewers: kcc, vitalybuka, morehouse

Reviewed By: morehouse

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 358703
2019-04-18 18:49:11 +00:00
Michael Berg d573aa0156 [NFC] FMF propagation for GlobalIsel
llvm-svn: 358702
2019-04-18 18:48:57 +00:00
Quentin Colombet ea3364bf85 [BlockExtractor] Extend the file format to support the grouping of basic blocks
Prior to this patch, each basic block listed in the extrack-blocks-file
would be extracted to a different function.

This patch adds the support for comma separated list of basic blocks
to form group.

When the region formed by a group is not extractable, e.g., not single
entry, all the blocks of that group are left untouched.

Let us see this new format in action (comments are not part of the
file format):
;; funcName bbName[,bbName...]
   foo      bb1        ;; Extract bb1 in its own function
   foo      bb2,bb3    ;; Extract bb2,bb3 in their own function
   bar      bb1,bb4    ;; Extract bb1,bb4 in their own function
   bar      bb2        ;; Extract bb2 in its own function

Assuming all regions are extractable, this will create one function and
thus one call per region.

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

llvm-svn: 358701
2019-04-18 18:28:30 +00:00
Louis Dionne dcf4b9aee0 [pstl] Add a serial backend for the PSTL
Summary:
The serial backend performs all tasks serially and does not require
threads. It does not have any dependencies beyond normal C++, but
it is not very efficient either.

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 358700
2019-04-18 18:20:19 +00:00
Roland Froese a5dd08cac2 [PowerPC] Add some PPC vec cost tests to prep for D60160 NFC
llvm-svn: 358699
2019-04-18 18:12:09 +00:00
Billy Robert O'Neal III bd7db5ac95 [libc++] [test] Add missing required headers to midpoint.integer.pass.cpp
This change authored by Paolo Torres <t-pator@microsoft.com>

llvm-svn: 358698
2019-04-18 18:02:14 +00:00
Yitzhak Mandelbaum fa1552e8c9 [LibTooling] Extend Transformer to support multiple simultaneous changes.
Summary: This revision allows users to specify independent changes to multiple (related) sections of the input.  Previously, only a single section of input could be selected for replacement.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: jfb, cfe-commits

Tags: #clang

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

llvm-svn: 358697
2019-04-18 17:52:24 +00:00
Sam McCall 3a75330f57 [CodeComplete] Remove obsolete isOutputBinary().
Summary:
It's never set to true. Its only effect would be to set stdout to binary mode.
Hopefully we have better ways of doing this by now :-)

Reviewers: hokein

Subscribers: jkorous, arphaman, kadircet, llvm-commits

Tags: #llvm

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

llvm-svn: 358696
2019-04-18 17:35:55 +00:00
Kristof Umann 640f7b5875 [analyzer][NFC] Prefer binary searches in CheckerRegistry
Differential Revision: https://reviews.llvm.org/D59459

llvm-svn: 358695
2019-04-18 17:34:45 +00:00
Kristof Umann a57d4ea33f [analyzer][NFC] Clang-format CheckerRegistry
Differential Revision: https://reviews.llvm.org/D59458

llvm-svn: 358694
2019-04-18 17:32:51 +00:00
Jonas Devlieghere f2293a95de [Docs] Add LLDB bots
llvm-svn: 358693
2019-04-18 17:31:20 +00:00
Simon Pilgrim 4171a91e92 [X86] combineVectorTruncationWithPACKUS - remove split/concatenation of mask
combineVectorTruncationWithPACKUS is currently splitting the upper bit bit masking into 128-bit subregs and then concatenating them back together.

This was originally done to avoid regressions that caused existing subregs to be concatenated to the larger type just for the AND masking before being extracted again. This was fixed by @spatel (notably rL303997 and rL347356).

This also lets SimplifyDemandedBits do some further improvements before it hits the recursive depth limit.

My only annoyance with this is that we were broadcasting some xmm masks but we seem to have lost them by moving to ymm - but that's a known issue as the logic in lowerBuildVectorAsBroadcast isn't great.

Differential Revision: https://reviews.llvm.org/D60375#inline-539623

llvm-svn: 358692
2019-04-18 17:23:09 +00:00
Yitzhak Mandelbaum e955f8bac4 [LibTooling] Add Stencil library for format-string style codegen.
Summary:
This file defines the *Stencil* abstraction: a code-generating object, parameterized by named references to (bound) AST nodes.  Given a match result, a stencil can be evaluated to a string of source code.

A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to nodes (the parameters) and helper code-generation operations.

See thread on cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling" for background.

Reviewers: sbenza

Reviewed By: sbenza

Subscribers: ilya-biryukov, mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358691
2019-04-18 17:23:01 +00:00
Louis Dionne 549048f390 [libc++] Make sure we re-export some missing libc++abi symbols from libc++
Summary:
Ensure we re-export __cxa_throw_bad_array_new_length and
__cxa_uncaught_exceptions from libc++, since they are now
provided by libc++abi.

Doing this allows us to stop linking explicitly against libc++abi in
the libc++abi tests, since libc++ re-exports all the necessary symbols.
However, there is one caveat to that. We don't want libc++ to re-export
__cxa_uncaught_exception (the singular form), since it's only provided
for backwards compatibility. Hence, for the single test where we check
this backwards compatibility, we explicitly link against libc++abi.

PR27405
PR22654

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358690
2019-04-18 17:18:15 +00:00
Krasimir Georgiev bda8482aba [clang-format] Fix indent of trailing raw string param after newline
Summary:
Currently clang-format uses ContinuationIndent to indent the contents of a raw
string literal that is the last parameter of the function call. This is to
achieve formatting similar to trailing:
```
f(1, 2, R"pb(
    x: y)pb");
```
However this had the unfortunate consequence of producing format like this:
```
fffffff(1, 2,
        R"pb(
    a: b
        )pb");
```

This patch makes clang-format consider indenting a trailing raw string param
after a newline based off the start of the format delimiter, producing:
```
fffffff(1, 2,
        R"pb(
          a: b
        )pb");
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 358689
2019-04-18 17:14:05 +00:00
Philip Reames adf288c5d9 [LoopPred] Fix a blatantly obvious bug in r358684
The bug is that I didn't check whether the operand of the invariant_loads were themselves invariant.  I don't know how this got missed in the patch and review.  I even had an unreduced test case locally, and I remember handling this case, but I must have lost it in one of the rebases.  Oops.

llvm-svn: 358688
2019-04-18 17:01:19 +00:00
Sanjay Patel 51fa60bcbb [x86] add tests for improved insertelement to index 0 (PR41512); NFC
Patch proposal in D60852.

llvm-svn: 358687
2019-04-18 16:58:50 +00:00
Stefan Granitz 31d0ce005c [CMake] Emit LLDB.framework.dSYM to avoid potential name collision with driver's lldb.dSYM
Summary:
Emit framework's dSYM bundle as LLDB.framework.dSYM instead of LLDB.dSYM, because the latter could conflict with the driver's lldb.dSYM when emitted in the same directory on case-insensitive file systems.
Requires https://reviews.llvm.org/D60862

Reviewers: friss, beanz, bogner

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 358686
2019-04-18 16:37:22 +00:00
Stefan Granitz ab58268fda [CMake] Allow custom extensions for externalized debug info
Summary:
Extra flexibility for emitting debug info to external files (remains Darwin only for now).
LLDB needs this functionality to emit a LLDB.framework.dSYM instead of LLDB.dSYM when building the framework, because the latter could conflict with the driver's lldb.dSYM when emitted in the same directory on case-insensitive file systems.

Reviewers: friss, bogner, beanz

Subscribers: mgorny, aprantl, llvm-commits, #lldb

Tags: #llvm

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

llvm-svn: 358685
2019-04-18 16:37:07 +00:00
Philip Reames 92a7177e6b [LoopPredication] Allow predication of loop invariant computations (within the loop)
The purpose of this patch is to eliminate a pass ordering dependence between LoopPredication and LICM. To understand the purpose, consider the following snippet of code inside some loop 'L' with IV 'i'
A = _a.length;
guard (i < A)
a = _a[i]
B = _b.length;
guard (i < B);
b = _b[i];
...
Z = _z.length;
guard (i < Z)
z = _z[i]
accum += a + b + ... + z;

Today, we need LICM to hoist the length loads, LoopPredication to make the guards loop invariant, and TrivialUnswitch to eliminate the loop invariant guard to establish must execute for the next length load. Today, if we can't prove speculation safety, we'd have to iterate these three passes 26 times to reduce this example down to the minimal form.

Using the fact that the array lengths are known to be invariant, we can short circuit this iteration. By forming the loop invariant form of all the guards at once, we remove the need for LoopPredication from the iterative cycle. At the moment, we'd still have to iterate LICM and TrivialUnswitch; we'll leave that part for later.

As a secondary benefit, this allows LoopPred to expose peeling oppurtunities in a much more obvious manner.  See the udiv test changes as an example.  If the udiv was not hoistable (i.e. we couldn't prove speculation safety) this would be an example where peeling becomes obviously profitable whereas it wasn't before.

A couple of subtleties in the implementation:
- SCEV's isSafeToExpand guarantees speculation safety (i.e. let's us expand at a new point).  It is not a precondition for expansion if we know the SCEV corresponds to a Value which dominates the requested expansion point.
- SCEV's isLoopInvariant returns true for expressions which compute the same value across all iterations executed, regardless of where the original Value is located.  (i.e. it can be in the loop)  This implies we have a speculation burden to prove before expanding them outside loops.
- invariant_loads and AA->pointsToConstantMemory are two cases that SCEV currently does not handle, but meets the SCEV definition of invariance.  I plan to sink this part into SCEV once this has baked for a bit.

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

llvm-svn: 358684
2019-04-18 16:33:17 +00:00
Pavel Labath eba97426d4 Clean up docstrings in swig interface files
Summary:
This patch removes the "//----" frames and "///" leading lines from
docstring comments.  We already have code doing transformations like this in
modify-python-lldb.py, but that's a script I'd like to remove. Instead
of running these transformations everytime we run swig, we can just
perform equivalent on its input once.

This patch can be reproduced (e.g. for downstream merges) with the
following "sweet" perl command:

  perl -i -p -e 'BEGIN{ $/ = undef;} s:(" *\n) *//-----*\n:\1:gs; s:^(     *)/// ?:\1:gsm; s:^ *//------*\n( *\n)?( *"):\2:gsm; s: *$::gsm; s:\n *"\):"):gsm' scripts/interface/*.i

This command produces nearly equivalent python files to those produced
by the relevant code in modify-python-lldb.py. The only difference I
noticed is that here I am slightly more agressive in removing trailing
newlines from docstring comments (the python script seems to leave
newlines in class-level docstrings).

Reviewers: amccarth, clayborg, jingham, aprantl

Subscribers: lldb-commits

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

llvm-svn: 358683
2019-04-18 16:23:33 +00:00
Dan Liew 16c3883b98 [asan_symbolize] Workaround bug in old Python 2 versions.
The change landed in r358657 broke some of the buildbots because they
use an older version of Python 2 that raises this error.

```
File "/Volumes/data/dev/llvm/upstream/master/src/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py", line 509
  exec(f.read(), globals_space, None)
SyntaxError: unqualified exec is not allowed in function 'load_plugin_from_file' it contains a nested function with free variables
```

I can reproduce this problem when using Python 2.7.6.

To workaround this some indirection has been added to prevent the broken
(the line at fault would never be executed) SyntaxError error in old
Python versions from being raised.

rdar://problem/49476995

llvm-svn: 358682
2019-04-18 16:22:55 +00:00
Nicolai Haehnle 523f90a2ba [SDA] Bug fix: Use IPD outside the loop as divergence bound
Summary:
The immediate post dominator of the loop header may be part of the divergent loop.
Since this /was/ the divergence propagation bound the SDA would not detect joins of divergent paths outside the loop.

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: mmasten, arsenm, jvesely, llvm-commits

Tags: #llvm

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

llvm-svn: 358681
2019-04-18 16:17:35 +00:00
Philip Reames b2c9fc02d5 Fix a bug in SCEV's isSafeToExpand around speculation safety
isSafeToExpand was making a common, but dangerously wrong, mistake in assuming that if any instruction within a basic block executes, that all instructions within that block must execute.  This can be trivially shown to be false by considering the following small example:
bb:
  add x, y  <-- InsertionPoint
  call @throws()
  udiv x, y <-- SCEV* S
  br ...

It's clearly not legal to expand S above the throwing call, but the previous logic would do so since S dominates (but not properlyDominates) the block containing the InsertionPoint.

Since iterating instructions w/in a block is expensive, this change special cases two cases: 1) S is an operand of InsertionPoint, and 2) InsertionPoint is the terminator of it's block.  These two together are enough to keep all current optimizations triggering while fixing the latent correctness issue.

As best I can tell, this is a silent bug in current ToT.  Given that, there's no tests with this change.  It was noticed in an upcoming optimization change (D60093), and was reviewed as part of that.  That change will include the test which caused me to notice the issue.  I'm submitting this seperately so that anyone bisecting a problem gets a clear explanation.

llvm-svn: 358680
2019-04-18 16:10:21 +00:00
Bruno Ricci 9f1a40c24f [Sema][NFC] Mark DR1563 as done (List-initialization and overloaded function disambiguation)
It has been supported since at least clang 3.1 so just mark it as done.

llvm-svn: 358679
2019-04-18 15:45:08 +00:00
Bruno Ricci 0e37bebaee [Sema][NFC] Mark DR705 (Suppressing argument-dependent lookup via parentheses) as done
It was supported since at least clang 3 so just mark it as done.

llvm-svn: 358678
2019-04-18 15:34:03 +00:00
Louis Dionne ebaf1d5e2b [libc++] Unconditionally enable the __pad_and_output optimization
This used to be guarded on whether the deployment target was greater
than macosx10.8, however testing against the dylibs for 10.8 and earlier
with the function enabled works too. The revision that introduced
__pad_and_output is r164241 and it does not mention a reason for the
guard.

llvm-svn: 358677
2019-04-18 15:19:35 +00:00
Kristof Umann b9bc7ec304 [analyzer][NFC] Use capital variable names, move methods out-of-line, rename some in CheckerRegistry
There are barely any lines I haven't changed in these files, so I think I could
might as well leave it in an LLVM coding style conforming state. I also renamed
2 functions and moved addDependency out of line to ease on followup patches.

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

llvm-svn: 358676
2019-04-18 15:19:16 +00:00