platform/upstream/llvm.git
4 years ago[X86] Improve the AVX512 bailout in combineTruncateWithSat to allow pack instructions...
Craig Topper [Fri, 11 Oct 2019 00:38:51 +0000 (00:38 +0000)]
[X86] Improve the AVX512 bailout in combineTruncateWithSat to allow pack instructions in more situations.

If we don't have VLX we won't end up selecting a saturating
truncate for 256-bit or smaller vectors so we should just use
the pack lowering.

llvm-svn: 374487

4 years ago[X86] Update trunc_packus_v32i32_v32i8 test in min-legal-vector-width.ll to use a...
Craig Topper [Fri, 11 Oct 2019 00:38:41 +0000 (00:38 +0000)]
[X86] Update trunc_packus_v32i32_v32i8 test in min-legal-vector-width.ll to use a load for the large type and add the min-legal-vector-width attribute.

The attribute is needed to avoid zmm registers. Using memory
avoids argument splitting for large vectors.

llvm-svn: 374486

4 years agoMove most CXXRecordDecl::DefinitionData bit-fields out into a separate
Richard Smith [Fri, 11 Oct 2019 00:29:04 +0000 (00:29 +0000)]
Move most CXXRecordDecl::DefinitionData bit-fields out into a separate
file.

Reduces duplication and thereby reduces the risk that someone will
forget to update one of these places, as I did when adding
DefaultedDestructorIsConstexpr (though I've been unable to produce
a testcase for which that matters so far).

llvm-svn: 374484

4 years agoClean up format in cmake file
Haibo Huang [Fri, 11 Oct 2019 00:12:20 +0000 (00:12 +0000)]
Clean up format in cmake file

Summary: Makes the indent consistent to other part of the file.

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 374483

4 years agogn build: Merge r374476
GN Sync Bot [Thu, 10 Oct 2019 23:49:59 +0000 (23:49 +0000)]
gn build: Merge r374476

llvm-svn: 374482

4 years ago[tsan,msan] Insert module constructors in a module pass
Vitaly Buka [Thu, 10 Oct 2019 23:49:10 +0000 (23:49 +0000)]
[tsan,msan] Insert module constructors in a module pass

Summary:
If we insert them from function pass some analysis may be missing or invalid.
Fixes PR42877.

Reviewers: eugenis, leonardchan

Reviewed By: leonardchan

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 374481

4 years ago[msan, NFC] Move option parsing into constructor
Vitaly Buka [Thu, 10 Oct 2019 23:49:07 +0000 (23:49 +0000)]
[msan, NFC] Move option parsing into constructor

llvm-svn: 374480

4 years agoFix compilation warning due to typo.
Michael Liao [Thu, 10 Oct 2019 23:48:56 +0000 (23:48 +0000)]
Fix compilation warning due to typo.

llvm-svn: 374479

4 years ago[tooling] Fix assertion on MacOSX.
Michael Liao [Thu, 10 Oct 2019 23:45:20 +0000 (23:45 +0000)]
[tooling] Fix assertion on MacOSX.

llvm-svn: 374478

4 years ago[JITLink] Add an initial implementation of JITLink for MachO/AArch64.
Lang Hames [Thu, 10 Oct 2019 23:37:51 +0000 (23:37 +0000)]
[JITLink] Add an initial implementation of JITLink for MachO/AArch64.

This implementation has support for all relocation types except TLV.

Compact unwind sections are not yet supported, so exceptions/unwinding will not
work.

llvm-svn: 374476

4 years ago[JITLink] Move MachO/x86 got test further down in the data section.
Lang Hames [Thu, 10 Oct 2019 23:37:49 +0000 (23:37 +0000)]
[JITLink] Move MachO/x86 got test further down in the data section.

'named_data' should be the first symbol in the data section.

llvm-svn: 374475

4 years agodocs/DeveloperPolicy: Add instructions for requesting GitHub commit access
Tom Stellard [Thu, 10 Oct 2019 23:36:06 +0000 (23:36 +0000)]
docs/DeveloperPolicy: Add instructions for requesting GitHub commit access

Subscribers: mehdi_amini, jtony, xbolva00, llvm-commits

Tags: #llvm

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

llvm-svn: 374474

4 years agoChange test case so that it accepts backslashes in file path, in the case that the...
Amy Huang [Thu, 10 Oct 2019 23:35:53 +0000 (23:35 +0000)]
Change test case so that it accepts backslashes in file path, in the case that the test runs on Windows

llvm-svn: 374473

4 years agoFix check-interception link error in compiler-rt debug mode
Reid Kleckner [Thu, 10 Oct 2019 23:30:54 +0000 (23:30 +0000)]
Fix check-interception link error in compiler-rt debug mode

llvm-svn: 374472

4 years ago[MemorySSA] Update Phi simplification.
Alina Sbirlea [Thu, 10 Oct 2019 23:27:21 +0000 (23:27 +0000)]
[MemorySSA] Update Phi simplification.

When simplifying a Phi to the unique value found incoming, check that
there wasn't a Phi already created to break a cycle. If so, remove it.
Resolves PR43541.

Some additional nits included.

llvm-svn: 374471

4 years ago[tooling] Teach Tooling to understand compilation with offloading.
Michael Liao [Thu, 10 Oct 2019 23:05:55 +0000 (23:05 +0000)]
[tooling] Teach Tooling to understand compilation with offloading.

