platform/upstream/llvm.git
5 years ago[pstl] Remove some warnings when compiling with a recent Clang
Louis Dionne [Fri, 15 Feb 2019 17:30:35 +0000 (17:30 +0000)]
[pstl] Remove some warnings when compiling with a recent Clang

There were multiple warnings for lambda captures that are unused, so
I removed those captures. I also fixed a couple of -Wsign-compare
warnings. Note that some warnings still remain, this change is not
exhaustive.

llvm-svn: 354148

5 years agoVariable auto-init of blocks capturing self after init bugfix
JF Bastien [Fri, 15 Feb 2019 17:26:29 +0000 (17:26 +0000)]
Variable auto-init of blocks capturing self after init bugfix

Summary:
Blocks that capture themselves (and escape) after initialization currently codegen wrong because this:

  bool capturedByInit =
      Init && emission.IsEscapingByRef && isCapturedBy(D, Init);

  Address Loc =
      capturedByInit ? emission.Addr : emission.getObjectAddress(*this);

Already adjusts Loc from thr alloca to a GEP. This code:

    if (emission.IsEscapingByRef)
      Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false);

Was trying to do the same adjustment, and a GEP on a GEP (returning an int) triggers an assertion.

<rdar://problem/47943027>

Reviewers: ahatanak

Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall

Tags: #clang

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

llvm-svn: 354147

5 years ago[Tests] Demonstrate more missing atomicrmw transforms
Philip Reames [Fri, 15 Feb 2019 17:11:30 +0000 (17:11 +0000)]
[Tests] Demonstrate more missing atomicrmw transforms

llvm-svn: 354146

5 years agoFix potential UB when target_file directory is null
Stefan Granitz [Fri, 15 Feb 2019 16:42:29 +0000 (16:42 +0000)]
Fix potential UB when target_file directory is null

Summary: As seen in a crash report, the C-string returned for the directory component of `target_file` can null. It should not be assigned to `std::string` directly as this is undefined behavior.

Reviewers: jingham

Reviewed By: jingham

Subscribers: jdoerfert, lldb-commits, #lldb

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

llvm-svn: 354145

5 years ago[InstCombine] fix crash while trying to narrow a binop of shuffles (PR40734)
Sanjay Patel [Fri, 15 Feb 2019 16:31:55 +0000 (16:31 +0000)]
[InstCombine] fix crash while trying to narrow a binop of shuffles (PR40734)

https://bugs.llvm.org/show_bug.cgi?id=40734

llvm-svn: 354144

5 years ago[compiler-rt] Let CMake search for thread support
Jonas Hahnfeld [Fri, 15 Feb 2019 16:27:52 +0000 (16:27 +0000)]
[compiler-rt] Let CMake search for thread support

This is an educated guess to fix sanitizer-x86_64-linux after r354132.

llvm-svn: 354143

5 years agoRevert r354137 - OptionalStorage implementation for trivial type, take III
Serge Guelton [Fri, 15 Feb 2019 16:12:46 +0000 (16:12 +0000)]
Revert r354137 - OptionalStorage implementation for trivial type, take III

This still fails on some random platform, and I fail to reproduce the issue.

llvm-svn: 354142

5 years ago[clang] Add build and install targets for clang libraries
Shoaib Meenai [Fri, 15 Feb 2019 15:59:04 +0000 (15:59 +0000)]
[clang] Add build and install targets for clang libraries

This is modeled after the existing llvm-libraries target. It's a
convenient way to include all clang libraries in a distribution.

This differs slightly from the llvm-libraries target in that it adds any
library added via add_clang_library, whereas llvm-libraries only
includes targets added via add_llvm_library that didn't use the MODULE
or BUILDTREE_ONLY arguments. add_clang_library doesn't appear to have
any equivalents of those arguments, so the conditions don't apply.

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

llvm-svn: 354141

5 years ago[clang] Create install targets for non-shared libraries
Shoaib Meenai [Fri, 15 Feb 2019 15:59:02 +0000 (15:59 +0000)]
[clang] Create install targets for non-shared libraries

I don't see a reason for these to not have install targets created,
which in turn allows them to be bundled in distributions. This doesn't
affect the "install" target, since that just runs all CMake install
rules (and we were already creating install rules for these).

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

llvm-svn: 354140

5 years agoGlobalISel: Fix inadequate verification of g_build_vector
Matt Arsenault [Fri, 15 Feb 2019 15:24:34 +0000 (15:24 +0000)]
GlobalISel: Fix inadequate verification of g_build_vector

Testing based on the total size of the elements failed to catch a few
invalid scenarios, so explicitly check the number of elements/operands
and types.

This failed to catch situations like
<4 x s16> = G_BUILD_VECTOR s32, s32 since the total size added
up. This also would fail to catch an implicit conversion between
pointers and scalars.

llvm-svn: 354139

5 years agoTry to organize MachineVerifier tests
Matt Arsenault [Fri, 15 Feb 2019 15:24:31 +0000 (15:24 +0000)]
Try to organize MachineVerifier tests

The Verifier is separate from the MachineVerifier, so move it to a
different directory. Some other verifier tests were scattered in
target codegen tests as well (although I'm sure I missed some). Work
towards using a more consistent naming scheme to make it clearer where
the gaps still are for generic instructions.

llvm-svn: 354138

5 years agoOptionalStorage implementation for trivial type, take III
Serge Guelton [Fri, 15 Feb 2019 15:17:29 +0000 (15:17 +0000)]
OptionalStorage implementation for trivial type, take III

This is another attempt at implementating optional storage
for trivially copyable type, using an union instead of a
raw buffer to hold the actual storage. This make it possible
to get rid of the reinterpret_cast, and hopefully to fix the UB
of the previous attempts.

This validates fine on my laptop for gcc 8.2 and gcc 4.8, I'll
revert if it breaks the validation.

llvm-svn: 354137

5 years agoExteded test of .
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:10 +0000 (14:43 +0000)]
Exteded test of .

