platform/upstream/llvm.git
5 years agoMake test/Driver/darwin-sdk-version.c pass on hosts < macOS10.14
Alex Lorenz [Mon, 17 Dec 2018 21:01:04 +0000 (21:01 +0000)]
Make test/Driver/darwin-sdk-version.c pass on hosts < macOS10.14

The test test/Driver/darwin-sdk-version.c from r349380 checks if the macOS
deployment target can be correctly inferred from the SDK version. When the
SDK version is > host version, the driver will pick the host version, so
the old test failed on macOS < 10.14. This commit makes this test more
resilient by using an older SDK version.

llvm-svn: 349393

5 years ago[Sanitizer] capsicum variadic api subset
David Carlier [Mon, 17 Dec 2018 20:57:06 +0000 (20:57 +0000)]
[Sanitizer] capsicum variadic api subset

Reviewers: markj, vitalybuka

Reviewed By: markj

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

llvm-svn: 349392

5 years ago[SDAG] Clarify the origin of chain in REG_SEQUENCE in comment, NFC
Krzysztof Parzyszek [Mon, 17 Dec 2018 20:30:20 +0000 (20:30 +0000)]
[SDAG] Clarify the origin of chain in REG_SEQUENCE in comment, NFC

llvm-svn: 349391

5 years ago[SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode
Craig Topper [Mon, 17 Dec 2018 20:29:13 +0000 (20:29 +0000)]
[SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode

The assertion type is always supposed to be a scalar type. So if the result VT of the assertion is a vector, we need to get the scalar VT before we can compare them.

Similarly for the assert above it.

I don't have a test case because I don't know of any place we violate this today. A coworker found this while trying to use r347287 on the 6.0 branch without also having r336868

llvm-svn: 349390

5 years ago[InstCombine] don't widen an arbitrary sequence of vector ops (PR40032)
Sanjay Patel [Mon, 17 Dec 2018 20:27:43 +0000 (20:27 +0000)]
[InstCombine] don't widen an arbitrary sequence of vector ops (PR40032)

The problem is shown specifically for a case with vector multiply here:
https://bugs.llvm.org/show_bug.cgi?id=40032
...and this might mask the original backend bug for ARM shown in:
https://bugs.llvm.org/show_bug.cgi?id=39967

As the test diffs here show, we were (and probably still aren't) doing
these kinds of transforms in a principled way. We are producing more or
equal wide instructions than we started with in some cases, so we still
need to restrict/correct other transforms from overstepping.

If there are perf regressions from this change, we can either carve out
exceptions to the general IR rules, or improve the backend to do these
transforms when we know the transform is profitable. That's probably
similar to a change like D55448.

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

llvm-svn: 349389

5 years agoFix build after r349380
Alex Lorenz [Mon, 17 Dec 2018 20:25:41 +0000 (20:25 +0000)]
Fix build after r349380

llvm-svn: 349388

5 years agoFix FP comparisons when SSE isn't available
Eric Fiselier [Mon, 17 Dec 2018 20:17:43 +0000 (20:17 +0000)]
Fix FP comparisons when SSE isn't available

llvm-svn: 349387

5 years agoELF: AArch64: Fix errata patch address calculation.
Peter Collingbourne [Mon, 17 Dec 2018 20:15:12 +0000 (20:15 +0000)]
ELF: AArch64: Fix errata patch address calculation.

The code here wants the output section offset of the instruction
requiring the errata patch, not the virtual address. Without this
change we can end up placing a patch out of range if the virtual
address of the code section is large enough.

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

llvm-svn: 349386

5 years agoConvert (CMP (srl/shl X, C), 0) to (CMP (and X, C'), 0) when only the zero flag is...
Craig Topper [Mon, 17 Dec 2018 20:02:16 +0000 (20:02 +0000)]
Convert (CMP (srl/shl X, C), 0) to (CMP (and X, C'), 0) when only the zero flag is used.

This allows a TEST to be used and can be combined with any AND that may already exist as an input to the shift.

This was already done in EmitTest, but was easily tricked by multiple uses because the setcc might be used by multiple instructions. Once the SETCC and users are legalized then we can look for the shift to be used by a single CMP, but the CMP itself can have multiple users.

This appears to fix the case in PR39968.

llvm-svn: 349385

5 years ago[NFC] Test commit: tweak whitespace in comment
Tan S. B. [Mon, 17 Dec 2018 19:53:22 +0000 (19:53 +0000)]
[NFC] Test commit: tweak whitespace in comment

llvm-svn: 349384

5 years ago[NativePDB] Decouple AST reconstruction from lldb Symbol creation.
Zachary Turner [Mon, 17 Dec 2018 19:43:33 +0000 (19:43 +0000)]
[NativePDB] Decouple AST reconstruction from lldb Symbol creation.

Previously the code that parsed debug info to create lldb's Symbol
objects such as Variable, Type, Function, etc was tightly coupled
to the AST reconstruction code.  This made it difficult / impossible
to implement functions such as ParseDeclsForContext() that were only
supposed to be operating on clang AST's.  By splitting these apart,
the logic becomes much cleaner and we have a clear separation of
responsibilities.

llvm-svn: 349383

5 years ago[darwin][arm64] use the "cyclone" CPU for Darwin even when `-arch`
Alex Lorenz [Mon, 17 Dec 2018 19:30:46 +0000 (19:30 +0000)]
[darwin][arm64] use the "cyclone" CPU for Darwin even when `-arch`
is not specified

The -target option allows the user to specify the build target using LLVM
triple. The triple includes the arch, and so the -arch option is redundant.
This should work just as well without the -arch. However, the driver has a bug
in which it doesn't target the "Cyclone" CPU for darwin if -target is used
without -arch. This commit fixes this issue.

rdar://46743182

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

llvm-svn: 349382

5 years ago[Driver] Don't override '-march' when using '-arch x86_64h'
Francis Visoiu Mistrih [Mon, 17 Dec 2018 19:29:27 +0000 (19:29 +0000)]
[Driver] Don't override '-march' when using '-arch x86_64h'

On Darwin, using '-arch x86_64h' would always override the option passed
through '-march'.

This patch allows users to use '-march' with x86_64h, while keeping the
default to 'core-avx2'

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

llvm-svn: 349381

5 years ago[darwin] parse the SDK settings from SDKSettings.json if it exists and
Alex Lorenz [Mon, 17 Dec 2018 19:19:15 +0000 (19:19 +0000)]
[darwin] parse the SDK settings from SDKSettings.json if it exists and
pass in the -target-sdk-version to the compiler and backend

This commit adds support for reading the SDKSettings.json file in the Darwin
driver. This file is used by the driver to determine the SDK's version, and it
uses that information to pass it down to the compiler using the new
-target-sdk-version= option. This option is then used to set the appropriate
SDK Version module metadata introduced in r349119.

Note: I had to adjust the two ast tests as the SDKROOT environment variable
on macOS caused SDK version to be picked up for the compilation of source file
but not the AST.

rdar://45774000

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

llvm-svn: 349380

5 years ago[test] Add target_info for NetBSD, and XFAIL some of locale tests
Michal Gorny [Mon, 17 Dec 2018 19:14:08 +0000 (19:14 +0000)]
[test] Add target_info for NetBSD, and XFAIL some of locale tests

Add a target_info definition for NetBSD.  The definition is based
on the one used by FreeBSD, with libcxxrt replaced by libc++abi,
and using llvm-libunwind since we need to use its unwinder
implementation to build anyway.

Additionally, XFAIL the 30 tests that fail because of non-implemented
locale features.  According to the manual, NetBSD implements only
LC_CTYPE part of locale handling.  However, there is a locale database
in the system and locale specifications are validated against it,
so it makes sense to list the common locales as supported.

If I'm counting correctly, this change enables additional 43 passing
tests.

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

llvm-svn: 349379

5 years ago[test] [re.traits] Remove asserts failing due to invalid UTF-8
Michal Gorny [Mon, 17 Dec 2018 19:13:41 +0000 (19:13 +0000)]
[test] [re.traits] Remove asserts failing due to invalid UTF-8

Remove the two test cases for \xDA and \xFA with UTF-8 locale, as both
characters alone are invalid in UTF-8 (short sequences).  Upon removing
them, the test passes on Linux again (and also on NetBSD, after adding
appropriate locale configuration).

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

llvm-svn: 349378

5 years agoNFC: remove unused variable
JF Bastien [Mon, 17 Dec 2018 19:03:24 +0000 (19:03 +0000)]
NFC: remove unused variable

D55768 removed its use.

llvm-svn: 349377

5 years agoAsmParser: test .double NaN and .double inf
JF Bastien [Mon, 17 Dec 2018 18:54:22 +0000 (18:54 +0000)]
AsmParser: test .double NaN and .double inf

Summary: It looks like this support was added to match GNU AS, but only tests
.float and not .double. I asked RedHat folks to confirm that 0x7fffffffffffffff
was indeed the right value for NaN.

Same for infinity, but it only has positive / negative encodings.

Reviewers: scanon, rjmccall

Subscribers: jkorous, dexonsmith, llvm-commits

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

llvm-svn: 349376

5 years ago[AMDGPU][MC][DOC] A fix for build failure in r349370
Dmitry Preobrazhensky [Mon, 17 Dec 2018 18:53:10 +0000 (18:53 +0000)]
[AMDGPU][MC][DOC] A fix for build failure in r349370

llvm-svn: 349375

5 years ago[TargetLowering] Add DemandedElts mask to SimplifyDemandedBits (PR40000)
Simon Pilgrim [Mon, 17 Dec 2018 18:43:43 +0000 (18:43 +0000)]
[TargetLowering] Add DemandedElts mask to SimplifyDemandedBits (PR40000)

This is an initial patch to add the necessary support for a DemandedElts argument to SimplifyDemandedBits, more closely matching computeKnownBits and to help improve vector codegen.

I've added only a small amount of the changes necessary to get at least one test to update - a lot more can be done but I'd like to add these methodically with proper test coverage, at the same time the hope is to slowly move some/all of SimplifyDemandedVectorElts into SimplifyDemandedBits as well.

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

llvm-svn: 349374

5 years agoUnbreak green dragon bots w/o __builtin_launder
Eric Fiselier [Mon, 17 Dec 2018 18:37:59 +0000 (18:37 +0000)]
Unbreak green dragon bots w/o __builtin_launder

llvm-svn: 349373

5 years agoFix lldb's macosx/heap.py cstr command.
Davide Italiano [Mon, 17 Dec 2018 18:21:51 +0000 (18:21 +0000)]
Fix lldb's macosx/heap.py cstr command.

<rdar://problem/44432167>

llvm-svn: 349372

5 years ago[Driver] Fix --repl argument.
Jonas Devlieghere [Mon, 17 Dec 2018 18:11:48 +0000 (18:11 +0000)]
[Driver] Fix --repl argument.

The --repl option was incorrectly defined as "Separate" (option and
value separated by a space). This resulted in the option not being
picked up when no value was specified.

This patch fixes the driver so that `--repl` is recognized again. I
split the option into two:

 - A flag: `--repl` and `-r` which take no arguments.
 - A joined option: `--repl=<flags>` and `-r=<flags>` that forward its
   values to the repl.

This should match the driver's old behavior.

llvm-svn: 349371

5 years ago[AMDGPU][MC][DOC] A fix for build failure in r349368
Dmitry Preobrazhensky [Mon, 17 Dec 2018 17:56:13 +0000 (17:56 +0000)]
[AMDGPU][MC][DOC] A fix for build failure in r349368

llvm-svn: 349370

5 years ago[InstSimplify] Simplify saturating add/sub + icmp
Nikita Popov [Mon, 17 Dec 2018 17:45:18 +0000 (17:45 +0000)]
[InstSimplify] Simplify saturating add/sub + icmp

If a saturating add/sub has one constant operand, then we can
determine the possible range of outputs it can produce, and simplify
an icmp comparison based on that.

The implementation is based on a similar existing mechanism for
simplifying binary operator + icmps.

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

llvm-svn: 349369

5 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description
Dmitry Preobrazhensky [Mon, 17 Dec 2018 17:38:11 +0000 (17:38 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description

Stage 2: added detailed description of operands

See bug 36572: https://bugs.llvm.org/show_bug.cgi?id=36572

llvm-svn: 349368

5 years agoMake crashlog.py work or binaries with spaces in their names
Adrian Prantl [Mon, 17 Dec 2018 17:26:04 +0000 (17:26 +0000)]
Make crashlog.py work or binaries with spaces in their names

This is a little dangerous since the crashlog files aren't 100%
unambiguous, but the risk is mitigated by using a non-greedy +?
pattern.

rdar://problem/38478511

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

llvm-svn: 349367

5 years agoMake crashlog.py work when a .dSYM is present, but a binary is missing
Adrian Prantl [Mon, 17 Dec 2018 17:25:57 +0000 (17:25 +0000)]
Make crashlog.py work when a .dSYM is present, but a binary is missing

Often users have a crash log an d a .dSYM bundle, but not the original
application binary. It turns out that for crash symbolication, we can
safely fall back to using the binary inside the .dSYM bundle.

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

llvm-svn: 349366

5 years agoFastIsel: take care to update iterators when removing instructions.
Tim Northover [Mon, 17 Dec 2018 17:25:53 +0000 (17:25 +0000)]
FastIsel: take care to update iterators when removing instructions.

We keep a few iterators into the basic block we're selecting while
performing FastISel. Usually this is fine, but occasionally code wants
to remove already-emitted instructions. When this happens we have to be
careful to update those iterators so they're not pointint at dangling
memory.

llvm-svn: 349365

5 years agoExpect Clang diagnostics in std::launder test
Eric Fiselier [Mon, 17 Dec 2018 16:56:24 +0000 (16:56 +0000)]
Expect Clang diagnostics in std::launder test

llvm-svn: 349364

5 years agoAdd missing include file.
Zachary Turner [Mon, 17 Dec 2018 16:42:26 +0000 (16:42 +0000)]
Add missing include file.

llvm-svn: 349363

5 years ago[CodeComplete] Fix test failure on different host and target configs
Ilya Biryukov [Mon, 17 Dec 2018 16:37:52 +0000 (16:37 +0000)]
[CodeComplete] Fix test failure on different host and target configs

This should fix PR40033.

llvm-svn: 349362

5 years ago[PDB] Add some helper functions for working with scopes.
Zachary Turner [Mon, 17 Dec 2018 16:15:36 +0000 (16:15 +0000)]
[PDB] Add some helper functions for working with scopes.

llvm-svn: 349361

5 years ago[Clang AST Context] Add a few helper functions.
Zachary Turner [Mon, 17 Dec 2018 16:15:13 +0000 (16:15 +0000)]
[Clang AST Context] Add a few helper functions.

The first one allows us to add an enumerator to an enum if we
already have an APSInt, since ultimately the implementation just
constructs one anyway.  The second is just a general utility
function to covert a CompilerType to a clang::TagDecl.

llvm-svn: 349360

5 years ago[MS Demangler] Add a helper function to print a Node as a string.
Zachary Turner [Mon, 17 Dec 2018 16:14:50 +0000 (16:14 +0000)]
[MS Demangler] Add a helper function to print a Node as a string.

llvm-svn: 349359

5 years ago[libcxx] Speeding up partition_point/lower_bound/upper_bound
Louis Dionne [Mon, 17 Dec 2018 16:04:39 +0000 (16:04 +0000)]
[libcxx] Speeding up partition_point/lower_bound/upper_bound

This is a re-application of r345525, which had been reverted by fear of
a regression.

Reviewed as https://reviews.llvm.org/D53994.
Thanks to Denis Yaroshevskiy for the patch.

llvm-svn: 349358

5 years agoBuild ASTImporterTest.cpp with /bigobj on MSVC builds to keep llvm-clang-x86_64-expen...
Simon Pilgrim [Mon, 17 Dec 2018 15:14:08 +0000 (15:14 +0000)]
Build ASTImporterTest.cpp with /bigobj on MSVC builds to keep llvm-clang-x86_64-expensive-checks-win buildbot happy

llvm-svn: 349357

5 years ago[MIPS GlobalISel] Remove switch statement (fix r349346 for MSVC)
Petar Avramovic [Mon, 17 Dec 2018 15:12:53 +0000 (15:12 +0000)]
[MIPS GlobalISel] Remove switch statement (fix r349346 for MSVC)

Temporarily remove switch statement without any case labels
in function legalizeCustom in order to fix r349346 for MSVC.

llvm-svn: 349356

5 years agoARM: use acquire/release instruction variants when available.
Tim Northover [Mon, 17 Dec 2018 15:05:32 +0000 (15:05 +0000)]
ARM: use acquire/release instruction variants when available.

These features (fairly) recently got split out into their own feature, so we
should make CodeGen use them when available. The main change here is that the
check used to be based on the triple, but now it's based on CPU features.

llvm-svn: 349355

5 years ago[MCA] Add support for BeginGroup/EndGroup.
Andrea Di Biagio [Mon, 17 Dec 2018 14:27:33 +0000 (14:27 +0000)]
[MCA] Add support for BeginGroup/EndGroup.

llvm-svn: 349354

5 years agoRevert "DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is...
Eric Liu [Mon, 17 Dec 2018 14:14:40 +0000 (14:14 +0000)]
Revert "DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)"

This reverts commit r349333. It caused internal test to fail. I have
sent more information to the author.

llvm-svn: 349353

5 years ago[MCA] Don't assume that createMCInstrAnalysis() always returns a valid pointer.
Andrea Di Biagio [Mon, 17 Dec 2018 14:00:37 +0000 (14:00 +0000)]
[MCA] Don't assume that createMCInstrAnalysis() always returns a valid pointer.

Class InstrBuilder wrongly assumed that llvm targets were always able to return
a non-null pointer when createMCInstrAnalysis() was called on them.
This was causing crashes when simulating executions for targets that don't
provide an MCInstrAnalysis object.
This patch fixes the issue by making MCInstrAnalysis optional.

llvm-svn: 349352

5 years ago[ASTImporter] Add importer specific lookup
Gabor Marton [Mon, 17 Dec 2018 13:53:12 +0000 (13:53 +0000)]
[ASTImporter] Add importer specific lookup

Summary:
There are certain cases when normal C/C++ lookup (localUncachedLookup)
does not find AST nodes. E.g.:

Example 1:

  template <class T>
  struct X {
    friend void foo(); // this is never found in the DC of the TU.
  };

Example 2:

  // The fwd decl to Foo is not found in the lookupPtr of the DC of the
  // translation unit decl.
  struct A { struct Foo *p; };

In these cases we create a new node instead of returning with the old one.
To fix it we create a new lookup table which holds every node and we are
not interested in any C++ specific visibility considerations.
Simply, we must know if there is an existing Decl in a given DC.

Reviewers: a_sidorin, a.sidorin

Subscribers: mgorny, rnkovacs, dkrupp, Szelethus, cfe-commits

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

llvm-svn: 349351

5 years agoRegenerate test in prep for SimplifyDemandedBits improvements.
Simon Pilgrim [Mon, 17 Dec 2018 12:48:34 +0000 (12:48 +0000)]
Regenerate test in prep for SimplifyDemandedBits improvements.

llvm-svn: 349350

5 years ago[ASTImporter] Fix redecl chain of classes and class templates
Gabor Marton [Mon, 17 Dec 2018 12:42:12 +0000 (12:42 +0000)]
[ASTImporter] Fix redecl chain of classes and class templates

Summary:
The crux of the issue that is being fixed is that lookup could not find
previous decls of a friend class. The solution involves making the
friend declarations visible in their decl context (i.e. adding them to
the lookup table).
Also, we simplify `VisitRecordDecl` greatly.

This fix involves two other repairs (without these the unittests fail):
(1) We could not handle the addition of injected class types properly
when a redecl chain was involved, now this is fixed.
(2) DeclContext::removeDecl failed if the lookup table in Vector form
did not contain the to be removed element. This caused troubles in
ASTImporter::ImportDeclContext. This is also fixed.

Reviewers: a_sidorin, balazske, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

llvm-svn: 349349

5 years ago[clangd] Change diskbackedstorage to be atomic
Kadir Cetinkaya [Mon, 17 Dec 2018 12:38:22 +0000 (12:38 +0000)]
[clangd] Change diskbackedstorage to be atomic

Summary:
There was a chance that multiple clangd instances could try to write
same shard, in which case we would get a malformed file most likely. This patch
changes the writing mechanism to first write to a temporary file and then rename
it to fit real destination. Which is guaranteed to be atomic by POSIX.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 349348

5 years ago[AggressiveInstCombine] add test for rotate insertion point; NFC
Sanjay Patel [Mon, 17 Dec 2018 12:36:35 +0000 (12:36 +0000)]
[AggressiveInstCombine] add test for rotate insertion point; NFC

As noted in D55604 - we need a test to make sure that the new intrinsic
is inserted into a valid position.

llvm-svn: 349347

5 years ago[MIPS GlobalISel] Lower G_UADDE and narrowScalar G_ADD
Petar Avramovic [Mon, 17 Dec 2018 12:31:07 +0000 (12:31 +0000)]
[MIPS GlobalISel] Lower G_UADDE and narrowScalar G_ADD

Lower G_UADDE and legalize G_ADD using narrowScalar on MIPS32.

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

llvm-svn: 349346

5 years ago[clangd] Only reduce priority of a thread for indexing.
Kadir Cetinkaya [Mon, 17 Dec 2018 12:30:27 +0000 (12:30 +0000)]
[clangd] Only reduce priority of a thread for indexing.

Summary:
We'll soon have tasks pending for reading shards from disk, we want
them to have normal priority. Because:
- They are not CPU intensive, mostly IO bound.
- Give a good coverage for the project at startup, therefore it is worth
  spending some cycles.
- We have only one task per whole CDB rather than one task per file.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 349345

5 years agoRevert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some functions'
Kristof Umann [Mon, 17 Dec 2018 12:25:48 +0000 (12:25 +0000)]
Revert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some functions'

Accidentally commited earlier with the same commit title, but really it
should've been
"Revert rC349283 '[analyzer][MallocChecker] Improve warning messages on double-delete errors'"

llvm-svn: 349344

5 years agoFix "enumeral mismatch in conditional expression" gcc7 warning. NFCI.
Simon Pilgrim [Mon, 17 Dec 2018 12:25:42 +0000 (12:25 +0000)]
Fix "enumeral mismatch in conditional expression" gcc7 warning. NFCI.

llvm-svn: 349343

5 years agoFix "enumeral mismatch in conditional expression" gcc7 warnings. NFCI.
Simon Pilgrim [Mon, 17 Dec 2018 12:17:37 +0000 (12:17 +0000)]
Fix "enumeral mismatch in conditional expression" gcc7 warnings. NFCI.

llvm-svn: 349342

5 years agoRevert rCTE349288 'Fix a lit test failure after MallocChecker changes'
Kristof Umann [Mon, 17 Dec 2018 12:08:39 +0000 (12:08 +0000)]
Revert rCTE349288 'Fix a lit test failure after MallocChecker changes'

llvm-svn: 349341

5 years agoRevert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some functions'
Kristof Umann [Mon, 17 Dec 2018 12:07:57 +0000 (12:07 +0000)]
Revert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some functions'

llvm-svn: 349340

5 years ago[AArch64][libunwind] Unwinding support for return address signing with B Key
Luke Cheeseman [Mon, 17 Dec 2018 11:43:24 +0000 (11:43 +0000)]
[AArch64][libunwind] Unwinding support for return address signing with B Key

- Support for the case where the return address has been signed with the B key
- When the B key is used, a 'B' character is present in the augmentation string
  of CIE associated with the FDE for the function.

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

llvm-svn: 349339

5 years ago[AArch64] Re-run load/store optimizer after aggressive tail duplication
Alexandros Lamprineas [Mon, 17 Dec 2018 10:45:43 +0000 (10:45 +0000)]
[AArch64] Re-run load/store optimizer after aggressive tail duplication

The Load/Store Optimizer runs before Machine Block Placement. At O3 the
Tail Duplication Threshold is set to 4 instructions and this can create
new opportunities for the Load/Store Optimizer. It seems worthwhile to
run it once again.

llvm-svn: 349338

5 years ago[ELF][ARM] Add support for architecture v6m thunks
Peter Smith [Mon, 17 Dec 2018 10:33:47 +0000 (10:33 +0000)]
[ELF][ARM] Add support for architecture v6m thunks

ARM Architecture v6m is used by the smallest microcontrollers such as the
cortex-m0. It is Thumb only (no Thumb 2) which prevents it from using the
existing Thumb 2 range extension thunks as these use the Thumb 2 movt/movw
instructions. Range extension thunks are not usually needed for
microcontrollers due to the small amount of flash and ram on the device,
however if code is copied from flash into ram then a range extension thunk
is required to call that code.

This change adds support for v6m range extension thunks. The procedure call
standard APCS permits a thunk to corrupt the intra-procedural scratch
register r12 (referred to as ip in the APCS). Most Thumb instructions do
not permit access to high registers (r8 - r15) so the thunks must spill
some low registers (r0 - r7) to perform the control transfer.

Fixes pr39922

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

llvm-svn: 349337

5 years agoReverting bitfield size to attempt to fix a windows buildbot
Kristof Umann [Mon, 17 Dec 2018 10:31:35 +0000 (10:31 +0000)]
Reverting bitfield size to attempt to fix a windows buildbot

llvm-svn: 349336

5 years ago[Docs] Expand -fstack-protector and -fstack-protector-all
Carey Williams [Mon, 17 Dec 2018 10:11:35 +0000 (10:11 +0000)]
[Docs] Expand -fstack-protector and -fstack-protector-all

Improve the description of these command line options
by providing specific heuristic information, as outlined
for the ssp function attribute(s) in LLVM's documentation.

Also rewords -fstack-protector-all for affinity.

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

llvm-svn: 349335

5 years agoDebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty ...
David Blaikie [Mon, 17 Dec 2018 08:27:19 +0000 (08:27 +0000)]
DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

GCC emitted these unconditionally on/before 4.4/March 2012
Clang emitted these unconditionally on/before 3.5/March 2014

This improves performance when parsing CUs (especially those using split
DWARF) that contain no code ranges (such as the mini CUs that may be
created by ThinLTO importing - though generally they should be/are
avoided, especially for Split DWARF because it produces a lot of very
small CUs, which don't scale well in a bunch of other ways too
(including size)).

llvm-svn: 349333

5 years ago[llvm-mca] Move llvm-mca library to llvm/lib/MCA.
Clement Courbet [Mon, 17 Dec 2018 08:08:31 +0000 (08:08 +0000)]
[llvm-mca] Move llvm-mca library to llvm/lib/MCA.

Summary: See PR38731.

Reviewers: andreadb

Subscribers: mgorny, javed.absar, tschuett, gbedwell, andreadb, RKSimon, llvm-commits

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

llvm-svn: 349332

5 years ago[X86] Add test case for PR39968. NFC
Craig Topper [Mon, 17 Dec 2018 07:51:17 +0000 (07:51 +0000)]
[X86] Add test case for PR39968. NFC

llvm-svn: 349331

5 years ago[X86] Fix bad operand lookup for cmov introduced in r349315
Craig Topper [Mon, 17 Dec 2018 06:40:35 +0000 (06:40 +0000)]
[X86] Fix bad operand lookup for cmov introduced in r349315

The CC is operand 2 not operand 3.

llvm-svn: 349330

5 years ago[Power9][NFC]update vabsd case for better dumping
Kewen Lin [Mon, 17 Dec 2018 06:32:02 +0000 (06:32 +0000)]
[Power9][NFC]update vabsd case for better dumping

Appended options -ppc-vsr-nums-as-vr and -ppc-asm-full-reg-names to get the
more descriptive output. Also removed useless function attributes.

llvm-svn: 349329

5 years ago[analyzer] MoveChecker: Enable by default as cplusplus.Move.
Artem Dergachev [Mon, 17 Dec 2018 06:30:39 +0000 (06:30 +0000)]
[analyzer] MoveChecker: Enable by default as cplusplus.Move.

This checker warns you when you re-use an object after moving it.

Mostly developed by Peter Szecsi!

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

llvm-svn: 349328

5 years ago[analyzer] MoveChecker: Add an option to suppress warnings on locals.
Artem Dergachev [Mon, 17 Dec 2018 06:19:32 +0000 (06:19 +0000)]
[analyzer] MoveChecker: Add an option to suppress warnings on locals.

Re-using a moved-from local variable is most likely a bug because there's
rarely a good motivation for not introducing a separate variable instead.
We plan to keep emitting such warnings by default.

Introduce a flag that allows disabling warnings on local variables that are
not of a known move-unsafe type. If it doesn't work out as we expected,
we'll just flip the flag.

We still warn on move-unsafe objects and unsafe operations on known move-safe
objects.

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

llvm-svn: 349327

5 years agoSpeculatively re-apply "[analyzer] MoveChecker: Add checks for dereferencing..."
Artem Dergachev [Mon, 17 Dec 2018 05:25:23 +0000 (05:25 +0000)]
Speculatively re-apply "[analyzer] MoveChecker: Add checks for dereferencing..."

This re-applies commit r349226 that was reverted in r349233 due to failures
on clang-x64-windows-msvc.

Specify enum type as unsigned for use in bit field. Otherwise overflows
may cause UB.

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

llvm-svn: 349326

5 years ago[Power9][NFC]Make pre-inc-disable case more robust
Kewen Lin [Mon, 17 Dec 2018 03:16:12 +0000 (03:16 +0000)]
[Power9][NFC]Make pre-inc-disable case more robust

With some patch adopted for Power9 vabsd* insns, some CHECKs can't get the expected results.
But it's false alarm, we should update the case more robust.

llvm-svn: 349325

5 years ago[gn build] Add build files for opt and its dependency Transforms/Couroutines
Nico Weber [Mon, 17 Dec 2018 02:33:15 +0000 (02:33 +0000)]
[gn build] Add build files for opt and its dependency Transforms/Couroutines

Needed for check-lld.

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

llvm-svn: 349324

5 years ago[EarlyCSE] If DI can't be salvaged, mark it as unavailable.
Davide Italiano [Mon, 17 Dec 2018 01:42:39 +0000 (01:42 +0000)]
[EarlyCSE] If DI can't be salvaged, mark it as unavailable.

Fixes PR39874.

llvm-svn: 349323

5 years ago[InstCombine] Add cttz/ctlz + select non-bitwidth tests; NFC
Nikita Popov [Sun, 16 Dec 2018 23:48:18 +0000 (23:48 +0000)]
[InstCombine] Add cttz/ctlz + select non-bitwidth tests; NFC

llvm-svn: 349322

5 years ago[InstCombine] Regenerate test checks; NFC
Nikita Popov [Sun, 16 Dec 2018 23:48:11 +0000 (23:48 +0000)]
[InstCombine] Regenerate test checks; NFC

Also drop unnecessary entry blocks and avoid use of anonymous
variables.

llvm-svn: 349321

5 years ago[analyzer] Fix some expressions staying live too long. Add a debug checker.
Artem Dergachev [Sun, 16 Dec 2018 23:44:06 +0000 (23:44 +0000)]
[analyzer] Fix some expressions staying live too long. Add a debug checker.

StaticAnalyzer uses the CFG-based RelaxedLiveVariables analysis in order to,
in particular, figure out values of which expressions are still needed.
When the expression becomes "dead", it is garbage-collected during
the dead binding scan.

Expressions that constitute branches/bodies of control flow statements,
eg. `E1' in `if (C1) E1;' but not `E2' in `if (C2) { E2; }', were kept alive
for too long. This caused false positives in MoveChecker because it relies
on cleaning up loop-local variables when they go out of scope, but some of those
live-for-too-long expressions were keeping a reference to those variables.

Fix liveness analysis to correctly mark these expressions as dead.

Add a debug checker, debug.DumpLiveStmts, in order to test expressions liveness.

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

llvm-svn: 349320

5 years ago[X86] Pull out constant splat rotation detection.
Simon Pilgrim [Sun, 16 Dec 2018 19:46:04 +0000 (19:46 +0000)]
[X86] Pull out constant splat rotation detection.

We had 3 different approaches - consistently use getTargetConstantBitsFromNode and allow undef elts.

llvm-svn: 349319

5 years ago[InstCombine] Make cttz/ctlz knownbits tests more robust; NFC
Nikita Popov [Sun, 16 Dec 2018 19:12:08 +0000 (19:12 +0000)]
[InstCombine] Make cttz/ctlz knownbits tests more robust; NFC

Tests checking for the addition of !range metadata should be
preserved if cttz/ctlz + icmp is optimized.

llvm-svn: 349318

5 years agoRegenerate test (merges X86+X64 cases). NFCI.
Simon Pilgrim [Sun, 16 Dec 2018 19:07:57 +0000 (19:07 +0000)]
Regenerate test (merges X86+X64 cases). NFCI.

llvm-svn: 349317

5 years agoAdd a description of the similar packets defined in the
Jason Molenda [Sun, 16 Dec 2018 18:44:54 +0000 (18:44 +0000)]
Add a description of the similar packets defined in the
gdb-remote serial protocol documentation, call out the
incompatability of lldb's vFile:open: packet as it stands
today.  Need to think about whether to change lldb's
enum values (breaking any existing lldb-server's out there)
or create a different packet and abandon vFile:open: at
least for a while.

llvm-svn: 349316

5 years ago[X86] Remove truncation handling from EmitTest. Replace it with a DAG combine.
Craig Topper [Sun, 16 Dec 2018 18:35:55 +0000 (18:35 +0000)]
[X86] Remove truncation handling from EmitTest. Replace it with a DAG combine.

I'd like to try to move a lot of the flag matching out of EmitTest and push it to isel or isel preprocessing. This is a step towards that.

The test-shrink-bug.ll changie is an improvement because we are no longer interfering with test shrink handling in isel.

The pr34137.ll change is a regression, but the IR came from -O0 and was not reduced by InstCombine. So it contains a lot of redundancies like duplicate loads that made it combine poorly.

llvm-svn: 349315

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sun, 16 Dec 2018 18:35:54 +0000 (18:35 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 349314

5 years agoClarify a few minor details.
Jason Molenda [Sun, 16 Dec 2018 18:33:58 +0000 (18:33 +0000)]
Clarify a few minor details.

llvm-svn: 349313

5 years agoRevert "[InstCombine] Regenerate test checks; NFC"
Nikita Popov [Sun, 16 Dec 2018 18:27:37 +0000 (18:27 +0000)]
Revert "[InstCombine] Regenerate test checks; NFC"

This reverts commit r349311.

Didn't check this carefully enough...

llvm-svn: 349312

5 years ago[InstCombine] Regenerate test checks; NFC
Nikita Popov [Sun, 16 Dec 2018 18:22:57 +0000 (18:22 +0000)]
[InstCombine] Regenerate test checks; NFC

llvm-svn: 349311

5 years ago[InstCombined] Add more tests for cttz/ctlz + icmp; NFC
Nikita Popov [Sun, 16 Dec 2018 17:51:32 +0000 (17:51 +0000)]
[InstCombined] Add more tests for cttz/ctlz + icmp; NFC

Test cases other than icmp with the bitwidth.

llvm-svn: 349310

5 years ago[InstCombine] Add additional saturating add/sub + icmp tests; NFC
Nikita Popov [Sun, 16 Dec 2018 17:45:25 +0000 (17:45 +0000)]
[InstCombine] Add additional saturating add/sub + icmp tests; NFC

These test comparisons with saturating add/sub in non-canonical
form.

llvm-svn: 349309

5 years agoThread safety analysis: Avoid intermediate copies [NFC]
Aaron Puchert [Sun, 16 Dec 2018 16:19:11 +0000 (16:19 +0000)]
Thread safety analysis: Avoid intermediate copies [NFC]

The main reason is to reduce the number of constructor arguments though,
especially since many of them had the same type.

llvm-svn: 349308

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Sun, 16 Dec 2018 16:14:42 +0000 (16:14 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 349307

5 years ago[InstCombine] add tests for vector widening transforms (PR40032); NFC
Sanjay Patel [Sun, 16 Dec 2018 15:50:50 +0000 (15:50 +0000)]
[InstCombine] add tests for vector widening transforms (PR40032); NFC

llvm-svn: 349306

5 years ago[test] [support] Use socket()+bind() to create unix sockets portably
Michal Gorny [Sun, 16 Dec 2018 15:12:06 +0000 (15:12 +0000)]
[test] [support] Use socket()+bind() to create unix sockets portably

Replace the mknod() call with socket() + bind() for creating unix
sockets.  The mknod() method is not portable and does not work
on NetBSD while binding the socket should work on all systems supporting
unix sockets.

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

llvm-svn: 349305

5 years ago[x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)
Sanjay Patel [Sun, 16 Dec 2018 15:05:48 +0000 (15:05 +0000)]
[x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)

This is part of fixing PR39859:
https://bugs.llvm.org/show_bug.cgi?id=39859

We have a crippled vector ISA, so we have to invert a typical fold and create min/max here.

As discussed in the bug report, we can probably do better by using saturating subtract when
it's available, but we should have this improvement for the min/max patterns regardless.

Alive proofs:
https://rise4fun.com/Alive/zsf
https://rise4fun.com/Alive/Qrl

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

llvm-svn: 349304

5 years ago[DAGCombiner] allow hoisting vector bitwise logic ahead of truncates
Sanjay Patel [Sun, 16 Dec 2018 14:57:04 +0000 (14:57 +0000)]
[DAGCombiner] allow hoisting vector bitwise logic ahead of truncates

The transform performs a bitwise logic op in a wider type followed by
truncate when both inputs are truncated from the same source type:
logic_op (truncate x), (truncate y) --> truncate (logic_op x, y)

There are a bunch of other checks that should prevent doing this when
it might be harmful.

We already do this transform for scalars in this spot. The vector
limitation was shared with a check for the case when the operands are
extended. I'm not sure if that limit is needed either, but that would
be a separate patch.

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

llvm-svn: 349303

5 years agoUpdate the list of platforms & archs
Sylvestre Ledru [Sun, 16 Dec 2018 14:47:16 +0000 (14:47 +0000)]
Update the list of platforms & archs

llvm-svn: 349302

5 years agoUse backquotes to avoid a sphinx unexpected error:
Sylvestre Ledru [Sun, 16 Dec 2018 14:19:39 +0000 (14:19 +0000)]
Use backquotes to avoid a sphinx unexpected error:
Unknown target name: "bootstrap".

llvm-svn: 349301

5 years agoThread safety analysis: Allow scoped releasing of capabilities
Aaron Puchert [Sun, 16 Dec 2018 14:15:30 +0000 (14:15 +0000)]
Thread safety analysis: Allow scoped releasing of capabilities

Summary:
The pattern is problematic with C++ exceptions, and not as widespread as
scoped locks, but it's still used by some, for example Chromium.

We are a bit stricter here at join points, patterns that are allowed for
scoped locks aren't allowed here. That could still be changed in the
future, but I'd argue we should only relax this if people ask for it.

Fixes PR36162.

Reviewers: aaron.ballman, delesley, pwnall

Reviewed By: delesley, pwnall

Subscribers: pwnall, cfe-commits

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

llvm-svn: 349300

5 years agoDocument the usage of BOOTSTRAP_XXX with stage2 builds
Sylvestre Ledru [Sun, 16 Dec 2018 14:04:10 +0000 (14:04 +0000)]
Document the usage of BOOTSTRAP_XXX with stage2 builds

llvm-svn: 349299

5 years ago[SelectionDAG] Add FSHL/FSHR support to computeKnownBits
Simon Pilgrim [Sun, 16 Dec 2018 13:33:37 +0000 (13:33 +0000)]
[SelectionDAG] Add FSHL/FSHR support to computeKnownBits

Also exposes an issue in DAGCombiner::visitFunnelShift where we were assuming the shift amount had the result type (after legalization it'll have the targets shift amount type).

llvm-svn: 349298

5 years ago[X86] Add computeKnownBits tests for funnel shift intrinsics
Simon Pilgrim [Sun, 16 Dec 2018 12:15:31 +0000 (12:15 +0000)]
[X86] Add computeKnownBits tests for funnel shift intrinsics

llvm-svn: 349297

5 years agoImprove the comment in previous
Kamil Rytarowski [Sun, 16 Dec 2018 10:24:06 +0000 (10:24 +0000)]
Improve the comment in previous

llvm-svn: 349296

5 years agoExpand TSan sysroot workaround to NetBSD
Kamil Rytarowski [Sun, 16 Dec 2018 10:22:30 +0000 (10:22 +0000)]
Expand TSan sysroot workaround to NetBSD

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

llvm-svn: 349295

5 years ago[test] [ctime] Ignore -Wformat-zero-length warnings
Michal Gorny [Sun, 16 Dec 2018 09:18:31 +0000 (09:18 +0000)]
[test] [ctime] Ignore -Wformat-zero-length warnings

Explicitly disable the -Wformat-zero-length diagnostic when running
ctime tests, since one of the test cases passes zero-length format
string to strftime().  When strftime() is appropriately decorated
with __attribute__(format, ...), this caused the test to fail because
of this warning (e.g. on NetBSD).

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

llvm-svn: 349294

5 years ago[regex] Use distinct __regex_word on NetBSD
Michal Gorny [Sun, 16 Dec 2018 09:18:26 +0000 (09:18 +0000)]
[regex] Use distinct __regex_word on NetBSD

NetBSD defines character classes up to 0x2000.  Use 0x8000 as a safe
__regex_word that hopefully will not collide with other values
in the foreseeable future.

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

llvm-svn: 349293