Summary:
- So far, we only recognize the host compilation with offloading and
  skip the offloading part.

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 374470

4 years ago[lldb-test] Remove unused header
Alex Langford [Thu, 10 Oct 2019 22:43:03 +0000 (22:43 +0000)]
[lldb-test] Remove unused header

llvm-svn: 374468

4 years agoFix help message for -ffp-contract
Yaxun Liu [Thu, 10 Oct 2019 22:43:00 +0000 (22:43 +0000)]
Fix help message for -ffp-contract

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

llvm-svn: 374467

4 years agoPR43629: Fix crash evaluating constexpr placement new on a subobject of
Richard Smith [Thu, 10 Oct 2019 22:31:17 +0000 (22:31 +0000)]
PR43629: Fix crash evaluating constexpr placement new on a subobject of
an out-of-lifetime object.

llvm-svn: 374465

4 years ago[GISel] Simplifying return from else in function. NFC
Marcello Maggioni [Thu, 10 Oct 2019 21:51:30 +0000 (21:51 +0000)]
[GISel] Simplifying return from else in function. NFC

Forgot to integrate this little change in previous commit

llvm-svn: 374463

4 years ago[Make] Remove spurious line break
Jonas Devlieghere [Thu, 10 Oct 2019 21:49:25 +0000 (21:49 +0000)]
[Make] Remove spurious line break

This test is disabled upstream and therefore this went unnoticed.

llvm-svn: 374462

4 years ago[test] Reduce inconsistency between lit configuration files.
Jonas Devlieghere [Thu, 10 Oct 2019 21:49:22 +0000 (21:49 +0000)]
[test] Reduce inconsistency between lit configuration files.

Add the Python extension to the configuration files in the API directory
to match the other test suites.

llvm-svn: 374461

4 years ago[X86] Guard against leaving a dangling node in combineTruncateWithSat.
Craig Topper [Thu, 10 Oct 2019 21:46:52 +0000 (21:46 +0000)]
[X86] Guard against leaving a dangling node in combineTruncateWithSat.

When handling the packus pattern for i32->i8 we do a two step
process using a packss to i16 followed by a packus to i8. If the
final i8 step is a type with less than 64-bits the packus step
will return SDValue(), but the i32->i16 step might have succeeded.
This leaves the nodes from the middle step dangling.

Guard against this by pre-checking that the number of elements is
at least 8 before doing the middle step.

With that check in place this should mean the only other
case the middle step itself can fail is when SSE2 is disabled. So
add an early SSE2 check then just assert that neither the middle
or final step ever fail.

llvm-svn: 374460

4 years ago[X86] Add test cases for packus/ssat/usat 32i32->v32i8 test cases. NFC
Craig Topper [Thu, 10 Oct 2019 21:46:44 +0000 (21:46 +0000)]
[X86] Add test cases for packus/ssat/usat 32i32->v32i8 test cases. NFC

llvm-svn: 374459

4 years ago[GISel] Allow getConstantVRegVal() to return G_FCONSTANT values.
Marcello Maggioni [Thu, 10 Oct 2019 21:46:26 +0000 (21:46 +0000)]
[GISel] Allow getConstantVRegVal() to return G_FCONSTANT values.

In GISel we have both G_CONSTANT and G_FCONSTANT, but because
in GISel we don't really have a concept of Float vs Int value
the only difference between the two is where the data originates
from.

What both G_CONSTANT and G_FCONSTANT return is just a bag of bits
with the constant representation in it.

By making getConstantVRegVal() return G_FCONSTANTs bit representation
as well we allow ConstantFold and other things to operate with
G_FCONSTANT.

Adding tests that show ConstantFolding to work on mixed G_CONSTANT
and G_FCONSTANT sources.

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

llvm-svn: 374458

4 years agoFix some errors in <arm_neon.h> tests that cause them to fail with lax
Richard Smith [Thu, 10 Oct 2019 21:40:56 +0000 (21:40 +0000)]
Fix some errors in <arm_neon.h> tests that cause them to fail with lax
vector conversions disabled.

llvm-svn: 374457

4 years agoRevert 374450 "Fix __builtin_assume_aligned with too large values."
Nico Weber [Thu, 10 Oct 2019 21:34:32 +0000 (21:34 +0000)]
Revert 374450 "Fix __builtin_assume_aligned with too large values."

The test fails on Windows, with

  error: 'warning' diagnostics expected but not seen:
    File builtin-assume-aligned.c Line 62: requested alignment
        must be 268435456 bytes or smaller; assumption ignored
  error: 'warning' diagnostics seen but not expected:
    File builtin-assume-aligned.c Line 62: requested alignment
        must be 8192 bytes or smaller; assumption ignored

llvm-svn: 374456

4 years ago[AMDGPU] Handle undef old operand in DPP combine
Stanislav Mekhanoshin [Thu, 10 Oct 2019 21:32:41 +0000 (21:32 +0000)]
[AMDGPU] Handle undef old operand in DPP combine

It was missing an undef flag.

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

llvm-svn: 374455

4 years ago[ValueTracking] Improve pointer offset computation for cases of same base
Rong Xu [Thu, 10 Oct 2019 21:30:43 +0000 (21:30 +0000)]
[ValueTracking] Improve pointer offset computation for cases of same base