llvm-svn: 354136

5 years agoRemove unnecessary expectation.
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:08 +0000 (14:43 +0000)]
Remove unnecessary expectation.

llvm-svn: 354135

5 years agoAdded test for matcher On.
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:06 +0000 (14:43 +0000)]
Added test for matcher On.

llvm-svn: 354134

5 years agoAdd tests for assorted `CXXMemberCallExpr` matchers.
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:03 +0000 (14:43 +0000)]
Add tests for assorted `CXXMemberCallExpr` matchers.

Summary: Add tests for matchers `on`, `onImplicitObjectArgument` and `hasObjectExpression`.

Reviewers: alexfh, steveire, aaron.ballman

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

llvm-svn: 354133

5 years ago[compiler-rt] Cleanup usage of C++ ABI library
Jonas Hahnfeld [Fri, 15 Feb 2019 14:30:18 +0000 (14:30 +0000)]
[compiler-rt] Cleanup usage of C++ ABI library

Add missed value "libcxxabi" and introduce SANITIZER_TEST_CXX for linking
unit tests. This needs to be a full C++ library and cannot be libcxxabi.

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

llvm-svn: 354132

5 years ago[MergeICmps] Make base ordering really deterministic.
Clement Courbet [Fri, 15 Feb 2019 14:17:17 +0000 (14:17 +0000)]
[MergeICmps] Make base ordering really deterministic.

Summary:
The idea is that we now manipulate bases through a `unsigned BaseID` based on
order of appearance in the comparison chain rather than through the `Value*`.

Fixes 40714.

Reviewers: gchatelet

Subscribers: mgrang, jfb, jdoerfert, llvm-commits, hans

Tags: #llvm

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

llvm-svn: 354131

5 years ago[MergeICmps][NFC] Improve doc.
Clement Courbet [Fri, 15 Feb 2019 12:58:06 +0000 (12:58 +0000)]
[MergeICmps][NFC] Improve doc.

llvm-svn: 354128

5 years ago[Analyzer] Fix for test file of bug 40625
Adam Balogh [Fri, 15 Feb 2019 12:33:42 +0000 (12:33 +0000)]
[Analyzer] Fix for test file of bug 40625

Test fixed and changed to true positive, FIXME about false positive removed.

llvm-svn: 354127

5 years agoSpeculatively revert r354051 "Recommit Optional specialization for trivially copyable...
Hans Wennborg [Fri, 15 Feb 2019 12:20:33 +0000 (12:20 +0000)]
Speculatively revert r354051 "Recommit Optional specialization for trivially copyable types"
and
r354055 "Optional specialization for trivially copyable types, part2"

These are suspected to cause Clang to get miscompiled on Ubuntu 14.04
(Trusty) which uses GCC 4.8.4. Reverting for an hour to see if this
helps. See llvm-commits thread.

> Recommit Optional specialization for trivially copyable types
>
> Unfortunately the original code gets misscompiled by GCC (at least 8.1),
> this is a tentative workaround using std::memcpy instead of inplace new
> for trivially copyable types. I'll revert if it breaks.
>
> Original revision: https://reviews.llvm.org/D57097

llvm-svn: 354126

5 years agoRemove alignment from struct XSAVE altogether
Pavel Labath [Fri, 15 Feb 2019 12:20:23 +0000 (12:20 +0000)]
Remove alignment from struct XSAVE altogether

I reduced the alignment of this struct in r342029 to avoid compiler
warnings about under-aligned allocations, but it turns out that this
still causes problems with some compilers (see r353778). As I hinted in
r342029, I don't believe any special aligment is necessary here (the
only reason for that would be if we used some aligned SSE instructions to
access this buffer, but I don't see any reason why we should do that),
so here I go all the way, and remove the alignment requirements (except
the ones naturally imposed by basic types) altogether.

llvm-svn: 354125

5 years ago[NFCI] Factor out block removal from stack of nested loops
Max Kazantsev [Fri, 15 Feb 2019 12:18:10 +0000 (12:18 +0000)]
[NFCI] Factor out block removal from stack of nested loops

llvm-svn: 354124

5 years agoFix "field 'DFS' will be initialized after field 'DTU'" warning. NFCI.
Simon Pilgrim [Fri, 15 Feb 2019 12:13:16 +0000 (12:13 +0000)]
Fix "field 'DFS' will be initialized after field 'DTU'" warning. NFCI.

llvm-svn: 354123

5 years ago[lldb] [MainLoop] Add kevent() EINTR handling
Michal Gorny [Fri, 15 Feb 2019 12:13:02 +0000 (12:13 +0000)]
[lldb] [MainLoop] Add kevent() EINTR handling

Add missing EINTR handling for kevent() calls.  If the call is
interrupted, return from Poll() as if zero events were returned and let
the polling resume on next iteration.  This fixes test flakiness
on NetBSD.

Includes a test case suggested by Pavel Labath on D42206.

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

llvm-svn: 354122

5 years ago[OpenCL][PR40707] Allow OpenCL C types in C++ mode.
Anastasia Stulova [Fri, 15 Feb 2019 12:07:57 +0000 (12:07 +0000)]
[OpenCL][PR40707] Allow OpenCL C types in C++ mode.

Allow all OpenCL types to be parsed in C++ mode.

llvm-svn: 354121

