platform/upstream/llvm.git
6 years ago[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous...
Aleksei Sidorin [Tue, 24 Apr 2018 10:11:53 +0000 (10:11 +0000)]
[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous decls

This patch introduces the ability to test an arbitrary sequence of imports
between a given set of virtual source files. This should finally allow
us to write simple tests and fix annoying issues inside ASTImporter
that cause failures in CSA CTU. This is done by refactoring
ASTImporterTest functions and introducing `testImportSequence` facility.
As a side effect, `testImport` facility was generalized a bit more. It
should now allow import of non-decl AST nodes; however, there is still no
test using this ability.

As a "test for test", there is also a fix for import anonymous TagDecls
referred by typedef. Before this patch, the setting of typedef for anonymous
structure was delayed; however, this approach misses the corner case if
an enum constant is imported directly. In this patch, typedefs for
anonymous declarations are imported right after the anonymous declaration
is imported, without any delay.

Thanks to Adam Balogh for suggestions included into this patch.

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

llvm-svn: 330704

6 years ago[llvm-mca][CommandGuide] Fix typo in example.
Andrea Di Biagio [Tue, 24 Apr 2018 10:09:32 +0000 (10:09 +0000)]
[llvm-mca][CommandGuide] Fix typo in example.

llvm-svn: 330703

6 years ago[ELF] - Never use std::sort.
George Rimar [Tue, 24 Apr 2018 09:55:39 +0000 (09:55 +0000)]
[ELF] - Never use std::sort.

It turns out we should not use the std::sort anymore.
r327219 added a new wrapper llvm::sort (D39245).
When EXPENSIVE_CHECKS is defined, it shuffles the
input container and that helps to find non-deterministic
ordering.

Patch changes code to use llvm::sort and std::stable_sort
instead of std::sort

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

llvm-svn: 330702

6 years ago[ELF] - Refactor lazy symbol duplicated code.
George Rimar [Tue, 24 Apr 2018 09:41:56 +0000 (09:41 +0000)]
[ELF] - Refactor lazy symbol duplicated code.

Our code for LazyObject and LazyArchive duplicates.

This patch extracts the common part to remove
the duplication.

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

llvm-svn: 330701

6 years ago[CodeGen] Do not allow opt-bisect-limit to skip ScalarizeMaskedMemIntrin.
Andrei Elovikov [Tue, 24 Apr 2018 09:24:29 +0000 (09:24 +0000)]
[CodeGen] Do not allow opt-bisect-limit to skip ScalarizeMaskedMemIntrin.

Summary:
The pass is supposed to scalarize such intrinsics if the target does not support
them natively, so if the scalarization does not happen instruction selection
crashes due to inability to lower these intrinsics.

Reviewers: andrew.w.kaylor, craig.topper

Reviewed By: andrew.w.kaylor

Subscribers: llvm-commits

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

llvm-svn: 330700

6 years ago[NFC] Remove recently added SE verification because it may be false-positive
Max Kazantsev [Tue, 24 Apr 2018 09:11:01 +0000 (09:11 +0000)]
[NFC] Remove recently added SE verification because it may be false-positive

llvm-svn: 330699

6 years ago[LoopInfo] Verify BBMap tracks innermost loops for BBs.
Florian Hahn [Tue, 24 Apr 2018 09:10:05 +0000 (09:10 +0000)]
[LoopInfo] Verify BBMap tracks innermost loops for BBs.

By checking that none of the child loops contain a BB we make sure BBMap
contains the innermost loop defining BB. This invariant was violated in
LoopInterchange and got caught by this assertion.

Reviewers: chandlerc, mzolotukhin, sanjoy, mehdi_amini, efriedma

Reviewed By: efriedma

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

llvm-svn: 330698

6 years ago[AArch64][SVE] Asm: Support for contiguous, first-faulting LDFF1 (scalar+scalar)...
Sander de Smalen [Tue, 24 Apr 2018 08:59:08 +0000 (08:59 +0000)]
[AArch64][SVE] Asm: Support for contiguous, first-faulting LDFF1 (scalar+scalar) load instructions.

Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, t.p.northover, echristo, evandro, javed.absar

Reviewed By: rengolin

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330697

6 years ago[GCC] Match a GCC version with a patch suffix without a third version component
Martin Storsjo [Tue, 24 Apr 2018 08:50:11 +0000 (08:50 +0000)]
[GCC] Match a GCC version with a patch suffix without a third version component

Previously it would only accept a string as a GCC version if it had
either two components and no suffix, or three components with an
optional suffix.

Debian and ubuntu provided mingw compilers have lib/gcc/target entries
like "5.3-posix" and "5.3-win32". This doesn't try to make any specific
preference between them (other than lexical sorting of the suffix).

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

llvm-svn: 330696

6 years ago[test] Fix a typo in a test directory name. NFC.
Martin Storsjo [Tue, 24 Apr 2018 08:49:57 +0000 (08:49 +0000)]
[test] Fix a typo in a test directory name. NFC.

llvm-svn: 330695

6 years agoLink to AggressiveInstCombine in a few places. Unbreaks build for me.
Roman Lebedev [Tue, 24 Apr 2018 08:40:44 +0000 (08:40 +0000)]
Link to AggressiveInstCombine in a few places. Unbreaks build for me.

/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

llvm-svn: 330694

6 years agoLink to AggressiveInstCombine in a few places. Unbreaks build for me.
Roman Lebedev [Tue, 24 Apr 2018 08:40:37 +0000 (08:40 +0000)]
Link to AggressiveInstCombine in a few places. Unbreaks build for me.

/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

llvm-svn: 330693

6 years ago[libclang] Only mark CXCursors for explicit attributes with a type
Erik Verbruggen [Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)]
[libclang] Only mark CXCursors for explicit attributes with a type

All attributes have a source range associated with it. However, implicit
attributes are added by the compiler, and not added because the user
wrote something in the input. So no token type should be set to
CXCursor_*Attr.

The problem was visible when a class gets marked by e.g.
MSInheritanceAttr, which has the full CXXRecordDecl's range as its
own range. The effect of marking that range as CXCursor_UnexposedAttr
was that all cursors for the record decl, including all child decls,
would become CXCursor_UnexposedAttr.

llvm-svn: 330692

6 years ago[Support/Path] Add more tests and improve failure messages of existing ones
Pavel Labath [Tue, 24 Apr 2018 08:29:20 +0000 (08:29 +0000)]
[Support/Path] Add more tests and improve failure messages of existing ones

Summary:
I am preparing a patch to the path function. While working on it, I
noticed that some of the areas are lacking test coverage (e.g. filename
and parent_path functions), so I add more tests to guard against
regressions there.

I have also found the failure messages hard to understand, so I rewrote
some existing test to give more actionable messages when they fail:
- for tests which run over multiple inputs, I use SCOPED_TRACE, to show
  which of the inputs caused the actual failure.
- for comparisons of vectors, I use gmock's container matchers, which
  will print out the full container contents (and the elements that
  differ) when they fail to match.

Reviewers: zturner, espindola

Subscribers: llvm-commits

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

llvm-svn: 330691

6 years ago[AST] Another attempt at fixing the ARM bots.
Benjamin Kramer [Tue, 24 Apr 2018 08:18:32 +0000 (08:18 +0000)]
[AST] Another attempt at fixing the ARM bots.

llvm-svn: 330690

6 years ago[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.
Benjamin Kramer [Tue, 24 Apr 2018 07:53:10 +0000 (07:53 +0000)]
[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.

llvm-svn: 330689

6 years ago[LVI] Fix typo. NFC
Xin Tong [Tue, 24 Apr 2018 07:38:07 +0000 (07:38 +0000)]
[LVI] Fix typo. NFC

llvm-svn: 330688

6 years ago[LibFuzzer] Tweak `MutationDispatcher::Mutate_CopyPart` mutation.
Dan Liew [Tue, 24 Apr 2018 06:31:09 +0000 (06:31 +0000)]
[LibFuzzer] Tweak `MutationDispatcher::Mutate_CopyPart` mutation.

It doesn't make sense to non-deterministically choose between
`CopyPart(..)` and `InsertPart(..)` when it is known that
`InsertPart(..)` will fail.

This upstream's a change from JFS solver's fork of LibFuzzer.

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

llvm-svn: 330687

6 years ago[llvm-objcopy] Adjust the code for the old versions of msvc
Alexander Shaposhnikov [Tue, 24 Apr 2018 06:23:22 +0000 (06:23 +0000)]
[llvm-objcopy] Adjust the code for the old versions of msvc

Follow-up for r330685.

llvm-svn: 330686

6 years agoRecommit "[llvm-objcopy] Switch over to using TableGen for parsing arguments"
Alexander Shaposhnikov [Tue, 24 Apr 2018 05:43:32 +0000 (05:43 +0000)]
Recommit "[llvm-objcopy] Switch over to using TableGen for parsing arguments"

Add explicit dependency on ObjcopyTableGen
and rerun the tests on Windows.
I will double-check the build bots
and revert this commit if necessary.

llvm-svn: 330685

6 years ago[NFC] Use FileCheck in test
Max Kazantsev [Tue, 24 Apr 2018 04:42:37 +0000 (04:42 +0000)]
[NFC] Use FileCheck in test

llvm-svn: 330684

6 years ago[NFC] Use forgetTopmostLoop instead of logic duplication
Max Kazantsev [Tue, 24 Apr 2018 04:33:04 +0000 (04:33 +0000)]
[NFC] Use forgetTopmostLoop instead of logic duplication

llvm-svn: 330683

6 years ago[X86] Add a BSWAP16 instruction using the 32-bit encoding plus a 0x66 prefix.
Craig Topper [Tue, 24 Apr 2018 04:28:02 +0000 (04:28 +0000)]
[X86] Add a BSWAP16 instruction using the 32-bit encoding plus a 0x66 prefix.

This encoding is recognized by the CPU, but the behavior is undefined. This makes the disassembler handle it correctly so we don't print bswapl with a 16-bit register.

llvm-svn: 330682

6 years ago[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.
Craig Topper [Tue, 24 Apr 2018 03:36:08 +0000 (03:36 +0000)]
[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

The unmasked versions already didn't have this restrction. I don't think gcc or icc limit these to 64-bit mode so we shouldn't either.

llvm-svn: 330681

6 years ago[PM/LoopUnswitch] Remove another over-aggressive assert.
Chandler Carruth [Tue, 24 Apr 2018 03:27:00 +0000 (03:27 +0000)]
[PM/LoopUnswitch] Remove another over-aggressive assert.

This code path can very clearly be called in a context where we have
baselined all the cloned blocks to a particular loop and are trying to
handle nested subloops. There is no harm in this, so just relax the
assert. I've added a test case that will make sure we actually exercise
this code path.

llvm-svn: 330680

6 years agoFixup Polly for an LLVM header file change.
David Blaikie [Tue, 24 Apr 2018 02:23:41 +0000 (02:23 +0000)]
Fixup Polly for an LLVM header file change.

llvm-svn: 330679

6 years agoRemove unused function HexagonEarlyIfConversion::replacePhiEdges. NFC.
Eric Christopher [Tue, 24 Apr 2018 02:10:59 +0000 (02:10 +0000)]
Remove unused function HexagonEarlyIfConversion::replacePhiEdges. NFC.

llvm-svn: 330678

6 years ago[NFC] Add clarification comment
Max Kazantsev [Tue, 24 Apr 2018 02:08:05 +0000 (02:08 +0000)]
[NFC] Add clarification comment

llvm-svn: 330677

6 years agoReflow formatting after previous NFC commit.
Eric Christopher [Tue, 24 Apr 2018 01:57:03 +0000 (01:57 +0000)]
Reflow formatting after previous NFC commit.

llvm-svn: 330676

6 years agoChange if-conditionals to else-if as they should all be mutually exclusive.
Eric Christopher [Tue, 24 Apr 2018 01:57:02 +0000 (01:57 +0000)]
Change if-conditionals to else-if as they should all be mutually exclusive.

No functional change intended.

llvm-svn: 330675

6 years agoMake add_clang_tool() formatting a bit more consistent.
Nico Weber [Tue, 24 Apr 2018 01:30:44 +0000 (01:30 +0000)]
Make add_clang_tool() formatting a bit more consistent.

llvm-svn: 330674

6 years agoMostly revert r330672.
Nico Weber [Tue, 24 Apr 2018 01:24:42 +0000 (01:24 +0000)]
Mostly revert r330672.

The test is apparently needed e.g. for check-cfi on Windows where we get
  'C:/b/slave/sanitizer-windows/build/./bin/clang.exe': command not found
without it.  Try to fix the problem that was fixed by r330672 by also checking
for isabs() instead.

llvm-svn: 330673

6 years agoRemove code that's almost always dead, and harmful if not.
Nico Weber [Tue, 24 Apr 2018 01:05:04 +0000 (01:05 +0000)]
Remove code that's almost always dead, and harmful if not.

lit's util.which() would check if the passed-in path existed directly,
and if so return it as-is.  This is never the case when running llvm's, clang's,
or lld's tests normally.  But when running `./llvm-lit path/to/clang/test`
with a cwd of llvm-build/bin, this if would detect that clang exists at path
'clang' and return 'clang' as the discovered clang binary -- and then lit would
use the " clang " -> "*** Do not use 'clang' in tests, use '%clang'. ***"
substitution to replace that with a broken test.  By removing this early
return, lit ends up with the usual absolute path and everything works even
in this uncommon case.

llvm-svn: 330672

6 years agoFix build break due to content moving from Scalar.h to InstCombine.h in LLVM
David Blaikie [Tue, 24 Apr 2018 00:59:22 +0000 (00:59 +0000)]
Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

llvm-svn: 330671

6 years agoFix build breaks in examples due to moving stuff from Scalar.h to InstCombine.h
David Blaikie [Tue, 24 Apr 2018 00:58:57 +0000 (00:58 +0000)]
Fix build breaks in examples due to moving stuff from Scalar.h to InstCombine.h

llvm-svn: 330670

6 years agoInstCombine: Fix layering by not including Scalar.h in InstCombine
David Blaikie [Tue, 24 Apr 2018 00:48:59 +0000 (00:48 +0000)]
InstCombine: Fix layering by not including Scalar.h in InstCombine

(notionally Scalar.h is part of libLLVMScalarOpts, so it shouldn't be
included by InstCombine which doesn't/shouldn't need to depend on
ScalarOpts)

llvm-svn: 330669

6 years ago[AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API.
Craig Topper [Tue, 24 Apr 2018 00:39:29 +0000 (00:39 +0000)]
[AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API.

I just tried to copy what was done for regular InstCombine. Hopefully I didn't miss anything.

llvm-svn: 330668

6 years agoReland r301880(!): "[InstSimplify] Handle selects of GEPs with 0 offset"
George Burgess IV [Tue, 24 Apr 2018 00:25:01 +0000 (00:25 +0000)]
Reland r301880(!): "[InstSimplify] Handle selects of GEPs with 0 offset"

I was reminded today that this patch got reverted in r301885. I can no
longer reproduce the failure that caused the revert locally (...almost
one year later), and the patch applied pretty cleanly, so I guess we'll
see if the bots still get angry about it.

The original breakage was InstSimplify complaining (in "assertion
failed" form) about getting passed some crazy IR when running `ninja
check-sanitizer`. I'm unable to find traces of what, exactly, said crazy
IR was. I suppose we'll find out pretty soon if that's still the case.
:)

Original commit:

  Author: gbiv
  Date: Mon May  1 18:12:08 2017
  New Revision: 301880

  URL: http://llvm.org/viewvc/llvm-project?rev=301880&view=rev
  Log:
  [InstSimplify] Handle selects of GEPs with 0 offset

  In particular (since it wouldn't fit nicely in the summary):
  (select (icmp eq V 0) P (getelementptr P V)) -> (getelementptr P V)

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

llvm-svn: 330667

6 years ago[HWASan] Use dynamic shadow memory on Android only.
Alex Shlyapnikov [Tue, 24 Apr 2018 00:17:02 +0000 (00:17 +0000)]
[HWASan] Use dynamic shadow memory on Android only.

There're issues with IFUNC support on other platforms.

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

llvm-svn: 330666

6 years ago[HWASan] Use dynamic shadow memory on Android only (LLVM)
Alex Shlyapnikov [Tue, 24 Apr 2018 00:16:54 +0000 (00:16 +0000)]
[HWASan] Use dynamic shadow memory on Android only (LLVM)

There're issues with IFUNC support on other platforms.

DIfferential Revision: https://reviews.llvm.org/D45840

llvm-svn: 330665

6 years ago[AggressiveInstCombine] Add createAggressiveInstCombinerPass to LinkAllPasses.h.
Craig Topper [Tue, 24 Apr 2018 00:11:04 +0000 (00:11 +0000)]
[AggressiveInstCombine] Add createAggressiveInstCombinerPass to LinkAllPasses.h.

llvm-svn: 330664

6 years ago[AggressiveInstCombine] Add library initializer routine for AggressiveInstCombine...
Craig Topper [Tue, 24 Apr 2018 00:05:21 +0000 (00:05 +0000)]
[AggressiveInstCombine] Add library initializer routine for AggressiveInstCombine library. Use it in bugpoint and llvm-opt-fuzzer to match regular InstCombine.

This should make aggressive instcombine usable with these tools.

llvm-svn: 330663

6 years ago[X86] Remove unnecessary vector memory folded InstRW overrides.
Simon Pilgrim [Mon, 23 Apr 2018 22:45:04 +0000 (22:45 +0000)]
[X86] Remove unnecessary vector memory folded InstRW overrides.

We have test coverage for these with resources-sse*/avx*

llvm-svn: 330662

6 years ago[LLVM-C] DIBuilder Bindings For Variable Expressions
Robert Widmann [Mon, 23 Apr 2018 22:31:49 +0000 (22:31 +0000)]
[LLVM-C] DIBuilder Bindings For Variable Expressions

Summary: Add DIBuilder bindings for (global) variable expressions, variable value expressions, and debug value intrinsic insertion.

Reviewers: harlanhaskins, deadalnix, whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 330661

6 years ago[GlobalISel][Legalizer] Look thro copies while combining G_UNMERGE's
Roman Tereshin [Mon, 23 Apr 2018 22:28:36 +0000 (22:28 +0000)]
[GlobalISel][Legalizer] Look thro copies while combining G_UNMERGE's

As we're becoming stricter w/ respect to not allowing vregs having LLTs
and regclasses assigned both mid-globalisel pipeline, the number of
extra copies grows, some of which separate G_UNMERGE's from their
corresponding G_MERGE's, becoming a performance concern.

It's worth mentioning that we're already looking through copies while
combining legalization artifacts for every kind of artifact but
G_UNMERGE.

Reviewed By: aditya_nandakumar

Reviewers: ab, t.p.northover, volkan, javed.absar

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 330660

6 years ago[X86] Remove unnecessary BMI2 InstRW overrides.
Simon Pilgrim [Mon, 23 Apr 2018 22:19:55 +0000 (22:19 +0000)]
[X86] Remove unnecessary BMI2 InstRW overrides.

We have test coverage for these with resources-bmi2.s

llvm-svn: 330659

6 years ago[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_...
Craig Topper [Mon, 23 Apr 2018 22:18:36 +0000 (22:18 +0000)]
[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.

The 32-bit refers to their input/output type, but the instructions are only available in 64-bit mode.

llvm-svn: 330658

6 years ago[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_6...
Craig Topper [Mon, 23 Apr 2018 22:18:34 +0000 (22:18 +0000)]
[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.

llvm-svn: 330657

6 years ago[AST] strcmp/memcmp always compares unsigned chars.
Benjamin Kramer [Mon, 23 Apr 2018 22:04:34 +0000 (22:04 +0000)]
[AST] strcmp/memcmp always compares unsigned chars.

This makes it return the right result in a couple of edge cases. The
wide versions always do the comparison on the underlying wchar_t type.

llvm-svn: 330656

6 years agoRe-commit r330627 "[libcxx] implement <experimental/simd> declarations based on P0214R7."
Tim Shen [Mon, 23 Apr 2018 21:54:06 +0000 (21:54 +0000)]
Re-commit r330627 "[libcxx] implement <experimental/simd> declarations based on P0214R7."

There are 3 changes:
* Renamed genertor.pass.cpp to generator.pass.cpp
* Removed nothing_to_do.pass.cpp
* Mark GCC 4.9 as UNSUPPORTED for the test files that have negative
  narrowing conversion SFINAE test (see GCC PR63723).

llvm-svn: 330655

6 years ago[Docs] Regenerate command line documentation.
Craig Topper [Mon, 23 Apr 2018 21:41:06 +0000 (21:41 +0000)]
[Docs] Regenerate command line documentation.

llvm-svn: 330654

6 years ago[LoopInterchange] Do not change LI for BBs in child loops.
Florian Hahn [Mon, 23 Apr 2018 21:38:19 +0000 (21:38 +0000)]
[LoopInterchange] Do not change LI for BBs in child loops.

If a loop with child loops becomes our new inner loop after
interchanging, we only need to update LoopInfo for the blocks defined in
the old outer loop. BBs in child loops will stay there.

Reviewers: efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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

llvm-svn: 330653

6 years ago[libFuzzer] Add feature to not use AFL's deferred forkserver.
Matt Morehouse [Mon, 23 Apr 2018 21:36:21 +0000 (21:36 +0000)]
[libFuzzer] Add feature to not use AFL's deferred forkserver.

A small but substantial minority of libFuzzer-based fuzzers run code that
does not play well with fork in global constructors or LLVMFuzzerInitialize.
This patch allows these fuzzers to use afl_driver by allowing them to
opt-out of using AFL's deferred forkserver which deferres calling fork until
after this code.

Patch By: metzman

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

llvm-svn: 330652

6 years ago[Sema] Add -Wno-self-assign-overloaded
Roman Lebedev [Mon, 23 Apr 2018 21:35:21 +0000 (21:35 +0000)]
[Sema] Add -Wno-self-assign-overloaded

Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

llvm-svn: 330651

6 years agoChange kAllocatorSpace for powerpc64.
Martin Liska [Mon, 23 Apr 2018 21:13:40 +0000 (21:13 +0000)]
Change kAllocatorSpace for powerpc64.

Fixes issue: https://github.com/google/sanitizers/issues/933

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

llvm-svn: 330650

6 years agolog10: Use sw implementation from amd builtins
Jan Vesely [Mon, 23 Apr 2018 21:10:42 +0000 (21:10 +0000)]
log10: Use sw implementation from amd builtins

Add missing table.
Fixes log10d CTS on carrizo.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 330649

6 years ago[X86] Remove unnecessary WriteLEA InstRW overrides.
Simon Pilgrim [Mon, 23 Apr 2018 21:04:23 +0000 (21:04 +0000)]
[X86] Remove unnecessary WriteLEA InstRW overrides.

llvm-svn: 330648

6 years ago[COFF] Alias /DEBUG:FULL to /DEBUG
Zachary Turner [Mon, 23 Apr 2018 20:54:08 +0000 (20:54 +0000)]
[COFF] Alias /DEBUG:FULL to /DEBUG

With MSVC linker, /DEBUG is an alias of /DEBUG:FASTLINK, and if
you don't want /DEBUG:FASTLINK you have to explicitly specify
/DEBUG:FULL.

LLD doesn't support /DEBUG:FASTLINK, and so our standard /DEBUG
option is what MSVC calls /DEBUG:FULL.  To provide command line
compatibility with MSVC, we should also support /DEBUG:FULL, and
since it's the same as what LLD already does for /DEBUG, just
alias it.

llvm-svn: 330647

6 years ago[DAGCombiner] Unfold scalar masked merge if profitable
Roman Lebedev [Mon, 23 Apr 2018 20:38:49 +0000 (20:38 +0000)]
[DAGCombiner] Unfold scalar masked merge if profitable

Summary:
This is [[ https://bugs.llvm.org/show_bug.cgi?id=37104 | PR37104 ]].

[[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]] will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andl`+`andn`/`andps`+`andnps` / `bic`/`bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`).
So we need to make sure that they are still generated.

If the mask is constant, we do nothing. InstCombine should have unfolded it.
Else, i use `hasAndNot()` TLI hook.

For now, only handle scalars.

https://rise4fun.com/Alive/bO6

----

I *really* don't like the code i wrote in `DAGCombiner::unfoldMaskedMerge()`.
It is super fragile. Is there something like IR Pattern Matchers for this?

Reviewers: spatel, craig.topper, RKSimon, javed.absar

Reviewed By: spatel

Subscribers: andreadb, courbet, kristof.beyls, javed.absar, rengolin, nemanjai, llvm-commits

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

llvm-svn: 330646

6 years ago[X86][AArch64][NFC] Add tests for masked merge unfolding
Roman Lebedev [Mon, 23 Apr 2018 20:38:42 +0000 (20:38 +0000)]
[X86][AArch64][NFC] Add tests for masked merge unfolding

Summary:
This is [[ https://bugs.llvm.org/show_bug.cgi?id=37104 | PR37104 ]].

[[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]] will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andl`+`andn`/`andps`+`andnps` / `bic`/`bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`).
I'm guessing `llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp` should be able to unfold this.

Reviewers: spatel, craig.topper, RKSimon, javed.absar

Reviewed By: spatel

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

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

llvm-svn: 330645

6 years agoRemove duplicate "error:" from an error message.
Rui Ueyama [Mon, 23 Apr 2018 20:34:35 +0000 (20:34 +0000)]
Remove duplicate "error:" from an error message.

This patch also simplifies the code a bit which wasn't committed in
https://reviews.llvm.org/r330600.

llvm-svn: 330644

6 years ago[Sanitizer] Internal Printf string width + left-justify.
Alex Shlyapnikov [Mon, 23 Apr 2018 20:30:50 +0000 (20:30 +0000)]
[Sanitizer] Internal Printf string width + left-justify.

Summary:
Example:

  Printf("%-5s", "123");

should yield:

  '123  '

In case Printf's requested string field width is larger than the string
argument length, the resulting string should be padded up to the requested
width.

For the simplicity sake, implementing left-justified (right padding) only.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330643

6 years ago[AggressiveInstCombine] add tests for PR37098; NFC
Sanjay Patel [Mon, 23 Apr 2018 20:20:32 +0000 (20:20 +0000)]
[AggressiveInstCombine] add tests for PR37098; NFC

I'm not sure if this is where we should try to fold these
patterns inspired by:
https://bugs.llvm.org/show_bug.cgi?id=37098
...if this isn't the right place, we can move the tests.

llvm-svn: 330642

6 years ago[CallSiteSplit] Make sure we remove nonnull if the parameter turns out to be a constant.
Xin Tong [Mon, 23 Apr 2018 20:09:08 +0000 (20:09 +0000)]
[CallSiteSplit] Make sure we remove nonnull if the parameter turns out to be a constant.

Summary: We do not need nonull attribute if we know an argument is going to be constant.

Reviewers: junbuml, davide, fhahn

Subscribers: llvm-commits

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

llvm-svn: 330641

6 years ago[X86] Revert r330638 - accidental commit
Gabor Buella [Mon, 23 Apr 2018 20:05:51 +0000 (20:05 +0000)]
[X86] Revert r330638 - accidental commit

llvm-svn: 330640

6 years agoFix a broken typedef; NFCI
George Burgess IV [Mon, 23 Apr 2018 20:03:00 +0000 (20:03 +0000)]
Fix a broken typedef; NFCI

Richard Smith noted that `typedef typename iplist::iplist_impl_type
iplist_impl_type` is incorrect, per
http://eel.is/c++draft/basic.scope#class-2

It seems that neither clang nor gcc get too angry about this, but a
newer version of msvc does.

Thanks to jcmac on IRC for pointing this out!

llvm-svn: 330639

6 years ago[X86] movdiri and movdir64b instructions
Gabor Buella [Mon, 23 Apr 2018 20:00:59 +0000 (20:00 +0000)]
[X86] movdiri and movdir64b instructions

Reviewers: craig.topper
llvm-svn: 330638

6 years ago[clangd] Implementation of workspace/symbol request
Marc-Andre Laperle [Mon, 23 Apr 2018 20:00:52 +0000 (20:00 +0000)]
[clangd] Implementation of workspace/symbol request

Summary:
This is a basic implementation of the "workspace/symbol" request which is
used to find symbols by a string query. Since this is similar to code completion
in terms of result, this implementation reuses the "fuzzyFind" in order to get
matches. For now, the scoring algorithm is the same as code completion and
improvements could be done in the future.

The index model doesn't contain quite enough symbols for this to cover
common symbols like methods, enum class enumerators, functions in unamed
namespaces, etc. The index model will be augmented separately to achieve this.

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

Subscribers: jkorous, hokein, simark, sammccall, klimek, mgorny, ilya-biryukov, mgrang, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 330637

6 years agoRevert "[libcxx] implement <experimental/simd> declarations based on P0214R7."
Tim Shen [Mon, 23 Apr 2018 19:56:20 +0000 (19:56 +0000)]
Revert "[libcxx] implement <experimental/simd> declarations based on P0214R7."

This reverts commit r330627.

This causes several bots to freak out.

llvm-svn: 330636

6 years ago[MemCpyOpt] Skip optimizing basic blocks not reachable from entry
Bjorn Pettersson [Mon, 23 Apr 2018 19:55:04 +0000 (19:55 +0000)]
[MemCpyOpt] Skip optimizing basic blocks not reachable from entry

Summary:
Skip basic blocks not reachable from the entry node
in MemCpyOptPass::iterateOnFunction.

Code that is unreachable may have properties that do not exist
for reachable code (an instruction in a basic block can for
example be dominated by a later instruction in the same basic
block, for example if there is a single block loop).
MemCpyOptPass::processStore is only safe to use for reachable
basic blocks, since it may iterate past the basic block
beginning when used for unreachable blocks. By simply skipping
to optimize unreachable basic blocks we can avoid asserts such
as "Assertion `!NodePtr->isKnownSentinel()' failed."
in MemCpyOptPass::processStore.

The problem was detected by fuzz tests.

Reviewers: eli.friedman, dneilson, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

llvm-svn: 330635

6 years ago[OPENMP] Formatting and code improvement, NFC.
Alexey Bataev [Mon, 23 Apr 2018 19:53:05 +0000 (19:53 +0000)]
[OPENMP] Formatting and code improvement, NFC.

llvm-svn: 330634

6 years agoFix typo in comment.
Nico Weber [Mon, 23 Apr 2018 19:22:52 +0000 (19:22 +0000)]
Fix typo in comment.

llvm-svn: 330633

6 years ago[WebAssembly] MC: Refactor section creation code
Sam Clegg [Mon, 23 Apr 2018 19:16:19 +0000 (19:16 +0000)]
[WebAssembly] MC: Refactor section creation code

Remove the use of default argument in favor of a separate
startCustomSection method.

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

llvm-svn: 330632

6 years ago[CODE_OWNERS] Update my email address.
Quentin Colombet [Mon, 23 Apr 2018 19:09:49 +0000 (19:09 +0000)]
[CODE_OWNERS] Update my email address.

NFC

llvm-svn: 330631

6 years agoReland r329956, "AArch64: Introduce a DAG combine for folding offsets into addresses...
Peter Collingbourne [Mon, 23 Apr 2018 19:09:34 +0000 (19:09 +0000)]
Reland r329956, "AArch64: Introduce a DAG combine for folding offsets into addresses.", with a fix for the bot failure.

This reland includes a check to prevent the DAG combiner from folding an
offset that is smaller than the existing one. This can cause oscillations
between two possible DAGs, which was the cause of the hang and later assertion
failure observed on the lnt-ctmark-aarch64-O3-flto bot.
http://green.lab.llvm.org/green/job/lnt-ctmark-aarch64-O3-flto/2024/

Original commit message:
> This is a code size win in code that takes offseted addresses
> frequently, such as C++ constructors that typically need to compute
> an offseted address of a vtable. This reduces the size of Chromium
> for Android's .text section by 108KB.

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

llvm-svn: 330630

6 years ago[DSE] Teach the pass that atomic memory intrinsics are stores.
Daniel Neilson [Mon, 23 Apr 2018 19:06:49 +0000 (19:06 +0000)]
[DSE] Teach the pass that atomic memory intrinsics are stores.

Summary:
This change teaches DSE that the atomic memory intrinsics are stores
that can be eliminated, and can allow other stores to be eliminated.
This change specifically does not teach DSE that these intrinsics
can be partially eliminated (i.e. length reduced, and dest/src changed);
that will be handled in another change.

Reviewers: mkazantsev, skatkov, apilipenko, efriedma, rsmith

Reviewed By: efriedma

Subscribers: dmgreen, llvm-commits

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

llvm-svn: 330629

6 years ago[HWASan] Add files missing in r330624
Alex Shlyapnikov [Mon, 23 Apr 2018 19:05:12 +0000 (19:05 +0000)]
[HWASan] Add files missing in r330624

llvm-svn: 330628

6 years ago[libcxx] implement <experimental/simd> declarations based on P0214R7.
Tim Shen [Mon, 23 Apr 2018 18:47:07 +0000 (18:47 +0000)]
[libcxx] implement <experimental/simd> declarations based on P0214R7.

Summary:
The patch includes all declarations, and also implements the following features:
* ABI.
* narrowing-conversion related SFIANE, including simd<> ctors and (static_)simd_cast.

Reviewers: mclow.lists, EricWF

Subscribers: lichray, sanjoy, MaskRay, cfe-commits

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

llvm-svn: 330627

6 years agoDR727: remove wrong assertion for use of class-scope explicit
Richard Smith [Mon, 23 Apr 2018 18:38:30 +0000 (18:38 +0000)]
DR727: remove wrong assertion for use of class-scope explicit
specialization without -fms-extensions.

llvm-svn: 330626

6 years ago[AArch64] Add cost model test case for transpose
Matthew Simpson [Mon, 23 Apr 2018 18:21:29 +0000 (18:21 +0000)]
[AArch64] Add cost model test case for transpose

This patch adds a cost model test case for vector shuffles having transpose
masks. The given costs are inaccurate and will be updated in a follow-on patch.

llvm-svn: 330625

6 years ago[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).
Alex Shlyapnikov [Mon, 23 Apr 2018 18:19:23 +0000 (18:19 +0000)]
[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).

Retire the fixed shadow memory mapping to avoid conflicts with default
process memory mapping (currently manifests on Android).

Tests on AArch64 show <1% performance loss and code size increase,
making it possible to use dynamic shadow memory by default.

Keep the fixed shadow memory mapping around to be able to run
performance comparison tests later.

Re-commiting D45847 with fixed shadow for x86-64.

llvm-svn: 330624

6 years ago[HWASan] Switch back to fixed shadow mapping for x86-64
Alex Shlyapnikov [Mon, 23 Apr 2018 18:14:39 +0000 (18:14 +0000)]
[HWASan] Switch back to fixed shadow mapping for x86-64

For now switch back to fixed shadow mapping for x86-64 due to the issues
with IFUNC linking on older binutils. More details will be added to
https://bugs.chromium.org/p/chromium/issues/detail?id=835864

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

llvm-svn: 330623

6 years agoImprove checks in test/Frontend/ftime-report-template-decl.cpp
Bjorn Pettersson [Mon, 23 Apr 2018 18:05:35 +0000 (18:05 +0000)]
Improve checks in test/Frontend/ftime-report-template-decl.cpp

Some buildbots seems to have problems with the CHECKs in
test/Frontend/ftime-report-template-decl.cpp.

I this the problem is that the order in which timers are printed
is based on consumed wall time. So there is no guarantee in which
order the timers are printed.

This patch uses CHECK-DAG instead of CHECK to make the test
case less sensitive to the actual time used by the different
passes.

The (sometimes) failing test cases where introduced in trunk@330571.

llvm-svn: 330622

6 years ago[X86] Add disassembler test cases for bswap.
Craig Topper [Mon, 23 Apr 2018 17:47:33 +0000 (17:47 +0000)]
[X86] Add disassembler test cases for bswap.

This demonstrates a bug where the encoding for a 16-bit bswap prints a 16-bit register and a 32-bit mnemonic. Intel docs say 16-bit bswap is undefined. We should either claim it as an invalid encoding or we should print a 16-bit mnemonic.

objdump does print the encoding as bswap with a 16-bit register. But it doesn't seem to ever print a suffix.

llvm-svn: 330621

6 years ago[OPENMP] Do not cast captured by value variables with pointer types in
Alexey Bataev [Mon, 23 Apr 2018 17:33:41 +0000 (17:33 +0000)]
[OPENMP] Do not cast captured by value variables with pointer types in
NVPTX target.

When generating the wrapper function for the offloading region, we need
to call the outlined function and cast the arguments correctly to follow
the ABI. Usually, variables captured by value are casted to `uintptr_t`
type. But this should not performed for the variables with pointer type.

llvm-svn: 330620

6 years agoRevert r330474 - "[HWASan] Introduce non-zero based and dynamic shadow memory (compil...
Reid Kleckner [Mon, 23 Apr 2018 17:26:33 +0000 (17:26 +0000)]
Revert r330474 - "[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt)."

This commit causes internal errors with ld.bfd 2.24. My guess is that
the ifunc usage in this commit is causing problems. This is the default
system linker on Trusty Tahr, which is from 2014. I claim it's still in
our support window. Maybe we will decide to drop support for it, but
let's get the bots green while we do the investigation and have that
discussion.

Discovered here: https://crbug.com/835864

llvm-svn: 330619

6 years ago[SelectionDAG] Dump debug locs in SDNodes
Vedant Kumar [Mon, 23 Apr 2018 17:18:24 +0000 (17:18 +0000)]
[SelectionDAG] Dump debug locs in SDNodes

This helps debug issues where selection-dag assigns the wrong location
to an instruction.

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

llvm-svn: 330618

6 years ago[CMake] Add the missing `dsymutil` dependency when running tests.
Davide Italiano [Mon, 23 Apr 2018 17:06:55 +0000 (17:06 +0000)]
[CMake] Add the missing `dsymutil` dependency when running tests.

llvm-svn: 330617

6 years agoFix clang-cl warnings in compiler-rt
Reid Kleckner [Mon, 23 Apr 2018 17:05:47 +0000 (17:05 +0000)]
Fix clang-cl warnings in compiler-rt

The profile library was missing some includes and was erroneously using
ftruncate. WinASan was using `= {0}` to initialize structs, which
creates -Wmissing-field-initializers and -Wmissing-braces warnings with
clang. Use `= {}` instead, since this is C++.

llvm-svn: 330616

6 years ago[MC] Remove MachineInstr reference in MC layer (PR37160)
Simon Pilgrim [Mon, 23 Apr 2018 16:59:06 +0000 (16:59 +0000)]
[MC] Remove MachineInstr reference in MC layer (PR37160)

Only add support for getSchedInfoStr(const MachineInstr &MI) at the TargetSubtargetInfo level.

Really, the getSchedInfoStr calls need to be removed entirely, we should just return a latency/rthroughput through the subtarget and keep a string creation helper function somewhere else.

llvm-svn: 330615

6 years agoFix -Wtautological-compare warning with npos on Windows
Reid Kleckner [Mon, 23 Apr 2018 16:47:27 +0000 (16:47 +0000)]
Fix -Wtautological-compare warning with npos on Windows

llvm-svn: 330614

6 years agoQuick fix for rC330605: specify a target arch for test
Aleksei Sidorin [Mon, 23 Apr 2018 16:38:29 +0000 (16:38 +0000)]
Quick fix for rC330605: specify a target arch for test

llvm-svn: 330613

6 years agoAMDGPU: Move a flawed assert when spilling SGPRs
Matt Arsenault [Mon, 23 Apr 2018 16:13:30 +0000 (16:13 +0000)]
AMDGPU: Move a flawed assert when spilling SGPRs

It's possible to validly spill the frame offset register
in a call sequence to a VGPR. There are definitely issues
with SGPR spilling to memory, so move the assert later.

llvm-svn: 330612

6 years ago[X86] Replace x87 instregex with instrs if they only match one instruction
Simon Pilgrim [Mon, 23 Apr 2018 16:10:50 +0000 (16:10 +0000)]
[X86] Replace x87 instregex with instrs if they only match one instruction

llvm-svn: 330611

6 years agoFix computeSymbolSizes SEGFAULT on invalid file
Adrian Prantl [Mon, 23 Apr 2018 16:08:01 +0000 (16:08 +0000)]
Fix computeSymbolSizes SEGFAULT on invalid file

We use llvm-symbolizer in some production systems, and we run it
against all possibly related files, including some that are not
ELF. We noticed that for some of those invalid files, llvm-symbolizer
would crash with SEGFAULT. Here is an example of such a file.

It is due to that in computeSymbolSizes, a loop uses condition

  for (unsigned I = 0, N = Addresses.size() - 1; I < N; ++I) {

where if Addresses.size() is 0, N would overflow and causing the loop
to access invalid memory.

Instead of patching the loop conditions, the commit makes so that the
function returns early if Addresses is empty.

Validated by checking that llvm-symbolizer no longer crashes.

Patch by Teng Qin!

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

llvm-svn: 330610

6 years ago[clangd][tests] Fix delimiter handling
Jan Korous [Mon, 23 Apr 2018 15:58:42 +0000 (15:58 +0000)]
[clangd][tests] Fix delimiter handling

Empty line shouldn't be considered a delimiter

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

llvm-svn: 330609

6 years ago[clangd][tests] Fix handling of EOF in delimited input
Jan Korous [Mon, 23 Apr 2018 15:55:07 +0000 (15:55 +0000)]
[clangd][tests] Fix handling of EOF in delimited input

Request in delimited input ended by EOF shouldn't be an error state.
Comments at the end of test file shouldn't be logged as an error state.
Input mirroring should work for the last request in delimited test file.

llvm-svn: 330608

6 years agoAMDGPU: Assign enum name to stack ID
Matt Arsenault [Mon, 23 Apr 2018 15:51:26 +0000 (15:51 +0000)]
AMDGPU: Assign enum name to stack ID

Also assert that it is correct for SGPRs. There is currently a bug
where stack slot coloring replaces SGPR spill FIs with one with
the default ID, which results in a more confusing assert later
about a dead object.

llvm-svn: 330607

6 years agoStackSlotColoring: Fix missing skipFunction check
Matt Arsenault [Mon, 23 Apr 2018 15:51:21 +0000 (15:51 +0000)]
StackSlotColoring: Fix missing skipFunction check

llvm-svn: 330606

6 years ago[analyzer] Don't crash on printing ConcreteInt of size >64 bits
Aleksei Sidorin [Mon, 23 Apr 2018 15:41:44 +0000 (15:41 +0000)]
[analyzer] Don't crash on printing ConcreteInt of size >64 bits

Printing of ConcreteInts with size >64 bits resulted in assertion failure
in get[Z|S]ExtValue() because these methods are only allowed to be used
with integers of 64 max bit width. This patch fixes the issue.

llvm-svn: 330605