This patch improves the handling of pointer offset in GEP expressions where
one argument is the base pointer. isPointerOffset() is being used by memcpyopt
where current code synthesizes consecutive 32 bytes stores to one store and
two memset intrinsic calls. With this patch, we convert the stores to one
memset intrinsic.

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

llvm-svn: 374454

4 years ago[InstCombine] Add test case for PR43617 (NFC)
Evandro Menezes [Thu, 10 Oct 2019 21:29:10 +0000 (21:29 +0000)]
[InstCombine] Add test case for PR43617 (NFC)

Also, refactor check in `LibCallSimplifier::optimizeLog()`.

llvm-svn: 374453

4 years ago[lit] Break main into smaller functions
Julian Lettner [Thu, 10 Oct 2019 21:24:41 +0000 (21:24 +0000)]
[lit] Break main into smaller functions

This change is purely mechanical.  I will do further cleanups of
parameter usages.

Reviewed By: rnk

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

llvm-svn: 374452

4 years agoTestMTCSimple: Make Makefile portable.
Frederic Riss [Thu, 10 Oct 2019 21:21:16 +0000 (21:21 +0000)]
TestMTCSimple: Make Makefile portable.

r374262 left out the Makefile changes needed to cross compile this test.

llvm-svn: 374451

4 years agoFix __builtin_assume_aligned with too large values.
Erich Keane [Thu, 10 Oct 2019 21:08:28 +0000 (21:08 +0000)]
Fix __builtin_assume_aligned with too large values.

Code to handle __builtin_assume_aligned was allowing larger values, but
would convert this to unsigned along the way. This patch removes the
EmitAssumeAligned overloads that take unsigned to do away with this
problem.

Additionally, it adds a warning that values greater than 1 <<29 are
ignored by LLVM.

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

llvm-svn: 374450

4 years agoAdd -fgnuc-version= to control __GNUC__ and other GCC macros
Reid Kleckner [Thu, 10 Oct 2019 21:04:25 +0000 (21:04 +0000)]
Add -fgnuc-version= to control __GNUC__ and other GCC macros

I noticed that compiling on Windows with -fno-ms-compatibility had the
side effect of defining __GNUC__, along with __GNUG__, __GXX_RTTI__, and
a number of other macros for GCC compatibility. This is undesirable and
causes Chromium to do things like mix __attribute__ and __declspec,
which doesn't work. We should have a positive language option to enable
GCC compatibility features so that we can experiment with
-fno-ms-compatibility on Windows. This change adds -fgnuc-version= to be
that option.

My issue aside, users have, for a long time, reported that __GNUC__
doesn't match their expectations in one way or another. We have
encouraged users to migrate code away from this macro, but new code
continues to be written assuming a GCC-only environment. There's really
nothing we can do to stop that. By adding this flag, we can allow them
to choose their own adventure with __GNUC__.

This overlaps a bit with the "GNUMode" language option from -std=gnu*.
The gnu language mode tends to enable non-conforming behaviors that we'd
rather not enable by default, but the we want to set things like
__GXX_RTTI__ by default, so I've kept these separate.

Helps address PR42817

Reviewed By: hans, nickdesaulniers, MaskRay

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

llvm-svn: 374449

4 years agoAdd a missing include in test.
Evgeniy Stepanov [Thu, 10 Oct 2019 20:47:22 +0000 (20:47 +0000)]
Add a missing include in test.

A fix for r373993.

llvm-svn: 374448

4 years ago[MemorySSA] Additional handling of unreachable blocks.
Alina Sbirlea [Thu, 10 Oct 2019 20:43:06 +0000 (20:43 +0000)]
[MemorySSA] Additional handling of unreachable blocks.

Summary:
Whenever we get the previous definition, the assumption is that the
recursion starts ina  reachable block.
If the recursion starts in an unreachable block, we may recurse
indefinitely. Handle this case by returning LoE if the block is
unreachable.

Resolves PR43426.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 374447

4 years ago[System Model] [TTI] Move default cache/prefetch implementations
David Greene [Thu, 10 Oct 2019 20:39:27 +0000 (20:39 +0000)]
[System Model] [TTI] Move default cache/prefetch implementations

Move the default implementations of cache and prefetch queries to
TargetTransformInfoImplBase and delete them from NoTIIImpl.  This brings these
interfaces in line with how other TTI interfaces work.

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

llvm-svn: 374446

4 years agoFix a documentation warning from GSYM commit.
Greg Clayton [Thu, 10 Oct 2019 20:29:11 +0000 (20:29 +0000)]
Fix a documentation warning from GSYM commit.

llvm-svn: 374445

4 years agoFix process launch failure on FreeBSD after r365761
Dimitry Andric [Thu, 10 Oct 2019 20:26:59 +0000 (20:26 +0000)]
Fix process launch failure on FreeBSD after r365761

Summary:
After rLLDB365761, and with `LLVM_ENABLE_ABI_BREAKING_CHECKS` enabled,
launching any process on FreeBSD crashes lldb with:

```
Expected<T> must be checked before access or destruction.
Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).
```

This is because `m_operation_thread` and `m_monitor_thread` were wrapped
in `llvm::Expected<>`, but this requires the objects to be correctly
initialized before accessing them.