5 years ago[ASTImporter] Import every Decl in lambda record
Gabor Marton [Fri, 15 Feb 2019 12:04:05 +0000 (12:04 +0000)]
[ASTImporter] Import every Decl in lambda record

Summary:
Previously only the fields were imported. Now every Decl is imported.
This way the destructor decl is not missing after import.

Patch by balazske (Balázs Kéri)

Reviewers: a.sidorin, shafik

Reviewed By: shafik

Subscribers: balazske, cfe-commits, Szelethus, martong, dkrupp

Tags: #clang

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

llvm-svn: 354120

5 years ago[BPI] Look through bitcasts in calcZeroHeuristic
Sam Parker [Fri, 15 Feb 2019 11:50:21 +0000 (11:50 +0000)]
[BPI] Look through bitcasts in calcZeroHeuristic

Constant hoisting may have hidden a constant behind a bitcast so that
it isn't folded into its users. However, this prevents BPI from
calculating some of its heuristics that are based upon constant
values. So, I've added a simple helper function to look through these
casts.

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

llvm-svn: 354119

5 years ago[NFC] Promote DFS to field for further use
Max Kazantsev [Fri, 15 Feb 2019 11:39:35 +0000 (11:39 +0000)]
[NFC] Promote DFS to field for further use

llvm-svn: 354118

5 years ago[X86][AVX] lowerShuffleAsLanePermuteAndPermute - fully populate the lane shuffle...
Simon Pilgrim [Fri, 15 Feb 2019 11:39:21 +0000 (11:39 +0000)]
[X86][AVX] lowerShuffleAsLanePermuteAndPermute - fully populate the lane shuffle mask (PR40730)

As detailed on PR40730, we are not correctly filling in the lane shuffle mask (D53148/rL344446) - we fill in for the correct src lane but don't add it to the correct mask element, so any reference to the correct element is likely to see an UNDEF mask index.

This allows constant folding to propagate UNDEFs prior to the lane mask being (correctly) lowered to vperm2f128.

This patch fixes the issue by fully populating the lane shuffle mask - this is more than is necessary (if we only filled in the required mask elements we might be able to match other shuffle instructions - broadcasts etc.), but its the most cautious approach as this needs to be cherrypicked into the 8.0.0 release branch.

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

llvm-svn: 354117

5 years ago[clangd] Unlink VFS working dir from OS working dir. Reland of r351051
Sam McCall [Fri, 15 Feb 2019 11:04:25 +0000 (11:04 +0000)]
[clangd] Unlink VFS working dir from OS working dir. Reland of r351051

llvm-svn: 354116

5 years ago[ARM GlobalISel] Style fix. NFCI
Diana Picus [Fri, 15 Feb 2019 10:50:02 +0000 (10:50 +0000)]
[ARM GlobalISel] Style fix. NFCI

Add the opcode for ADDrr / t2ADDrr to the Opcode cache, as we did for
all other opcodes where the handling is otherwise the same between arm
mode and thumb2.

llvm-svn: 354115

5 years agoFix the gdb-client test suite for python3
Pavel Labath [Fri, 15 Feb 2019 10:47:34 +0000 (10:47 +0000)]
Fix the gdb-client test suite for python3

This applies the same fix that was done in r354106 to the lldb-server
test: bitcasting the string to a bytes object before sending it over a
socket. Since the gdb-remote protocol occasionally contains binary data,
and it does not assign any particular encoding to them, this is the
right thing to do here.

llvm-svn: 354114

5 years ago[ARM GlobalISel] Support branches for Thumb2
Diana Picus [Fri, 15 Feb 2019 10:24:03 +0000 (10:24 +0000)]
[ARM GlobalISel] Support branches for Thumb2

Just like arm mode, but with different opcodes.

llvm-svn: 354113

5 years agoSort files in source/Host/CMakeLists.txt
Pavel Labath [Fri, 15 Feb 2019 10:06:21 +0000 (10:06 +0000)]
Sort files in source/Host/CMakeLists.txt

llvm-svn: 354112

5 years ago[RISCV] Add assembler support for LA pseudo-instruction
Alex Bradbury [Fri, 15 Feb 2019 09:53:32 +0000 (09:53 +0000)]
[RISCV] Add assembler support for LA pseudo-instruction

This patch also introduces the emitAuipcInstPair helper, which is then used
for both emitLoadAddress and emitLoadLocalAddress.

Differential Revision: https://reviews.llvm.org/D55325
Patch by James Clarke.

llvm-svn: 354111

5 years ago[RISCV] Support assembling %got_pcrel_hi operator
Alex Bradbury [Fri, 15 Feb 2019 09:43:46 +0000 (09:43 +0000)]
[RISCV] Support assembling %got_pcrel_hi operator

Differential Revision: https://reviews.llvm.org/D55279
Patch by James Clarke.

llvm-svn: 354110

5 years agoRevert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach...
Sam McCall [Fri, 15 Feb 2019 09:18:49 +0000 (09:18 +0000)]
Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop"

This reverts commit r354102.

llvm-svn: 354109

5 years ago[ARM CGP] Fix ConvertTruncs
Sam Parker [Fri, 15 Feb 2019 09:04:39 +0000 (09:04 +0000)]
[ARM CGP] Fix ConvertTruncs

ConvertTruncs is used to replace a trunc for an AND mask, however
this function wasn't working as expected. By performing the change
later, we can create a wide type integer mask instead of a narrow -1
value, which could then be simply removed (incorrectly). Because we
now perform this action later, it's necessary to cache the trunc type
before we perform the promotion.

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

llvm-svn: 354108

