platform/upstream/llvm.git
5 years ago[llvm-exegesis] Show noise cluster in analysis output.
Clement Courbet [Fri, 11 Oct 2019 11:33:18 +0000 (11:33 +0000)]
[llvm-exegesis] Show noise cluster in analysis output.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 374533

5 years agominidump: Use llvm memory info list parser
Pavel Labath [Fri, 11 Oct 2019 11:23:40 +0000 (11:23 +0000)]
minidump: Use llvm memory info list parser

llvm-svn: 374532

5 years agoProcessInstanceInfoMatch: Don't match processes with no name if a name match was...
Pavel Labath [Fri, 11 Oct 2019 10:56:54 +0000 (10:56 +0000)]
ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested, take 2

Summary:
The previous attempt at making nameless process not match when searching for a
given name failed because the macos implementation was depending on this detail
in its partial matching strategy. Doing partial matching to avoid expensive
lookups is a perfectly valid thing to do, the way it was implemented seems
somewhat unexpected.

This patch implements it differently by providing special
methods in the ProcessInstanceInfoMatch which match only a subset of fields,
and changes mac host code to use those instead.

Then, it re-applies r373925 to get make the ProcessInstanceInfoMatch with a
name *not* match a nameless process.

Reviewers: JDevlieghere, teemperor, jingham

Subscribers: wallace, lldb-commits

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

llvm-svn: 374529

5 years ago[Windows] Use information from the PE32 exceptions directory to construct unwind...
Aleksandr Urakov [Fri, 11 Oct 2019 09:03:29 +0000 (09:03 +0000)]
[Windows] Use information from the PE32 exceptions directory to construct unwind plans

This patch adds an implementation of unwinding using PE EH info. It allows to
get almost ideal call stacks on 64-bit Windows systems (except some epilogue
cases, but I believe that they can be fixed with unwind plan disassembly
augmentation in the future).

To achieve the goal the CallFrameInfo abstraction was made. It is based on the
DWARFCallFrameInfo class interface with a few changes to make it less
DWARF-specific.

To implement the new interface for PECOFF object files the class PECallFrameInfo
was written. It uses the next helper classes:

- UnwindCodesIterator helps to iterate through UnwindCode structures (and
  processes chained infos transparently);
- EHProgramBuilder with the use of UnwindCodesIterator constructs EHProgram;
- EHProgram is, by fact, a vector of EHInstructions. It creates an abstraction
  over the low-level unwind codes and simplifies work with them. It contains
  only the information that is relevant to unwinding in the unified form. Also
  the required unwind codes are read from the object file only once with it;
- EHProgramRange allows to take a range of EHProgram and to build an unwind row
  for it.

So, PECallFrameInfo builds the EHProgram with EHProgramBuilder, takes the ranges
corresponding to every offset in prologue and builds the rows of the resulted
unwind plan. The resulted plan covers the whole range of the function except the
epilogue.

Reviewers: jasonmolenda, asmith, amccarth, clayborg, JDevlieghere, stella.stamenova, labath, espindola

Reviewed By: jasonmolenda

Subscribers: leonid.mashinskiy, emaste, mgorny, aprantl, arichardson, MaskRay, lldb-commits, llvm-commits

Tags: #lldb

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

llvm-svn: 374528

5 years agoInsert module constructors in a module pass
Vitaly Buka [Fri, 11 Oct 2019 08:47:03 +0000 (08:47 +0000)]
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
Signed-off-by: Vitaly Buka <vitalybuka@google.com>
llvm-svn: 374527