To fix the crashes, use `llvm::Optional<>` for the members (as indicated
by labath), and use local variables to store the return values of
`LaunchThread` and `StartMonitoringChildProcess`.  Then, only assign to
the member variables after checking if the return values indicated
success.

Reviewers: devnexen, emaste, MaskRay, mgorny

Reviewed By: devnexen

Subscribers: jfb, labath, krytarowski, lldb-commits

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

llvm-svn: 374444

4 years ago[MSVC] Automatically add atlmfc folder to include and libpath.
Zachary Turner [Thu, 10 Oct 2019 20:25:54 +0000 (20:25 +0000)]
[MSVC] Automatically add atlmfc folder to include and libpath.

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

llvm-svn: 374443

4 years ago[PDB] Fix bug when using multiple PCH header objects with the same name.
Zachary Turner [Thu, 10 Oct 2019 20:25:51 +0000 (20:25 +0000)]
[PDB] Fix bug when using multiple PCH header objects with the same name.

A common pattern in Windows is to have all your precompiled headers
use an object named stdafx.obj.  If you've got a project with many
different static libs, you might use a separate PCH for each one of
these.

During the final link step, a file from A might reference the PCH
object from A, but it will have the same name (stdafx.obj) as any
other PCH from another project.  The only difference will be the
path.  For example, A might be A/stdafx.obj while B is B/stdafx.obj.

The existing algorithm checks only the filename that was passed on
the command line (or stored in archive), but this is insufficient in
the case where relative paths are used, because depending on the
command line object file / library order, it might find the wrong
PCH object first resulting in a signature mismatch.

The fix here is to simply check whether the absolute path of the
PCH object (which is stored in the input obj file for the file that
references the PCH) *ends with* the full relative path of whatever
is specified on the command line (or is in the archive).

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

llvm-svn: 374442

4 years ago[lit] Add comment explaining the LIT_OPTS env var overrides command line options
Julian Lettner [Thu, 10 Oct 2019 20:23:28 +0000 (20:23 +0000)]
[lit] Add comment explaining the LIT_OPTS env var overrides command line options

Normally, command line options override environment variables.  Add
comment to state that we are doing the reverse on purpose.

llvm-svn: 374441

4 years agoADT: Save a word in every StringSet entry
Jordan Rose [Thu, 10 Oct 2019 20:22:53 +0000 (20:22 +0000)]
ADT: Save a word in every StringSet entry

Add a specialization to StringMap (actually StringMapEntry) for a
value type of NoneType (the type of llvm::None), and use it for
StringSet. This'll save us a word from every entry in a StringSet,
used for alignment with the size_t that stores the string length.

I could have gone all the way to some kind of empty base class
optimization, but that seemed like overkill. Someone can consider
adding that in the future, though.

https://reviews.llvm.org/D68586

llvm-svn: 374440

4 years ago[ScanDeps] clang-format, 80 cols.
Michael J. Spencer [Thu, 10 Oct 2019 20:19:02 +0000 (20:19 +0000)]
[ScanDeps] clang-format, 80 cols.

llvm-svn: 374439

4 years ago[OPENMP]Update doc for supported constructs, NFC.
Alexey Bataev [Thu, 10 Oct 2019 20:15:54 +0000 (20:15 +0000)]
[OPENMP]Update doc for supported constructs, NFC.

llvm-svn: 374438

4 years ago[OPENMP50]Support for 'master taskloop' directive.
Alexey Bataev [Thu, 10 Oct 2019 20:13:02 +0000 (20:13 +0000)]
[OPENMP50]Support for 'master taskloop' directive.

Added full support for master taskloop directive.

llvm-svn: 374437

4 years ago[x86] reduce duplicate test assertions; NFC
Sanjay Patel [Thu, 10 Oct 2019 19:52:27 +0000 (19:52 +0000)]
[x86] reduce duplicate test assertions; NFC

llvm-svn: 374436

4 years ago[test] Add timeout to API tests.
Jonas Devlieghere [Thu, 10 Oct 2019 19:51:50 +0000 (19:51 +0000)]
[test] Add timeout to API tests.

Before the reorganiziation, the API tests were inheriting the timeout
from the top-level lit file. Now that this is no longer the case, the
lldb-api test suite needs to set its own timeout.

llvm-svn: 374435

4 years ago[test] Cleanup top-level lit.cfg.py
Jonas Devlieghere [Thu, 10 Oct 2019 19:51:47 +0000 (19:51 +0000)]
[test] Cleanup top-level lit.cfg.py

llvm-svn: 374434

4 years ago[lit] Bring back `--threads` option alias
Julian Lettner [Thu, 10 Oct 2019 19:43:57 +0000 (19:43 +0000)]
[lit] Bring back `--threads` option alias

Bring back `--threads` option which was lost in the move of the
command line argument parsing code to cl_arguments.py.  Update docs
since `--workers` is preferred.

llvm-svn: 374432

4 years ago[X86] Use packusdw+vpmovuswb to implement v16i32->V16i8 that clamps signed inputs...
Craig Topper [Thu, 10 Oct 2019 19:40:44 +0000 (19:40 +0000)]
[X86] Use packusdw+vpmovuswb to implement v16i32->V16i8 that clamps signed inputs to be between 0 and 255 when zmm registers are disabled on SKX.