5 years ago[NFC] Tweak SplitBlockAndInsertIfThen to use existing ThenBlock
Max Kazantsev [Fri, 15 Feb 2019 08:18:00 +0000 (08:18 +0000)]
[NFC] Tweak SplitBlockAndInsertIfThen to use existing ThenBlock

llvm-svn: 354107

5 years agoFix lldb-server test suite for python3
Pavel Labath [Fri, 15 Feb 2019 07:47:06 +0000 (07:47 +0000)]
Fix lldb-server test suite for python3

Summary:
This patch finishes the python3-ification of the lldb-server test suite.
It reverts the partial attempt in r352709 to encode/decode the string
via utf8 before writing to the socket. This wasn't enough because the
gdb-remote protocol can sometimes (but not very often) carry binary
data, and the utf8 codec chokes on that. Instead I add utility functions
to the "seven" module for performing "identity" transformations on the
byte data. This basically drills back the hole in the python type system
that the string/bytes distinction was supposed to plug. That is not
ideal, but was the best solution of the alternatives I could come up
with. The options I considered were:
- make use of the type system to add type safety to the test suite: This
  required making a lot of changes to the test suite, since most of the
  strings would now become byte objects instead, and it was not even
  fully clear to me where to draw the line. One extreme solution would
  be to just use byte objects everywhere, as the protocol doesn't
  support non-ascii characters anyway. However, this appeared to be:
  a) weird, because most of the protocol actually deals with strings,
     but we would have to prefix everything with 'b'
  b) clunky, because the handling of the bytes objects is sufficiently
     different in PY2 and PY3 (e.g. b'a'[0] is a string in PY2, but an
     int in PY3).
- using the latin1 codec (which gives an identity transformation for the
  first 256 code points of unicode) instead of the custom
  bytes_to_string functions. This almost could work, but it was still
  slightly different between python 2 and 3, because in PY2 in would
  return a unicode object, which would then cause problems when
  combined with regular strings if it contained 8-bit chars.

With this in mind, I think the best solution for the time being is to
just coerce everything into the string type as early as possible, and
have things proceed indentically on both python versions. Once we stop
supporting python3, we can revisit the idea of using bytes objects more
prevasively.

Reviewers: davide, zturner, serge-sans-paille

Subscribers: lldb-commits

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

llvm-svn: 354106

5 years agoUse sys.executable in lldb-dotest
Pavel Labath [Fri, 15 Feb 2019 07:41:17 +0000 (07:41 +0000)]
Use sys.executable in lldb-dotest

Without that, dotest.py would be executed with the default python
interpreter, which may not be the same one that lldb is built with.

This still requires the user do know which python interpreter to use
when running lldb-dotest, but now he is at least able to choose it, if
he knows which one to use.

llvm-svn: 354105

5 years agoEmbed swig version into lldb.py in a different way
Pavel Labath [Fri, 15 Feb 2019 07:41:12 +0000 (07:41 +0000)]
Embed swig version into lldb.py in a different way

Summary:
Instead of doing string chopping on the resulting python file, get swig
to output the version for us. The two things which make slightly
non-trivial are:
- in order to get swig to expand SWIG_VERSION for us, we cannot use
  %pythoncode directly, but we have to go through an intermediate macro.
- SWIG_VERSION is a hex number, but it's components are supposed to be
  interpreted decimally, so there is a bit of integer magic needed to
  get the right number to come out.

I've tested that this approach works both with the latest (3.0.12) and
oldest (1.3.40) supported swig.

Reviewers: zturner, jingham, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 354104

5 years agoRemove redundant semicolon after namespace-closing '}'
Pavel Labath [Fri, 15 Feb 2019 07:33:37 +0000 (07:33 +0000)]
Remove redundant semicolon after namespace-closing '}'

llvm-svn: 354103