5 years ago[LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on Windows
Martin Storsjo [Fri, 11 Oct 2019 08:44:51 +0000 (08:44 +0000)]
[LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on Windows

This avoids the currently MSVC specific codepath of using the
wchar entry point and converting that to utf8.

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

llvm-svn: 374526

5 years ago[lldb] Fix crash in CxxModuleHandler when std module is empty
Raphael Isemann [Fri, 11 Oct 2019 08:42:22 +0000 (08:42 +0000)]
[lldb] Fix crash in CxxModuleHandler when std module is empty

We currently don't handle the error in the Expected we get
when searching for an equal local DeclContext. Usually this can't
happen as this would require that we have a STL container and
we can find libc++'s std module, but when we load the module in
the expression parser the module doesn't even contain the 'std'
namespace. The only way I see to test this is by having a fake
'std' module that requires a special define to actually provide
its contents, while it will just be empty (that is, it doesn't
even contain the 'std' namespace) without that define. LLDB currently
doesn't know about that define in the expression parser, so it
will load the wrong 'empty' module which should trigger this error.

Also removed the 'auto' for that variable as the function name
doesn't make it obvious that this is an expected and not just
a optional/ptr (which is how this slipped in from the start).

llvm-svn: 374525

5 years ago[TableGen] Fix a bug that MCSchedClassDesc is interfered between different SchedModel
QingShan Zhang [Fri, 11 Oct 2019 08:36:54 +0000 (08:36 +0000)]
[TableGen] Fix a bug that MCSchedClassDesc is interfered between different SchedModel

Assume that, ModelA has scheduling resource for InstA and ModelB has scheduling resource for InstB. This is what the llvm::MCSchedClassDesc looks like:

llvm::MCSchedClassDesc ModelASchedClasses[] = {
...
InstA, 0, ...
InstB, -1,...
};

llvm::MCSchedClassDesc ModelBSchedClasses[] = {
...
InstA, -1,...
InstB, 0,...
};
The -1 means invalid num of macro ops, while it is valid if it is >=0. This is what we look like now:

llvm::MCSchedClassDesc ModelASchedClasses[] = {
...
InstA, 0, ...
InstB, 0,...
};

llvm::MCSchedClassDesc ModelBSchedClasses[] = {
...
InstA, 0,...
InstB, 0,...
};
And compiler hit the assertion here because the SCDesc is valid now for both InstA and InstB.

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

llvm-svn: 374524

5 years ago[X86] Add v8i64->v8i8 ssat/usat/packus truncate tests to min-legal-vector-width.ll
Craig Topper [Fri, 11 Oct 2019 07:24:36 +0000 (07:24 +0000)]
[X86] Add v8i64->v8i8 ssat/usat/packus truncate tests to min-legal-vector-width.ll

I wonder if we should split the v8i8 stores in order to form
two v4i8 saturating truncating stores. This would remove the
unpckl needed to concatenated the v4i8 results to make a
single store.

llvm-svn: 374519

5 years ago[ADT][Statistics] Fix test after rL374490
Kadir Cetinkaya [Fri, 11 Oct 2019 07:19:54 +0000 (07:19 +0000)]
[ADT][Statistics] Fix test after rL374490

llvm-svn: 374518

5 years agoFix modules build for r374337
Pavel Labath [Fri, 11 Oct 2019 07:16:19 +0000 (07:16 +0000)]
Fix modules build for r374337

A modules build failed with the following error:
  call to function 'operator&' that is neither visible in the template definition nor found by argument-dependent lookup

Fix that by declaring the appropriate operators in the llvm::minidump
namespace.

llvm-svn: 374517

5 years ago[X86] Always define the tzcnt intrinsics even when _MSC_VER is defined.
Craig Topper [Fri, 11 Oct 2019 06:07:53 +0000 (06:07 +0000)]
[X86] Always define the tzcnt intrinsics even when _MSC_VER is defined.

These intrinsics use llvm.cttz intrinsics so are always available
even without the bmi feature. We already don't check for the bmi
feature on the intrinsics themselves. But we were blocking the
include of the header file with _MSC_VER unless BMI was enabled
on the command line.

Fixes PR30506.

llvm-svn: 374516

5 years ago[PowerPC] Remove assertion "Shouldn't overwrite a register before it is killed"
Yi-Hong Lyu [Fri, 11 Oct 2019 05:32:29 +0000 (05:32 +0000)]
[PowerPC] Remove assertion "Shouldn't overwrite a register before it is killed"

The assertion is everzealous and fail tests like:

  renamable $x3 = LI8 0
  STD renamable $x3, 16, $x1
  renamable $x3 = LI8 0

Remove the assertion since killed flag of $x3 is not mandentory.

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

llvm-svn: 374515

5 years ago[NFC] run specific pass instead of whole -O3 pipeline for popcount recoginzation...
Chen Zheng [Fri, 11 Oct 2019 05:30:18 +0000 (05:30 +0000)]
[NFC] run specific pass instead of whole -O3 pipeline for popcount recoginzation testcase.

llvm-svn: 374514

5 years ago[InstCombine] recognize popcount.
Chen Zheng [Fri, 11 Oct 2019 05:13:56 +0000 (05:13 +0000)]
[InstCombine] recognize popcount.

  This patch recognizes popcount intrinsic according to algorithm from website
  http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel

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

llvm-svn: 374512

5 years ago[libc++] Fix linker script generation
Petr Hosek [Fri, 11 Oct 2019 04:54:35 +0000 (04:54 +0000)]
[libc++] Fix linker script generation

Handle the case when libc++abi and libunwind are being built together
with libc++ in the runtimes build. This logic was used in the previous
implementation but dropped in r374116.

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

llvm-svn: 374510

5 years ago[X86] Add a DAG combine to turn v16i16->v16i8 VTRUNCUS+store into a saturating trunca...
Craig Topper [Fri, 11 Oct 2019 04:16:49 +0000 (04:16 +0000)]
[X86] Add a DAG combine to turn v16i16->v16i8 VTRUNCUS+store into a saturating truncating store.

llvm-svn: 374509

5 years ago[X86] Add test case for trunc_packus_v16i32_v16i8_store to min-legal-vector-width.ll
Craig Topper [Fri, 11 Oct 2019 04:02:04 +0000 (04:02 +0000)]
[X86] Add test case for trunc_packus_v16i32_v16i8_store to min-legal-vector-width.ll

We aren't folding the vpmovuswb into the store.

llvm-svn: 374507

5 years ago[CVP] Remove a masking operation if range information implies it's a noop
Philip Reames [Fri, 11 Oct 2019 03:48:56 +0000 (03:48 +0000)]
[CVP] Remove a masking operation if range information implies it's a noop

This is really a known bits style transformation, but known bits isn't context sensitive. The particular case which comes up happens to involve a range which allows range based reasoning to eliminate the mask pattern, so handle that case specifically in CVP.

InstCombine likes to generate the mask-by-low-bits pattern when widening an arithmetic expression which includes a zext in the middle.

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

llvm-svn: 374506

5 years ago[X86] Add more packus/ssat/usat truncate tests from legal vectors to less than 128...
Craig Topper [Fri, 11 Oct 2019 03:46:39 +0000 (03:46 +0000)]
[X86] Add more packus/ssat/usat truncate tests from legal vectors to less than 128-bit vectors.

Some of these have sub-optimal codegen for avx512 relative to avx2.

llvm-svn: 374505

5 years ago[Polly] Fix formatting violation. NFC.
Volodymyr Sapsai [Fri, 11 Oct 2019 03:09:24 +0000 (03:09 +0000)]
[Polly] Fix formatting violation. NFC.

llvm-svn: 374504

5 years agoRevert 374481 "[tsan,msan] Insert module constructors in a module pass"
Nico Weber [Fri, 11 Oct 2019 02:44:20 +0000 (02:44 +0000)]
Revert 374481 "[tsan,msan] Insert module constructors in a module pass"

CodeGen/sanitizer-module-constructor.c fails on mac and windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11424

llvm-svn: 374503

5 years ago[CUDA][HIP} Add a test for constexpr default ctor
Yaxun Liu [Fri, 11 Oct 2019 02:43:28 +0000 (02:43 +0000)]
[CUDA][HIP} Add a test for constexpr default ctor

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

llvm-svn: 374502

5 years ago[Stats] More polly fixes following llvm::Statistic changes in r374490.
Volodymyr Sapsai [Fri, 11 Oct 2019 02:42:16 +0000 (02:42 +0000)]
[Stats] More polly fixes following llvm::Statistic changes in r374490.

llvm-svn: 374501

5 years ago[JITLink] Disable the MachO/AArch64 testcase while investigating bot failures.
Lang Hames [Fri, 11 Oct 2019 01:58:12 +0000 (01:58 +0000)]
[JITLink] Disable the MachO/AArch64 testcase while investigating bot failures.

The windows bots are failing due to a memory layout error. Temporarily disabling
while I investigate whether this can be worked around, or whether the test
should be disabled on Windows.

llvm-svn: 374500

5 years ago[JITLink] Fix MachO/arm64 GOTPAGEOFF encoding.
Lang Hames [Fri, 11 Oct 2019 01:50:31 +0000 (01:50 +0000)]
[JITLink] Fix MachO/arm64 GOTPAGEOFF encoding.

The original implementation failed to shift the immediate down.

This should fix some of the bot failures due to r374476.

llvm-svn: 374499

5 years ago[Attributor][FIX] Do not replace musstail calls with constant
Johannes Doerfert [Fri, 11 Oct 2019 01:45:32 +0000 (01:45 +0000)]
[Attributor][FIX] Do not replace musstail calls with constant

llvm-svn: 374498

5 years ago[Stats] Fix polly build due to change in llvm::Statistic constructor in r374490.
Volodymyr Sapsai [Fri, 11 Oct 2019 01:43:36 +0000 (01:43 +0000)]
[Stats] Fix polly build due to change in llvm::Statistic constructor in r374490.

llvm-svn: 374497

5 years agoFix assertion failure for a cv-qualified array as a non-type template
Richard Smith [Fri, 11 Oct 2019 01:29:53 +0000 (01:29 +0000)]
Fix assertion failure for a cv-qualified array as a non-type template
parameter type.

We were both failing to decay the array type to a pointer and failing to
remove the top-level cv-qualifications. Fix this by decaying array
parameters even if the parameter type is dependent.

llvm-svn: 374496

5 years agoAMDGPU: Move SelectFlatOffset back into AMDGPUISelDAGToDAG
Matt Arsenault [Fri, 11 Oct 2019 01:28:27 +0000 (01:28 +0000)]
AMDGPU: Move SelectFlatOffset back into AMDGPUISelDAGToDAG

llvm-svn: 374495

5 years agoGet ClangdXPC.framework building (barely) with CMake's Xcode generator
Jordan Rose [Fri, 11 Oct 2019 01:23:56 +0000 (01:23 +0000)]
Get ClangdXPC.framework building (barely) with CMake's Xcode generator

The output directories for CMake's Xcode project generator are
specific to the configuration, and so looking in
CMAKE_LIBRARY_OUTPUT_DIRECTORY isn't going to work. Fortunately, CMake
already provides generator expressions to find the output of a given
target.

I call this "barely" building because the built framework isn't going
to respect the configuration; that is, I can't have both Debug and
RelWithDebInfo variants of ClangdXPC.framework at the same time like I
can with normal library or executable targets. To do that we'd have to
put the framework in a configuration-specific output directory or use
CMake's native support for frameworks instead.

https://reviews.llvm.org/D68846

llvm-svn: 374494

5 years ago[Stats] Add ALWAYS_ENABLED_STATISTIC enabled regardless of LLVM_ENABLE_STATS.
Volodymyr Sapsai [Fri, 11 Oct 2019 00:57:41 +0000 (00:57 +0000)]
[Stats] Add ALWAYS_ENABLED_STATISTIC enabled regardless of LLVM_ENABLE_STATS.

The intended usage is to measure relatively expensive operations. So the
cost of the statistic is negligible compared to the cost of a measured
operation and can be enabled all the time without impairing the
compilation time.

rdar://problem/55715134

Reviewers: dsanders, bogner, rtereshin

Reviewed By: dsanders

Subscribers: hiraditya, jkorous, dexonsmith, ributzka, cfe-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 374490

5 years agoInclude whether the destructor is constexpr in -ast-dump output for a
Richard Smith [Fri, 11 Oct 2019 00:40:08 +0000 (00:40 +0000)]
Include whether the destructor is constexpr in -ast-dump output for a
clss.

llvm-svn: 374488

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

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

llvm-svn: 374414