If we've disable zmm registers, the v16i32 will need to be split. This split will propagate through min/max the truncate. This creates two sequences that need to be concatenated back to v16i8. We can instead use packusdw to do part of the clamping, truncating, and concatenating all at once. Then we can use a vpmovuswb to finish off the clamp.

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

llvm-svn: 374431

4 years ago[Docs] Update testing documentaton
Jonas Devlieghere [Thu, 10 Oct 2019 19:35:20 +0000 (19:35 +0000)]
[Docs] Update testing documentaton

Update the test documentation after the directory reorganization.

llvm-svn: 374430

4 years agoRevert r374388: "[lit] Make internal diff work in pipelines"
Joel E. Denny [Thu, 10 Oct 2019 19:25:39 +0000 (19:25 +0000)]
Revert r374388: "[lit] Make internal diff work in pipelines"

This breaks a Windows bot.

llvm-svn: 374429

4 years ago[PowerPC][docs] Update IBM official docs in Compiler Writers Info page
Jinsong Ji [Thu, 10 Oct 2019 19:25:30 +0000 (19:25 +0000)]
[PowerPC][docs] Update IBM official docs in Compiler Writers Info page

Summary:
Just realized that most of the links in this page are deprecated.
So update some important reference here:
* adding PowerISA 3.0B/2.7B
* adding P8/P9 User Manual
* ELFv2 ABI and errata

Move deprecated ones into "Other documents..".

Reviewers: #powerpc, hfinkel, nemanjai

Reviewed By: hfinkel

Subscribers: shchenz, llvm-commits

Tags: #llvm

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

llvm-svn: 374428

4 years agoRevert r374389: "[lit] Clean up internal diff's encoding handling"
Joel E. Denny [Thu, 10 Oct 2019 19:25:24 +0000 (19:25 +0000)]
Revert r374389: "[lit] Clean up internal diff's encoding handling"

This breaks a Windows bot.

llvm-svn: 374427

4 years agoRevert r374390: "[lit] Extend internal diff to support `-` argument"
Joel E. Denny [Thu, 10 Oct 2019 19:25:11 +0000 (19:25 +0000)]
Revert r374390: "[lit] Extend internal diff to support `-` argument"

This breaks a Windows bot.

llvm-svn: 374426

4 years agoRevert r374392: "[lit] Extend internal diff to support -U"
Joel E. Denny [Thu, 10 Oct 2019 19:24:57 +0000 (19:24 +0000)]
Revert r374392: "[lit] Extend internal diff to support -U"

This breaks a Windows bot.

llvm-svn: 374425

4 years agoupdate TestRunCommandInterpreterAPI to use SBFile
Lawrence D'Anna [Thu, 10 Oct 2019 19:24:07 +0000 (19:24 +0000)]
update TestRunCommandInterpreterAPI to use SBFile

Summary:
If you look at what this test is doing, it's actually quite
mysterious why it works at all.   It sets the input file
inside a "with open".   As soon as the with block ends,
that file will be closed.   And yet somehow LLDB reads
commands from it anyway.    What's actually happening is that
the file descriptor gets dup'd when something inside LLDB
calls File::GetStream().   I think it's fair to say that
what this test is doing is illegal and it has no right
to expect it to work.

This patch updates the test with two cases.  One uses
the SBFile api, and actually transfers ownership of
the original file descriptor to the debugger.   The other
just uses the old FILE* API, but in a sane way.

I also set NO_DEBUG_INFO_TESTCASE, because this test doesn't
use any debug info and doesn't need to run three times.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: aprantl, lldb-commits

Tags: #lldb

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

llvm-svn: 374424

4 years agoupdate SBDebugger::SetInputFile() etc to work on native Files
Lawrence D'Anna [Thu, 10 Oct 2019 19:10:59 +0000 (19:10 +0000)]
update SBDebugger::SetInputFile() etc to work on native Files

Summary:
This patch adds FileSP versions of SetInputFile(),
SetOutputFile, and SetErrorFile().   SWIG will convert native
python file objects into FileSP.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: clayborg, lldb-commits

Tags: #lldb

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

llvm-svn: 374422

4 years agowin: Move Parallel.h off concrt to cross-platform code
Nico Weber [Thu, 10 Oct 2019 18:57:23 +0000 (18:57 +0000)]
win: Move Parallel.h off concrt to cross-platform code

r179397 added Parallel.h and implemented it terms of concrt in 2013.

In 2015, a cross-platform implementation of the functions has appeared
and is in use everywhere but on Windows (r232419).  r246219 hints that
<thread> had issues in MSVC2013, but r296906 suggests they've been fixed
now that we require 2015+.

So remove the concrt code. It's less code, and it sounds like concrt has
conceptual and performance issues, see PR41198.

I built blink_core.dll in a debug component build with full symbols and
in a release component build without any symbols.  I couldn't measure a
performance difference for linking blink_core.dll before and after this
patch.

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

llvm-svn: 374421

4 years ago[NFC][PowerPC]Clean up PPCAsmPrinter for TOC related pseudo opcode
Xiangling Liao [Thu, 10 Oct 2019 18:56:42 +0000 (18:56 +0000)]
[NFC][PowerPC]Clean up PPCAsmPrinter for TOC related pseudo opcode