5 years ago[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop
Sam McCall [Fri, 15 Feb 2019 07:16:11 +0000 (07:16 +0000)]
[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop

Summary:
The idea is that the code here isn't written, so doesn't indicate a bug.
Similar to code expanded from macros.

This means the warning no longer fires on this code:
  for (auto C : collection) {
    process(C);
    return;
  }
  handleEmptyCollection();
Unclear whether this is more often a bug or not in practice, I think it's a
reasonable idiom in some cases.
Either way, if we want to warn on "loop that doesn't loop", I think it should be
a separate warning, and catch `while(1) break;`

Reviewers: ilya-biryukov, ioeric

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 354102

5 years ago[TEST] Update test comments, refactor checks with update_test_checks.py
Max Kazantsev [Fri, 15 Feb 2019 07:06:52 +0000 (07:06 +0000)]
[TEST] Update test comments, refactor checks with update_test_checks.py

This patch changes messages in guards-related tests to adequately reflect
reality.

llvm-svn: 354101

5 years agoFix for build bot problem from last change
Aaron Smith [Fri, 15 Feb 2019 06:13:59 +0000 (06:13 +0000)]
Fix for build bot problem from last change

llvm-svn: 354100

5 years agoImplement GetLoadAddress for the Windows process plugin
Aaron Smith [Fri, 15 Feb 2019 04:32:50 +0000 (04:32 +0000)]
Implement GetLoadAddress for the Windows process plugin

Summary:
When a process is loaded, update its sections with the load address to resolve any created breakpoints. For the remote debugging case, the debugged process is launched remotely so GetLoadAddress is intended to pass the load address from remote to LLDB (client).

Reviewers: zturner, llvm-commits, clayborg, labath

Reviewed By: labath

Subscribers: mgorny, sas, Hui, clayborg, labath, lldb-commits

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

llvm-svn: 354099

5 years agoX86: Replace isSafeToClobberEFLAGS implementation
Matt Arsenault [Fri, 15 Feb 2019 04:01:39 +0000 (04:01 +0000)]
X86: Replace isSafeToClobberEFLAGS implementation

Also use modifiesRegister instead of looping over operands.

llvm-svn: 354098

5 years agoRevert "Fix implementation of [temp.local]p4."
Francis Visoiu Mistrih [Fri, 15 Feb 2019 03:06:15 +0000 (03:06 +0000)]
Revert "Fix implementation of [temp.local]p4."

This reverts commit 40bd10b770813bd1471d46f514545437516aa4ba.

This seems to now emit an error when building the sanitizer tests:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/53965/consoleFull.

llvm-svn: 354097

5 years agoRevert "[SystemZ] Do not emit VEXTEND or VROUND nodes without vector support."
Francis Visoiu Mistrih [Fri, 15 Feb 2019 03:01:09 +0000 (03:01 +0000)]
Revert "[SystemZ] Do not emit VEXTEND or VROUND nodes without vector support."

This reverts commit aa0b77d3395dc6ab91647138139c1a15a3aa088d.

This fails to pass the machine verifier:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/13579/

llvm-svn: 354096

5 years ago[lit][NFC] Cleanup copy&paste naming mistake
Julian Lettner [Fri, 15 Feb 2019 02:44:52 +0000 (02:44 +0000)]
[lit][NFC] Cleanup copy&paste naming mistake

llvm-svn: 354095

5 years ago[llvm-cxxfilt] Fix a comment typo. NFC.
Matt Davis [Fri, 15 Feb 2019 02:43:14 +0000 (02:43 +0000)]
[llvm-cxxfilt] Fix a comment typo. NFC.

llvm-svn: 354094

5 years ago[GISel][NFC]: Add methods to speed up insertion into GISelWorklist
Aditya Nandakumar [Fri, 15 Feb 2019 01:37:54 +0000 (01:37 +0000)]
[GISel][NFC]: Add methods to speed up insertion into GISelWorklist

https://reviews.llvm.org/D58073

Speed up insertion during the initial populating phase into the
GISelWorkList by deferring repeatedly resizing the DenseMap.
This results in ~10% improvement in the combiner passes, and
~3% speedup in the Legalizer.

reviewed by: aemerson.

llvm-svn: 354093

5 years ago[libFuzzer] print new functions as they are discovered in the fork mode
Kostya Serebryany [Fri, 15 Feb 2019 01:22:00 +0000 (01:22 +0000)]
[libFuzzer] print new functions as they are discovered in the fork mode

llvm-svn: 354092

5 years agoFix implementation of [temp.local]p4.
Richard Smith [Fri, 15 Feb 2019 00:29:04 +0000 (00:29 +0000)]
Fix implementation of [temp.local]p4.

When a template-name is looked up, we need to give injected-class-name
declarations of class templates special treatment, as they denote a
template rather than a type.

Previously we achieved this by applying a filter to the lookup results
after completing name lookup, but that is incorrect in various ways, not
least of which is that it lost all information about access and how
members were named, and the filtering caused us to generally lose
all ambiguity errors between templates and non-templates.

We now preserve the lookup results exactly, and the few places that need
to map from a declaration found by name lookup into a declaration of a
template do so explicitly. Deduplication of repeated lookup results of
the same injected-class-name declaration is done by name lookup instead
of after the fact.

llvm-svn: 354091

5 years agoPR40642: Fix determination of whether the final statement of a statement
Richard Smith [Fri, 15 Feb 2019 00:27:53 +0000 (00:27 +0000)]
PR40642: Fix determination of whether the final statement of a statement
expression is a discarded-value expression.

Summary:
We used to get this wrong in three ways:

1) During parsing, an expression-statement followed by the }) ending a
   statement expression was always treated as producing the value of the
   statement expression. That's wrong for ({ if (1) expr; })
2) During template instantiation, various kinds of statement (most
   statements not appearing directly in a compound-statement) were not
   treated as discarded-value expressions, resulting in missing volatile
   loads (etc).
3) In all contexts, an expression-statement with attributes was not
   treated as producing the value of the statement expression, eg
   ({ [[attr]] expr; }).

Also fix incorrect enforcement of OpenMP rule that directives can "only
be placed in the program at a position where ignoring or deleting the
directive would result in a program with correct syntax". In particular,
a label (be it goto, case, or default) should not affect whether
directives are permitted.

Reviewers: aaron.ballman, rjmccall

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 354090

5 years agoFixed failure on Darwin due to r354064
Ana Pazos [Fri, 15 Feb 2019 00:19:45 +0000 (00:19 +0000)]
Fixed failure on Darwin due to r354064

Summary:
instrprof-darwin-exports.c test fails on Darwin due  to r354064.

Updated clang list of exported symbols to fix the issue.

Reviewers: vsk

Reviewed By: vsk

Subscribers: davidxl, efriedma

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

llvm-svn: 354089

5 years ago[libFuzzer] fix the unit tests
Kostya Serebryany [Fri, 15 Feb 2019 00:15:13 +0000 (00:15 +0000)]
[libFuzzer] fix the unit tests

llvm-svn: 354088