Add a helper function getMCSymbolForTOCPseudoMO to clean up PPCAsmPrinter
a little bit.

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

llvm-svn: 374420

4 years ago[ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 2.
Eli Friedman [Thu, 10 Oct 2019 18:45:34 +0000 (18:45 +0000)]
[ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 2.

Just running -fsyntax-only over arm_neon.h doesn't cover some intrinsics
which are defined using macros.  Add more test coverage for that.

arm-neon-header.c wasn't checking the full set of available NEON target
features; change the target architecture of the test to account for
that.

Fix the generator for arm_neon.h to generate casts in more cases where
they are necessary.

Fix VFMLAL_LOW etc. to express their signatures differently, so the
builtins have the expected type. Maybe the TableGen backend should
detect intrinsics that are defined the wrong way, and produce an error.
The rules here are sort of strange.

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

llvm-svn: 374419

4 years agoFix one more clang test which didn't have \5C in it
Reid Kleckner [Thu, 10 Oct 2019 18:42:06 +0000 (18:42 +0000)]
Fix one more clang test which didn't have \5C in it

llvm-svn: 374418

4 years agoTestFileHandle.py: fix for Python 3.6
Lawrence D'Anna [Thu, 10 Oct 2019 18:38:23 +0000 (18:38 +0000)]
TestFileHandle.py: fix for Python 3.6

Summary:
Python 3.6 stringifies exceptions as `ExceptionClass("foo",)` instead
of `ExceptionClass("foo")`.   This patch makes the test assertions a
little more flexible so the test passes anyway.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374417

4 years agoUpdate clang tests for new LLVM IR backslash printing in r374415
Reid Kleckner [Thu, 10 Oct 2019 18:36:41 +0000 (18:36 +0000)]
Update clang tests for new LLVM IR backslash printing in r374415

llvm-svn: 374416

4 years agoPrint quoted backslashes in LLVM IR as \\ instead of \5C
Reid Kleckner [Thu, 10 Oct 2019 18:31:57 +0000 (18:31 +0000)]
Print quoted backslashes in LLVM IR as \\ instead of \5C

This improves readability of Windows path string literals in LLVM IR.
The LLVM assembler has supported \\ in IR strings for a long time, but
the lexer doesn't tolerate escaped quotes, so they have to be printed as
\22 for now.

llvm-svn: 374415

4 years agoRemove merge marker :-)
Adrian Prantl [Thu, 10 Oct 2019 18:30:47 +0000 (18:30 +0000)]
Remove merge marker :-)

llvm-svn: 374414

4 years agoFix Windows build after r374381
Nico Weber [Thu, 10 Oct 2019 18:20:16 +0000 (18:20 +0000)]
Fix Windows build after r374381

llvm-svn: 374413

4 years agoDie, TABS, die, die, die, die...
Jim Ingham [Thu, 10 Oct 2019 18:19:27 +0000 (18:19 +0000)]
Die, TABS, die, die, die, die...

Not sure how tabs got into this file, but they don't belong there.

llvm-svn: 374412

4 years agoRemove strings.h include to fix GSYM Windows build
Reid Kleckner [Thu, 10 Oct 2019 18:17:24 +0000 (18:17 +0000)]
Remove strings.h include to fix GSYM Windows build

Fifth time's the charm.

llvm-svn: 374411

4 years agoUnbreak buildbots.
Greg Clayton [Thu, 10 Oct 2019 18:13:13 +0000 (18:13 +0000)]
Unbreak buildbots.

llvm-svn: 374410

4 years agoFix buildbots by using memset instead of bzero.
Greg Clayton [Thu, 10 Oct 2019 18:11:49 +0000 (18:11 +0000)]
Fix buildbots by using memset instead of bzero.

llvm-svn: 374409

4 years ago[libc++][test] Change IsSmallObject's calculation for std::any's small object buffer
Casey Carter [Thu, 10 Oct 2019 18:07:12 +0000 (18:07 +0000)]
[libc++][test] Change IsSmallObject's calculation for std::any's small object buffer

`sizeof(std::any) - sizeof(void*)` is correct for both libc++ and the MSVC standard library.

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

llvm-svn: 374407

4 years agoFix build by adding the missing dependency.
Michael Liao [Thu, 10 Oct 2019 18:04:52 +0000 (18:04 +0000)]
Fix build by adding the missing dependency.

llvm-svn: 374406

4 years ago[lit] Leverage argparse features to remove some code
Julian Lettner [Thu, 10 Oct 2019 18:03:37 +0000 (18:03 +0000)]
[lit] Leverage argparse features to remove some code

Reviewed By: rnk, serge-sans-paille

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

llvm-svn: 374405

4 years agoFix test to avoid check-not matching the temp file absolute path
Reid Kleckner [Thu, 10 Oct 2019 18:01:27 +0000 (18:01 +0000)]
Fix test to avoid check-not matching the temp file absolute path

Fix for PR43636

llvm-svn: 374404

4 years agoRe-land "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"
Reid Kleckner [Thu, 10 Oct 2019 18:01:20 +0000 (18:01 +0000)]
Re-land "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"

This reverts r374324 (git commit 62808631acceaa8b78f8ab9b407eb6b943ff5f77)

I changed the test to not rely on finding the sequence "clang, test,
CoverageMapping" in the CWD used to run the test. Instead it makes its
own internal directory hierarchy of foo/bar/baz and looks for that.

llvm-svn: 374403

4 years agoRemove CC autodetection from Makefile.rules
Adrian Prantl [Thu, 10 Oct 2019 17:59:18 +0000 (17:59 +0000)]
Remove CC autodetection from Makefile.rules

Auto-detecting CC in Makefile.rules is no longer useful. Ever since
out-of-tree builds we are better off just running lldb-dotest which
sets it directly. This also makes it harder to accidentally unset CC
in a Makefile.

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

llvm-svn: 374402

4 years agoSpeed up accelerator table lookups
Adrian Prantl [Thu, 10 Oct 2019 17:59:15 +0000 (17:59 +0000)]
Speed up accelerator table lookups

When debugging a large program like clang and doing "frame variable
*this", the ValueObject pretty printer is doing hundreds of scoped
FindTypes lookups. The ones that take longest are the ones where the
DWARFDeclContext ends in something like ::Iterator which produces many
false positives that need to be filtered out *after* extracting the
DIEs. This patch demonstrates a way to filter out false positives at
the accerator table lookup step.

With this patch
  lldb clang-10 -o "b EmitFunctionStart" -o r -o "f 2" -o "fr v *this" -b -- ...
goes (in user time) from 5.6s -> 4.8s
or (in wall clock) from 6.9s -> 6.0s.

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

llvm-svn: 374401

4 years ago[lit] Move argument parsing/validation to separate file
Julian Lettner [Thu, 10 Oct 2019 17:58:38 +0000 (17:58 +0000)]
[lit] Move argument parsing/validation to separate file

Reviewed By: serge-sans-paille

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

llvm-svn: 374400

4 years ago[clang-format] throws an incorrect assertion in consumeToken() formatting the MSVC stl
Paul Hoad [Thu, 10 Oct 2019 17:54:47 +0000 (17:54 +0000)]
[clang-format] throws an incorrect assertion in consumeToken() formatting the MSVC stl

Summary:
An incorrect assertion is thrown when clang-formatting MSVC's STL library

```
Assertion failed: !Line.startsWith(tok::hash), file C:/llvm/llvm-project/clang/lib/Format/TokenAnnotator.cpp, line 847
Stack dump:
0.      Program arguments: C:\llvm\build\bin\clang-format.exe -i -n ./stl/inc/xkeycheck.h
```

```
Enable warning C4005 to find the forbidden define.
```

Reviewers: mitchell-stellar, STL_MSFT, klimek, krasimir

Reviewed By: mitchell-stellar

Subscribers: cfe-commits

Tags: #clang-format, #clang-tools-extra, #clang

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

llvm-svn: 374399

4 years agoUnbreak llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast buildbot.
Greg Clayton [Thu, 10 Oct 2019 17:52:33 +0000 (17:52 +0000)]
Unbreak  llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast buildbot.

llvm-svn: 374398

4 years ago[DAGCombiner] fold select-of-constants to shift
Sanjay Patel [Thu, 10 Oct 2019 17:52:02 +0000 (17:52 +0000)]
[DAGCombiner] fold select-of-constants to shift

This reverses the scalar canonicalization proposed in D63382.

Pre: isPowerOf2(C1)
%r = select i1 %cond, i32 C1, i32 0
=>
%z = zext i1 %cond to i32
%r = shl i32 %z, log2(C1)

https://rise4fun.com/Alive/Z50

x86 already tries to fold this pattern, but it isn't done
uniformly, so we still see a diff. AArch64 probably should
enable the TLI hook to benefit too, but that's a follow-on.

llvm-svn: 374397

4 years agoUnbreak windows buildbots.
Greg Clayton [Thu, 10 Oct 2019 17:49:33 +0000 (17:49 +0000)]
Unbreak windows buildbots.

llvm-svn: 374396

4 years agogn build: restore tablegen restat optimization after r373664
Nico Weber [Thu, 10 Oct 2019 17:47:18 +0000 (17:47 +0000)]
gn build: restore tablegen restat optimization after r373664

llvm-svn: 374395

4 years agoImplement serializing scripted breakpoints and their extra args.
Jim Ingham [Thu, 10 Oct 2019 17:44:50 +0000 (17:44 +0000)]
Implement serializing scripted breakpoints and their extra args.

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

llvm-svn: 374394

4 years ago[lit] Extend internal diff to support -U
Joel E. Denny [Thu, 10 Oct 2019 17:40:12 +0000 (17:40 +0000)]
[lit] Extend internal diff to support -U

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff -U1 file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-U` as a command-line option.  This patch adds `-U`
support.

Reviewed By: rnk

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

llvm-svn: 374392

4 years agogn build: merge r374381 more (effectively a no-op)
Nico Weber [Thu, 10 Oct 2019 17:40:00 +0000 (17:40 +0000)]
gn build: merge r374381 more (effectively a no-op)

llvm-svn: 374391

4 years ago[lit] Extend internal diff to support `-` argument
Joel E. Denny [Thu, 10 Oct 2019 17:39:57 +0000 (17:39 +0000)]
[lit] Extend internal diff to support `-` argument

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-` as a command-line option.  This patch adds support for
`-` to mean stdin.