5 years ago[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features
Kostya Serebryany [Fri, 15 Feb 2019 00:08:16 +0000 (00:08 +0000)]
[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features

llvm-svn: 354087

5 years agoLLD/AMDGPU: Preserve ABI version during linking ELF for AMDGPU
Konstantin Zhuravlyov [Thu, 14 Feb 2019 23:59:44 +0000 (23:59 +0000)]
LLD/AMDGPU: Preserve ABI version during linking ELF for AMDGPU

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

llvm-svn: 354086

5 years agoAMDGPU: Set ABI version to 1 for code object v3
Konstantin Zhuravlyov [Thu, 14 Feb 2019 23:56:04 +0000 (23:56 +0000)]
AMDGPU: Set ABI version to 1 for code object v3

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

llvm-svn: 354085

5 years ago[Driver][Darwin] Emit an error when using -pg on OS without support for it.
Volodymyr Sapsai [Thu, 14 Feb 2019 23:50:44 +0000 (23:50 +0000)]
[Driver][Darwin] Emit an error when using -pg on OS without support for it.

Instead of letting a program fail at runtime, emit an error during
compilation.

rdar://problem/12206955

Reviewers: dexonsmith, bob.wilson, steven_wu

Reviewed By: steven_wu

Subscribers: jkorous, cfe-commits

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

llvm-svn: 354084

5 years ago[symbolizer] Avoid collecting symbols belonging to invalid sections.
Matt Davis [Thu, 14 Feb 2019 23:50:35 +0000 (23:50 +0000)]
[symbolizer] Avoid collecting symbols belonging to invalid sections.

Summary:
llvm-symbolizer would originally report symbols that belonged to an invalid object file section.
Specifically the case where: `*Symbol.getSection() == ObjFile.section_end()`
This patch prevents the Symbolizer from collecting symbols that belong to invalid sections.

The test  (from PR40591) introduces a case where two symbols have address 0,
one symbol is defined, 'foo', and the other is not defined, 'bar'.  This patch will cause
the Symbolizer to keep 'foo' and ignore 'bar'.

As a side note, the logic for adding symbols to the Symbolizer's store
(`SymbolizableObjectFile::addSymbol`) replaces symbols with the
same <address, size> pair.  At some point that logic should be revisited as in the
aforementioned case, 'bar' was overwriting 'foo' in the Symbolizer's store,
and 'foo' was forgotten.

This fixes PR40591

Reviewers: jhenderson, rupprecht

Reviewed By: rupprecht

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 354083

5 years agoRevert "[INLINER] allow inlining of address taken blocks"
Nick Desaulniers [Thu, 14 Feb 2019 23:42:21 +0000 (23:42 +0000)]
Revert "[INLINER] allow inlining of address taken blocks"

This reverts commit 19e95fe61182945b7b68ad15348f144fb996633f.

llvm-svn: 354082

5 years agoRevert "Revert "[lld] Fix elf::unlinkAsync detached thread""
Nick Desaulniers [Thu, 14 Feb 2019 23:41:23 +0000 (23:41 +0000)]
Revert "Revert "[lld] Fix elf::unlinkAsync detached thread""

This reverts commit 9934f2ff02dba9fdabe6e27a83f9f95388bf4132.

llvm-svn: 354081

5 years agoRevert "[lld] Fix elf::unlinkAsync detached thread"
Nick Desaulniers [Thu, 14 Feb 2019 23:39:32 +0000 (23:39 +0000)]
Revert "[lld] Fix elf::unlinkAsync detached thread"

This reverts commit 2694810153cf992823eb45253d26b8567424438f.

llvm-svn: 354080

5 years ago[INLINER] allow inlining of address taken blocks
Nick Desaulniers [Thu, 14 Feb 2019 23:35:53 +0000 (23:35 +0000)]
[INLINER] allow inlining of address taken blocks

as long as their uses does not contain calls to functions that capture
the argument (potentially allowing the blockaddress to "escape" the
lifetime of the caller).

TODO:
- add more tests
- fix crash in llvm::updateCGAndAnalysisManagerForFunctionPass when
  invoking Transforms/Inline/blockaddress.ll

llvm-svn: 354079

5 years ago[lld] Fix elf::unlinkAsync detached thread
Vitaly Buka [Thu, 14 Feb 2019 23:29:28 +0000 (23:29 +0000)]
[lld] Fix elf::unlinkAsync detached thread

Summary:
So this patch just make sure that the thread is at least stated
before we return from main.

If we just detach then the thread may be actually be stated just after
the process returned from main and it's calling atexit handers. Then the thread may try to create own function static variable and it will
add new at exit handlers confusing libc.

GLIBC before 2.27 had race in that case which corrupted atexit handlers
list. Support for this use-case for other implementation is also unclear,
so we can try just avoid that.

PR40162

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 354078

5 years ago[x86] add tests for extractelement of FP; NFC
Sanjay Patel [Thu, 14 Feb 2019 23:17:22 +0000 (23:17 +0000)]
[x86] add tests for extractelement of FP; NFC

llvm-svn: 354077

5 years ago[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features
Kostya Serebryany [Thu, 14 Feb 2019 23:12:33 +0000 (23:12 +0000)]
[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features

llvm-svn: 354076

5 years ago[clang][FileManager] fillRealPathName even if we aren't opening the file
Jan Korous [Thu, 14 Feb 2019 23:02:35 +0000 (23:02 +0000)]
[clang][FileManager] fillRealPathName even if we aren't opening the file

The pathname wasn't previously filled when the getFile() method was called with openFile = false.
We are caching FileEntry-s in ParsedAST::Includes in clangd and this caused the problem.

This fixes an internal test failure in clangd - ClangdTests.GoToInclude.All

rdar://47536127

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

llvm-svn: 354075

5 years ago[Sema] Fix-up a -Wfloat-conversion diagnostic
Erik Pilkington [Thu, 14 Feb 2019 22:48:01 +0000 (22:48 +0000)]
[Sema] Fix-up a -Wfloat-conversion diagnostic

We were warning on valid ObjC property reference exprs, and passing
in the wrong arguments to DiagnoseFloatingImpCast (leading to a badly
worded diagnostic).

rdar://47644670

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

llvm-svn: 354074

5 years ago[lit] Remove --single-process option (use -j1 instead)
Julian Lettner [Thu, 14 Feb 2019 22:46:56 +0000 (22:46 +0000)]
[lit] Remove --single-process option (use -j1 instead)

Remove `--single-process` command line option. Use `-j1` instead.

Also see commit: 96adb78b120b6aa9739eb714534dc8e819f7bc52

llvm-svn: 354073

5 years agoMC/ELF: Allow targets to set ABI version
Konstantin Zhuravlyov [Thu, 14 Feb 2019 22:42:09 +0000 (22:42 +0000)]
MC/ELF: Allow targets to set ABI version

Tests are in the follow up change

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

llvm-svn: 354072

5 years agoGlobalISel: Add alignment to LegalityQuery MMOs
Matt Arsenault [Thu, 14 Feb 2019 22:41:09 +0000 (22:41 +0000)]
GlobalISel: Add alignment to LegalityQuery MMOs

This allows targets to specify the minimum alignment required for the
load/store.

llvm-svn: 354071

5 years agoReplace gcroot verifier tests
Matt Arsenault [Thu, 14 Feb 2019 22:41:01 +0000 (22:41 +0000)]
Replace gcroot verifier tests

These haven't been checking anything useful and have been testing the
wrong failure reason for many years. Replace them with something which
stresses what is actually implemented in the verifier now.

llvm-svn: 354070

5 years ago[clang-tidy] Mention language version in test explicitly.
Volodymyr Sapsai [Thu, 14 Feb 2019 22:37:30 +0000 (22:37 +0000)]
[clang-tidy] Mention language version in test explicitly.

"modernize-use-using" check is applicable only to C++11 and later. Spell it out
to avoid relying on default language version.

rdar://problem/47932196

llvm-svn: 354069

5 years ago[lit] Set --single-process for single tests and --threads=1
Julian Lettner [Thu, 14 Feb 2019 22:30:07 +0000 (22:30 +0000)]
[lit] Set --single-process for single tests and --threads=1

Summary:
Automatically upgrade debugging experience (single process, no thread
pool) when:
  1) we only run a single test
  2) user specifies `-j1`

Details:
Fix `--max-failures` in single process mode. Option did not have an
effect in single process mode.

Add display feedback for single process mode. Adapted test.

Improve argument checking (require positive integers).

`--single-process` is now essentially an alias for `-j1`. Should we
remove it?

Reviewers: rnk

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

llvm-svn: 354068

5 years agoAMDGPU/GlobalISel: Fix RegBankSelect for GEP.
Matt Arsenault [Thu, 14 Feb 2019 22:24:28 +0000 (22:24 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for GEP.

This is basically a pointer typed add, so shouldn't be any different.
This was assuming everything was an SGPR, which is not true.

Also cleanup legality for GEP. I don't seem to be seeing the problem
the hack marking s64 as a legal pointer type the comment mentions.

llvm-svn: 354067

5 years ago[AMDGPU] Ressociate 'add (add x, y), z' to use SALU
Stanislav Mekhanoshin [Thu, 14 Feb 2019 22:11:25 +0000 (22:11 +0000)]
[AMDGPU] Ressociate 'add (add x, y), z' to use SALU

Reassociate adds to collect scalar operands in a single
instruction when possible. That will result in a scalar
add followed by vector instead of two vector adds, thus
better utilizing SALU.

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

llvm-svn: 354066

5 years agoAMDGPU/GlobalISel: Handle split for 64-bit VALU select
Matt Arsenault [Thu, 14 Feb 2019 21:58:12 +0000 (21:58 +0000)]
AMDGPU/GlobalISel: Handle split for 64-bit VALU select

llvm-svn: 354065

5 years agoSet hidden attribute on lprofMergeValueProfData
Ana Pazos [Thu, 14 Feb 2019 21:38:40 +0000 (21:38 +0000)]
Set hidden attribute on lprofMergeValueProfData

Summary:
The changes in https://reviews.llvm.org/D44847 cause load time failure
due to lprofMergeValueProfData in Android libs enabled with profile generation:

"dlopen failed: cannot locate symbol "lprofMergeValueProfData" referenced by..."

Marking lprofMergeValueProfData as hidden so the correct in-module definition
 is picked by the linker.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: efriedma, xur, davidxl, llvm-commits

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

llvm-svn: 354064

5 years agoFurther relax restriction in tests to include where "-E" and "-S" must appear.
Douglas Yung [Thu, 14 Feb 2019 21:37:19 +0000 (21:37 +0000)]
Further relax restriction in tests to include where "-E" and "-S" must appear.

Also updated a few instances of "-emit-llvm-bc" and "-emit-obj" that were missed in the previous change.

llvm-svn: 354063

5 years ago[ThinLTO] Detect partially split modules during the thin link
Teresa Johnson [Thu, 14 Feb 2019 21:22:50 +0000 (21:22 +0000)]
[ThinLTO] Detect partially split modules during the thin link

Summary:
The changes to disable LTO unit splitting by default (r350949) and
detect inconsistently split LTO units (r350948) are causing some crashes
when the inconsistency is detected in multiple threads simultaneously.
Fix that by having the code always look for the inconsistently split
LTO units during the thin link, by checking for the presence of type
tests recorded in the summaries.

Modify test added in r350948 to remove single threading required to fix
a bot failure due to this issue (and some debugging options added in the
process of diagnosing it).

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 354062

5 years ago[libFuzzer] better stats for the fork mode
Kostya Serebryany [Thu, 14 Feb 2019 21:09:32 +0000 (21:09 +0000)]
[libFuzzer] better stats for the fork mode

llvm-svn: 354061

5 years ago[CMake] Fix ability to use LLVM_ENABLE_PROJECTS with LLVM_EXTERNAL_PROJECTS
Chris Bieneman [Thu, 14 Feb 2019 20:57:17 +0000 (20:57 +0000)]
[CMake] Fix ability to use LLVM_ENABLE_PROJECTS with LLVM_EXTERNAL_PROJECTS

LLVM r353148, changed the circumstances in which the project source directory variables are created to only create them for LLVM projects. This patch initializes the directory variables for projects specified in `LLVM_EXTERNAL_PROJECTS` as well.

llvm-svn: 354060

5 years ago[InstCombine] Add todos for possible atomicrmw transforms
Philip Reames [Thu, 14 Feb 2019 20:48:36 +0000 (20:48 +0000)]
[InstCombine] Add todos for possible atomicrmw transforms

llvm-svn: 354059

5 years agoCanonicalize all integer "idempotent" atomicrmw ops
Philip Reames [Thu, 14 Feb 2019 20:41:17 +0000 (20:41 +0000)]
Canonicalize all integer "idempotent" atomicrmw ops

For "idempotent" atomicrmw instructions which we can't simply turn into load, canonicalize the operation and constant. This reduces the matching needed elsewhere in the optimizer, but doesn't directly impact codegen.

For any architecture where OR/Zero is not a good default choice, you can extend the AtomicExpand lowerIdempotentRMWIntoFencedLoad mechanism. I reviewed X86 to make sure this works well, haven't audited other backends.

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

llvm-svn: 354058

5 years agoStop enabling clang-tools-extra automatically when clang is in LLVM_ENABLE_PROJECTS
Nico Weber [Thu, 14 Feb 2019 20:26:35 +0000 (20:26 +0000)]
Stop enabling clang-tools-extra automatically when clang is in LLVM_ENABLE_PROJECTS

If you want to build clang-tools-extra with monorepo, just add it to
LLVM_ENABLE_PROJECTS like with other projects.

See also "Separating clang-tools-extra from clang in LLVM_ENABLE_PROJECTS"
on cfe-dev.

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

llvm-svn: 354057

5 years ago[CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when available
Erik Pilkington [Thu, 14 Feb 2019 19:58:37 +0000 (19:58 +0000)]
[CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when available

This provides a code size win on the caller side, since the init
message send is done in the runtime function.

rdar://44987038

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

llvm-svn: 354056

5 years agoOptional specialization for trivially copyable types, part2
Serge Guelton [Thu, 14 Feb 2019 19:41:44 +0000 (19:41 +0000)]
Optional specialization for trivially copyable types, part2

llvm-svn: 354055

5 years agoMove a function from .h to .cpp and use a shorter name. NFC.
Rui Ueyama [Thu, 14 Feb 2019 19:33:26 +0000 (19:33 +0000)]
Move a function from .h to .cpp and use a shorter name. NFC.

llvm-svn: 354054

5 years ago[X86] Add clang support for X86 flag output parameters.
Nirav Dave [Thu, 14 Feb 2019 19:27:25 +0000 (19:27 +0000)]
[X86] Add clang support for X86 flag output parameters.

Summary:
Add frontend support and expected flags for X86 inline assembly flag
parameters.

Reviewers: craig.topper, rnk, echristo

Subscribers: eraman, nickdesaulniers, void, llvm-commits

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

llvm-svn: 354053

5 years agoRemove a comparator from header and instead use lambdas for simplicity. NFC.
Rui Ueyama [Thu, 14 Feb 2019 19:21:10 +0000 (19:21 +0000)]
Remove a comparator from header and instead use lambdas for simplicity. NFC.

llvm-svn: 354052

5 years agoRecommit Optional specialization for trivially copyable types
Serge Guelton [Thu, 14 Feb 2019 19:17:00 +0000 (19:17 +0000)]
Recommit Optional specialization for trivially copyable types

Unfortunately the original code gets misscompiled by GCC (at least 8.1),
this is a tentative workaround using std::memcpy instead of inplace new
for trivially copyable types. I'll revert if it breaks.

Original revision: https://reviews.llvm.org/D57097

llvm-svn: 354051

5 years ago[lldb] [MainLoop] Remove redundant termination clause (NFCI)
Michal Gorny [Thu, 14 Feb 2019 18:51:21 +0000 (18:51 +0000)]
[lldb] [MainLoop] Remove redundant termination clause (NFCI)

Remove the redundant termination clause from within the loop.  Since
the check is done at the end of the loop, it's entirely redundant
to the 'while' condition.  If termination was requested, the latter
will become false and the 'while' loop will terminate, resulting
in the 'return' statement below the loop being executed (which is
equivalent to the one used inside 'if').

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

llvm-svn: 354050

5 years agoAdd a comment. NFC.
Rui Ueyama [Thu, 14 Feb 2019 18:50:59 +0000 (18:50 +0000)]
Add a comment. NFC.

llvm-svn: 354049

5 years agoAdd explicit language specifier to test.
Adrian Prantl [Thu, 14 Feb 2019 18:49:14 +0000 (18:49 +0000)]
Add explicit language specifier to test.

llvm-svn: 354048

5 years ago[dotest] Fix compiler version number comparison
Frederic Riss [Thu, 14 Feb 2019 18:48:05 +0000 (18:48 +0000)]
[dotest] Fix compiler version number comparison

dotest's version comparision function is just a lexicographical compare
of the version strings. This is obviously wrong. This patch implements
the comparison using distutils.version.LooseVersion as suggested by
Zachary.

Reviewers: zturner, labath, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 354047