Reviewed By: probinson, rnk

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

llvm-svn: 374390

4 years ago[lit] Clean up internal diff's encoding handling
Joel E. Denny [Thu, 10 Oct 2019 17:39:41 +0000 (17:39 +0000)]
[lit] Clean up internal diff's encoding handling

As suggested by rnk at D67643#1673043, instead of reading files
multiple times until an appropriate encoding is found, read them once
as binary, and then try to decode what was read.

For python >= 3.5, don't fail when attempting to decode the
`diff_bytes` output in order to print it.

Finally, add some tests for encoding handling.

Reviewed By: rnk

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

llvm-svn: 374389

4 years ago[lit] Make internal diff work in pipelines
Joel E. Denny [Thu, 10 Oct 2019 17:39:24 +0000 (17:39 +0000)]
[lit] Make internal diff work in pipelines

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
 # RUN: not diff file1 file2 | FileCheck %s
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Reviewed By: probinson, stella.stamenova

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

llvm-svn: 374388

4 years ago[OPENMP50]Support for declare variant directive for NVPTX target.
Alexey Bataev [Thu, 10 Oct 2019 17:28:10 +0000 (17:28 +0000)]
[OPENMP50]Support for declare variant directive for NVPTX target.

NVPTX does not support global aliases. Instead, we have to copy the full
body of the variant function for the original function.

llvm-svn: 374387

4 years ago[test] Use a different module cache for Shell and API tests.
Jonas Devlieghere [Thu, 10 Oct 2019 17:27:09 +0000 (17:27 +0000)]
[test] Use a different module cache for Shell and API tests.

Before the test reorganization, everything was part of a single test
suite with a single module cache. Now that things are properly separated
this is no longer the case. Only the shell tests inherited the logic to
properly configure and wipe the module caches. This patch adds that
logic back for the API tests. While doing so, I noticed that we were
configuring a Clang module cache in CMake, but weren't actually using it
from dotest.py. I included a fix for that in this patch as well.

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

llvm-svn: 374386

4 years ago[test] Pass DSYMUTIL and SDKROOT as part of the Make invocation.
Jonas Devlieghere [Thu, 10 Oct 2019 17:27:06 +0000 (17:27 +0000)]
[test] Pass DSYMUTIL and SDKROOT as part of the Make invocation.

Pass the DSYMUTIL and SDKROOT variables on the command line instead of
the environment. This makes it easier to reproduce the make invocation
during development.

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

llvm-svn: 374385

4 years agoReland "[ASan] Do not misrepresent high value address dereferences as null dereferences"
Julian Lettner [Thu, 10 Oct 2019 17:19:58 +0000 (17:19 +0000)]
Reland "[ASan] Do not misrepresent high value address dereferences as null dereferences"

Updated: Removed offending TODO comment.

Dereferences with addresses above the 48-bit hardware addressable range
produce "invalid instruction" (instead of "invalid access") hardware
exceptions (there is no hardware address decoding logic for those bits),
and the address provided by this exception is the address of the
instruction (not the faulting address).  The kernel maps the "invalid
instruction" to SEGV, but fails to provide the real fault address.

Because of this ASan lies and says that those cases are null
dereferences.  This downgrades the severity of a found bug in terms of
security.  In the ASan signal handler, we can not provide the real
faulting address, but at least we can try not to lie.

rdar://50366151

Reviewed By: vitalybuka

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

> llvm-svn: 374265

llvm-svn: 374384

4 years agogn build: Merge r374381
GN Sync Bot [Thu, 10 Oct 2019 17:14:20 +0000 (17:14 +0000)]
gn build: Merge r374381

llvm-svn: 374383

4 years ago[test] Trim the symbtab test case (NFC)
Jonas Devlieghere [Thu, 10 Oct 2019 17:12:57 +0000 (17:12 +0000)]
[test] Trim the symbtab test case (NFC)

We don't actually need the section content for this tests.

llvm-svn: 374382

4 years agoAdd GsymCreator and GsymReader.
Greg Clayton [Thu, 10 Oct 2019 17:10:11 +0000 (17:10 +0000)]
Add GsymCreator and GsymReader.

This patch adds the ability to create GSYM files with GsymCreator, and read them with GsymReader. Full testing has been added for both new classes.

This patch differs from the original patch https://reviews.llvm.org/D53379 in that is uses a StringTableBuilder class from llvm instead of a custom version. Support for big and little endian files has been added. If the endianness matches the current host, we use efficient extraction for the header, address table and address info offset tables.

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

llvm-svn: 374381

4 years ago[dsymutil] Move CommonSymbols.clear() in resetParserState.
Jonas Devlieghere [Thu, 10 Oct 2019 16:37:38 +0000 (16:37 +0000)]
[dsymutil] Move CommonSymbols.clear() in resetParserState.

This seems like a more natural place to clear the vector, especially
since this method is clearing other data structures as well.

llvm-svn: 374378

4 years ago[ARM] VQSUB instruction
David Green [Thu, 10 Oct 2019 16:34:30 +0000 (16:34 +0000)]
[ARM] VQSUB instruction

Same as VQADD, VQSUB can be selected from llvm.ssub.sat intrinsics.

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

llvm-svn: 374377