platform/upstream/llvm.git
3 years agoImprove error message when constructing a Tensor with an invalid element type (NFC)
Mehdi Amini [Mon, 17 Aug 2020 20:39:43 +0000 (20:39 +0000)]
Improve error message when constructing a Tensor with an invalid element type (NFC)

Reviewed By: ftynse

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

3 years ago[safe-stack] Fix typo in test command line
Vitaly Buka [Mon, 17 Aug 2020 20:38:15 +0000 (13:38 -0700)]
[safe-stack] Fix typo in test command line

3 years ago[gn build] Port 2f0d755d815
LLVM GN Syncbot [Mon, 17 Aug 2020 20:30:41 +0000 (20:30 +0000)]
[gn build] Port 2f0d755d815

3 years agoGlobalISel: Make type for lower action more consistently optional
Matt Arsenault [Wed, 15 Jul 2020 15:10:54 +0000 (11:10 -0400)]
GlobalISel: Make type for lower action more consistently optional

Some of the lower implementations were relying on this, however the
type was not set depending on which form .lower* helper form you were
using. For instance, if you used an unconditonal lower(), the type was
never set. Most of the lower actions do not benefit from a type
parameter, and just expand in terms of the original operation's types.

However, some lowerings could benefit from an additional type hint to
combine a promotion and an expansion. An example of this is for
add/sub sat. The DAG integer legalization tries to use smarter
expansions directly when promoting the integer type, and doesn't
always produce the same instruction with a wider type.

Treat this as an optional hint argument, that only means something for
specific lower actions. It may be useful to generalize this mechanism
to pass a full list of type indexes and desired types, but I haven't
run into a case like that yet.

3 years ago[AIX][XCOFF][Patch1] Provide decoding trace back table information API for xcoff...
diggerlin [Mon, 17 Aug 2020 20:23:47 +0000 (16:23 -0400)]
[AIX][XCOFF][Patch1] Provide decoding trace back table information API for xcoff object file for llvm-objdump -d

SUMMARY:

1. This patch provided API for decoding the traceback table info and unit test for the these API.

2. Another patchs will do the following things:
2.1 added a new option --traceback-table to decode the trace back table information for xcoff object file when
using llvm-objdump to disassemble the xcoff objfile.

2.2 print out the  traceback table information for llvm-objdump.

Reviewers:  Jason liu, Hubert Tong, James Henderson

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

3 years ago[NVPTX] Fix typo in lit test
Ellis Hoag [Mon, 17 Aug 2020 20:01:02 +0000 (16:01 -0400)]
[NVPTX] Fix typo in lit test

LBAEL => LABEL

I encountered this typo elsewhere and I decided to run a global search.
It probably was unnoticed because I think CHECK-LBAEL: is ignored by
lit.

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

3 years ago[DSE,MemorySSA] Skip access already dominated by a killing def.
Florian Hahn [Mon, 17 Aug 2020 17:52:57 +0000 (18:52 +0100)]
[DSE,MemorySSA] Skip access already dominated by a killing def.

If we already found a killing def (= a def that completely overwrites
the location) that dominates an access, we can skip processing it
further.

This does not help with compile-time, but increases the number of memory
accesses we can process with the same scan budget, leading to more
stores being eliminated.

Improvements with this change

Same hash: 203 (filtered out)
Remaining: 34
Metric: dse.NumFastStores

Program                                        base    dom     diff
 test-suite...rolangs-C++/family/family.test     2.00    4.00  100.0%
 test-suite...ProxyApps-C++/CLAMR/CLAMR.test   172.00  229.00  33.1%
 test-suite...ks/Prolangs-C/agrep/agrep.test    10.00   12.00  20.0%
 test-suite...oxyApps-C++/miniFE/miniFE.test    44.00   51.00  15.9%
 test-suite...marks/7zip/7zip-benchmark.test   1285.00 1474.00 14.7%
 test-suite...006/450.soplex/450.soplex.test   254.00  289.00  13.8%
 test-suite...006/447.dealII/447.dealII.test   2466.00 2798.00 13.5%
 test-suite...000/197.parser/197.parser.test     9.00   10.00  11.1%
 test-suite.../Benchmarks/nbench/nbench.test    85.00   91.00   7.1%
 test-suite...ce/Applications/siod/siod.test    68.00   72.00   5.9%
 test-suite...ications/JM/lencod/lencod.test   786.00  824.00   4.8%
 test-suite...6/464.h264ref/464.h264ref.test   765.00  798.00   4.3%
 test-suite.../Benchmarks/Ptrdist/bc/bc.test   105.00  109.00   3.8%
 test-suite...lications/obsequi/Obsequi.test    29.00   28.00  -3.4%
 test-suite...3.xalancbmk/483.xalancbmk.test   1322.00 1367.00  3.4%
 test-suite...chmarks/MallocBench/gs/gs.test   118.00  122.00   3.4%
 test-suite...T2006/401.bzip2/401.bzip2.test    60.00   62.00   3.3%
 test-suite...6/482.sphinx3/482.sphinx3.test    30.00   31.00   3.3%
 test-suite...rks/tramp3d-v4/tramp3d-v4.test   862.00  887.00   2.9%
 test-suite...telecomm-gsm/telecomm-gsm.test    78.00   80.00   2.6%
 test-suite...ediabench/gsm/toast/toast.test    78.00   80.00   2.6%
 test-suite.../Applications/SPASS/SPASS.test   163.00  167.00   2.5%
 test-suite...lications/ClamAV/clamscan.test   240.00  245.00   2.1%
 test-suite...006/453.povray/453.povray.test   1392.00 1419.00  1.9%
 test-suite...000/255.vortex/255.vortex.test   211.00  215.00   1.9%
 test-suite...:: External/Povray/povray.test   1295.00 1317.00  1.7%
 test-suite...lications/sqlite3/sqlite3.test   175.00  177.00   1.1%
 test-suite...T2000/256.bzip2/256.bzip2.test    99.00  100.00   1.0%
 test-suite...0/253.perlbmk/253.perlbmk.test   629.00  635.00   1.0%
 test-suite.../CINT2006/403.gcc/403.gcc.test   1183.00 1194.00  0.9%
 test-suite.../CINT2000/176.gcc/176.gcc.test   647.00  653.00   0.9%
 test-suite...ications/JM/ldecod/ldecod.test   512.00  516.00   0.8%
 test-suite...0.perlbench/400.perlbench.test   1026.00 1034.00  0.8%
 test-suite...-typeset/consumer-typeset.test   1876.00 1877.00  0.1%
 Geomean difference                                             7.3%

3 years agoRevert "Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record"
Alexandre Ganea [Mon, 17 Aug 2020 18:23:46 +0000 (14:23 -0400)]
Revert "Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record"

This reverts commit a3036b386383f1c1e9d32c2c8dba995087959da3.

As requested in: https://reviews.llvm.org/D80833#2221866
Bug report: https://crbug.com/1117026

3 years agoAMDGPU/GlobalISel: Match global saddr addressing mode
Matt Arsenault [Sun, 16 Aug 2020 15:18:52 +0000 (11:18 -0400)]
AMDGPU/GlobalISel: Match global saddr addressing mode

3 years ago[DAGCombiner] give magic number a name in getStoreMergeCandidates; NFC
Sanjay Patel [Mon, 17 Aug 2020 19:36:55 +0000 (15:36 -0400)]
[DAGCombiner] give magic number a name in getStoreMergeCandidates; NFC

3 years ago[DAGCombiner] reduce code duplication in getStoreMergeCandidates; NFC
Sanjay Patel [Mon, 17 Aug 2020 19:32:07 +0000 (15:32 -0400)]
[DAGCombiner] reduce code duplication in getStoreMergeCandidates; NFC

3 years ago[DAGCombiner] simplify bool return in getStoreMergeCandidates; NFC
Sanjay Patel [Mon, 17 Aug 2020 18:12:30 +0000 (14:12 -0400)]
[DAGCombiner] simplify bool return in getStoreMergeCandidates; NFC

3 years ago[DAGCombiner] clean up getStoreMergeCandidates(); NFC
Sanjay Patel [Mon, 17 Aug 2020 18:08:50 +0000 (14:08 -0400)]
[DAGCombiner] clean up getStoreMergeCandidates(); NFC
1. Move bailouts and local var declarations.
2. Convert if-chain to switch on StoreSource with unreachable default.

3 years ago[DAGCombiner] convert StoreSource if-chain to switch; NFC
Sanjay Patel [Mon, 17 Aug 2020 17:27:27 +0000 (13:27 -0400)]
[DAGCombiner] convert StoreSource if-chain to switch; NFC

The "isa" checks were less constrained because they allow
target constants, but the later matching code would bail
out on those anyway, so this should be slightly more
efficient.

3 years ago[AssumeBundles] Fix Bug in Assume Queries
Tyker [Mon, 17 Aug 2020 18:47:02 +0000 (20:47 +0200)]
[AssumeBundles] Fix Bug in Assume Queries

this bug was causing miscompile.
now clang cant properly selfhost with -mllvm --enable-knowledge-retention

Reviewed By: jdoerfert, lebedev.ri

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

3 years agoAMDGPU: Match global saddr addressing mode
Matt Arsenault [Thu, 13 Aug 2020 20:51:07 +0000 (16:51 -0400)]
AMDGPU: Match global saddr addressing mode

The previous implementation was incorrect, and based off incorrect
instruction definitions. Unfortunately we can't match natural
addressing in a lot of cases due to the shift/scale applied in
getelementptrs. This relies on reducing the 64-bit shift to 32-bits.

3 years agoAMDGPU: Add baseline tests for global saddr matching
Matt Arsenault [Sat, 15 Aug 2020 16:31:21 +0000 (12:31 -0400)]
AMDGPU: Add baseline tests for global saddr matching

3 years ago[AMDGPU] Define spill opcodes for all AGPR sizes
Stanislav Mekhanoshin [Mon, 17 Aug 2020 19:05:23 +0000 (12:05 -0700)]
[AMDGPU] Define spill opcodes for all AGPR sizes

Since we have defined all these sizes I believe we shall be
able to spill these as well.

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

3 years ago[lldb] Skip test_launch_simple with reproducers
Jonas Devlieghere [Mon, 17 Aug 2020 18:45:35 +0000 (11:45 -0700)]
[lldb] Skip test_launch_simple with reproducers

The test checks the inferior's output. During replay the binary doesn't
actually run and the output isn't captured by the reproducers.

3 years agoRevert "[BPI] Improve static heuristics for integer comparisons"
Dávid Bolvanský [Mon, 17 Aug 2020 18:42:57 +0000 (20:42 +0200)]
Revert "[BPI] Improve static heuristics for integer comparisons"

This reverts commit 50c743fa713002fe4e0c76d23043e6c1f9e9fe6f. Patch will be split to smaller ones.

3 years ago[lldb] Skip TestMultipleDebuggers on Windows
Jonas Devlieghere [Mon, 17 Aug 2020 18:34:24 +0000 (11:34 -0700)]
[lldb] Skip TestMultipleDebuggers on Windows

3 years ago[lldb] Skip the Apple Simulator tests with reproducers
Jonas Devlieghere [Mon, 17 Aug 2020 18:26:20 +0000 (11:26 -0700)]
[lldb] Skip the Apple Simulator tests with reproducers

3 years ago[ELF] Allow mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER sections and sort within InputS...
Fangrui Song [Fri, 14 Aug 2020 17:23:45 +0000 (10:23 -0700)]
[ELF] Allow mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER sections and sort within InputSectionDescription

LLD currently does not allow non-contiguous SHF_LINK_ORDER components in an
output section. This makes it infeasible to add SHF_LINK_ORDER to an existing
metadata section if backward compatibility with older object files are
concerned.

We did not allow mixed components (like GNU ld) and D77007 relaxed to allow
non-contiguous SHF_LINK_ORDER components. This patch allows arbitrary mix, with
sorting performed within an InputSectionDescription. For example,
`.rodata : {*(.rodata.foo) *(.rodata.bar)}`, has two InputSectionDescription's.
If there is at least one SHF_LINK_ORDER and at least one non-SHF_LINK_ORDER in
.rodata.foo, they are ordered within `*(.rodata.foo)`: we arbitrarily place
SHF_LINK_ORDER components before non-SHF_LINK_ORDER components (like Solaris ld).

`*(.rodata.bar)` is ordered similarly, but the two InputSectionDescription's
don't interact.  It can be argued that this is more reasonable than the previous
behavior where written order was not respected.

It would be nice if the two different semantics (ordering requirement & garbage
collection) were not overloaded on one section flag, however, it is probably
difficult to obtain a generic flag at this point
(https://groups.google.com/forum/#!topic/generic-abi/hgx_m1aXqUo
"SHF_LINK_ORDER's original semantics make upgrade difficult").

(Actually, without the GC semantics, SHF_LINK_ORDER would still have the
sh_link!=0 & sh_link=0 issue. It is just that people find the GC semantics more
useful and tend to use the feature more often.)

GNU ld feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=16833

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

3 years ago[DFSan] Support fast16labels mode in dfsan_union.
Matt Morehouse [Mon, 17 Aug 2020 18:27:16 +0000 (11:27 -0700)]
[DFSan] Support fast16labels mode in dfsan_union.

While the instrumentation never calls dfsan_union in fast16labels mode,
the custom wrappers do.  We detect fast16labels mode by checking whether
any labels have been created.  If not, we must be using fast16labels
mode.

Reviewed By: vitalybuka

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

3 years ago[flang][directives] Use TableGen to generate clause unparsing
Valentin Clement [Mon, 17 Aug 2020 18:22:01 +0000 (14:22 -0400)]
[flang][directives] Use TableGen to generate clause unparsing

Use the TableGen directive back-end to generate code for the clauses unparsing.

Reviewed By: sscalpone, kiranchandramohan

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

3 years ago[llvm] Don't create the directory hierarchy in the FileCollector...
Jonas Devlieghere [Mon, 17 Aug 2020 18:13:11 +0000 (11:13 -0700)]
[llvm] Don't create the directory hierarchy in the FileCollector...

... if the collected file doesn't exists.

This fixes the situation where LLDB can't create a file when capturing a
reproducer because the parent path doesn't exist, but can during replay
because the file collector created the directory hierarchy even though
the file doesn't exist.

This is covered by the lldb reproducer test suite.

3 years agoGlobalISel: Fix parameter name in doxygen comment
Matt Arsenault [Mon, 17 Aug 2020 17:38:11 +0000 (13:38 -0400)]
GlobalISel: Fix parameter name in doxygen comment

3 years agoGlobalISel: Revisit users of other merge opcodes in artifact combiner
Matt Arsenault [Sun, 16 Aug 2020 14:04:12 +0000 (10:04 -0400)]
GlobalISel: Revisit users of other merge opcodes in artifact combiner

The artifact combiner searches for the uses of G_MERGE_VALUES for
unmerge/trunc that need further combining. This also needs to handle
the vector merge opcodes the same way. This fixes leaving behind some
pairs I expected to be removed, that were if the legalizer is run a
second time.

3 years ago[libcxx/variant] Correctly propagate return type of the visitor.
Michael Park [Mon, 17 Aug 2020 17:53:59 +0000 (10:53 -0700)]
[libcxx/variant] Correctly propagate return type of the visitor.

The tests for it were missing so I've added them.

Reviewed By: #libc, EricWF

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

3 years ago[DSE,MemorySSA] Check for underlying objects first.
Florian Hahn [Fri, 14 Aug 2020 14:25:01 +0000 (15:25 +0100)]
[DSE,MemorySSA] Check for underlying objects first.

isWriteAtEndOfFunction needs to check all memory uses of Def, which is
much more expensive than getting the underlying objects in practice.
Switch the call order, as recommended by the TODO, which was added as
per an earlier review.

This shaves off a bit of compile-time.

3 years agoGlobalISel: Early continue to reduce loop indentation
Matt Arsenault [Mon, 17 Aug 2020 17:42:59 +0000 (13:42 -0400)]
GlobalISel: Early continue to reduce loop indentation

3 years ago[lldb] Skip TestError.test with reproducers
Jonas Devlieghere [Mon, 17 Aug 2020 17:42:56 +0000 (10:42 -0700)]
[lldb] Skip TestError.test with reproducers

This tests the driver, which is bypassed by the reproducer during
replay.

3 years ago[lldb] Add missing LLDB_REGISTER for GarbageCollectAllocatedModules
Jonas Devlieghere [Mon, 17 Aug 2020 17:14:03 +0000 (10:14 -0700)]
[lldb] Add missing LLDB_REGISTER for GarbageCollectAllocatedModules

Add the missing LLDB_REGISTER_STATIC_METHOD macro and format the file.

3 years ago[test] Fix aggregate-assign-call.c in preparation for -enable-npm-optnone
Arthur Eubanks [Thu, 6 Aug 2020 18:08:06 +0000 (11:08 -0700)]
[test] Fix aggregate-assign-call.c in preparation for -enable-npm-optnone

Pin the test to use -enable-npm-optnone.
Before, optnone wasn't implemented under NPM, so the LPM and NPM runs produced different IR. Now with -enable-npm-optnone, that is no longer necessary.

Reviewed By: ychen

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

3 years ago[test] Fix thinlto-debug-pm.c in preparation for -enable-npm-optnone
Arthur Eubanks [Thu, 6 Aug 2020 18:08:06 +0000 (11:08 -0700)]
[test] Fix thinlto-debug-pm.c in preparation for -enable-npm-optnone

This fails due to the clang invocation running at -O0, producing an optnone function.
Then even with -O2 in the later invocations, LoopVectorizePass doesn't run on the optnone function.
So split this into an -O0 run and an -O2 run.

Reviewed By: asbirlea

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

3 years ago[lldb] Replace unittest2.expectedFailure with expectedFailure (NFC)
Jonas Devlieghere [Sat, 15 Aug 2020 00:53:47 +0000 (17:53 -0700)]
[lldb] Replace unittest2.expectedFailure with expectedFailure (NFC)

Rename the existing expectedFailure to expectedFailureIfFn to better
describe its purpose and provide an overload for
unittest2.expectedFailure in decorators.py.

3 years ago[lldb] Use os.path.sep in TestInvalidArgsLog.py to fix Windows bot
Raphael Isemann [Mon, 17 Aug 2020 17:03:27 +0000 (19:03 +0200)]
[lldb] Use os.path.sep in TestInvalidArgsLog.py to fix Windows bot

3 years agoRevert "Make compiler-rt/asan tests run with llvm-lit."
Amy Huang [Mon, 17 Aug 2020 16:59:00 +0000 (09:59 -0700)]
Revert "Make compiler-rt/asan tests run with llvm-lit."

This reverts commit 7f84f62ef07a0a540a7dd751d08aae583d5e2472.

Seems to be causing a bunch of compiler-rt test failures on
ppc64-linux bots.

3 years ago[ELF] Enforce two-dash form for some LLD specific options and the newer --[no-]pcrel...
Fangrui Song [Mon, 17 Aug 2020 16:59:22 +0000 (09:59 -0700)]
[ELF] Enforce two-dash form for some LLD specific options and the newer --[no-]pcrel-optimize

Since -[no-]toc-optimize has not ever been used, we can enforce the two-dash form as well.

3 years ago[DSE,MemorySSA] Account for ScanLimit == 0 on entry.
Florian Hahn [Fri, 14 Aug 2020 20:08:16 +0000 (21:08 +0100)]
[DSE,MemorySSA] Account for ScanLimit == 0 on entry.

Currently the code does not account for the fact that getDomMemoryDef
can be called with ScanLimit == 0, if we reached the limit while
processing an earlier access. Also tighten the check a bit more and bump
the scan limit now that it is handled properly.

In some cases, this brings a 2x speedup in terms of compile-time.

3 years agoAdds __str__ support to python mlir.ir.MlirModule.
Stella Laurenzo [Mon, 17 Aug 2020 03:53:45 +0000 (20:53 -0700)]
Adds __str__ support to python mlir.ir.MlirModule.

* Also raises an exception on parse error.
* Removes placeholder smoketest.
* Adds docstrings.

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

3 years agoNFC: [GVNHoist] Hoist loop invariant code and rename variables for readability
Aditya Kumar [Sun, 16 Aug 2020 02:50:56 +0000 (19:50 -0700)]
NFC: [GVNHoist] Hoist loop invariant code and rename variables for readability

Reviewed By: fhahn

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

3 years ago[lldb] Add missing signal include for TestMultipleDebuggers.py
Jonas Devlieghere [Mon, 17 Aug 2020 16:40:32 +0000 (09:40 -0700)]
[lldb] Add missing signal include for TestMultipleDebuggers.py

Fixes multi-process-driver.cpp:221:19: error: use of undeclared
identifier 'SIG_IGN'

3 years ago[lldb] Only link against Python 3 when LLDB_ENABLE_PYTHON is set.
Jonas Devlieghere [Mon, 17 Aug 2020 16:30:08 +0000 (09:30 -0700)]
[lldb] Only link against Python 3 when LLDB_ENABLE_PYTHON is set.

Only link against Python3_LIBRARY when LLDB_ENABLE_PYTHON is true. We
have to be more strict now becuase Python3_LIBRARY might be set to
NOTFOUND instead of being not set at all.

3 years agoAMDGPU/GlobalISel: Look through copies in getPtrBaseWithConstantOffset
Matt Arsenault [Sat, 15 Aug 2020 15:41:08 +0000 (11:41 -0400)]
AMDGPU/GlobalISel: Look through copies in getPtrBaseWithConstantOffset

We may have an SGPR->VGPR copy if a totally uniform pointer
calculation is used for a VGPR pointer operand.

Also hack around a bug in MUBUF matching which would incorrectly use
MUBUF for global when flat was requested. This should really be a
predicate on the parent pattern, but the DAG always checked this
manually inside the complex pattern.

3 years agoMake compiler-rt/asan tests run with llvm-lit.
Amy Huang [Mon, 17 Aug 2020 16:24:19 +0000 (09:24 -0700)]
Make compiler-rt/asan tests run with llvm-lit.

This sets some config parameters so we can run the asan tests with
llvm-lit,
e.g. `./bin/llvm-lit [...]/compiler-rt/test/asan`

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

3 years ago[lldb] Fix and re-enable TestMultipleDebuggers
Jonas Devlieghere [Mon, 17 Aug 2020 15:51:46 +0000 (08:51 -0700)]
[lldb] Fix and re-enable TestMultipleDebuggers

The comment says that TestMultipleDebuggers was XFAILed because it was
failing nondeterministically in which case it should be skipped not
failed (as XPASS will cause the test suite to fail).

The reason it fails is because it was not marked as a no-debug-info test
case. I've ran the test in a loop and it has been passing consistently.
Let's enable it and see if the bots agree, if not we can skip it.

3 years ago[lldb-vscode] NFC: clang format
Walter Erquinigo [Mon, 17 Aug 2020 16:17:54 +0000 (09:17 -0700)]
[lldb-vscode] NFC: clang format

Run clang-format on all the c++ file of this project.

3 years ago[mlir] Provide LLVMType::getPrimitiveSizeInBits
Alex Zinenko [Mon, 17 Aug 2020 13:56:03 +0000 (15:56 +0200)]
[mlir] Provide LLVMType::getPrimitiveSizeInBits

This function is available on llvm::Type and has been used by some clients of
the LLVM dialect before the transition. Implement the MLIR counterpart.

Reviewed By: schweitz

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

3 years ago[MLIR] Add support for defining and using Op specific analysis
Rahul Joshi [Fri, 14 Aug 2020 03:43:47 +0000 (20:43 -0700)]
[MLIR] Add support for defining and using Op specific analysis

- Add variants of getAnalysis() and friends that operate on a specific derived
  operation types.
- Add OpPassManager::getAnalysis() to always call the base getAnalysis() with OpT.
- With this, an OperationPass can call getAnalysis<> using an analysis type that
  is generic (works on Operation *) or specific to the OpT for the pass. Anything
  else will fail to compile.
- Extend AnalysisManager unit test to test this, and add a new PassManager unit
  test to test this functionality in the context of an OperationPass.

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

3 years ago[lldb] Get rid of helper CMake variables for Python
Jonas Devlieghere [Mon, 17 Aug 2020 15:47:52 +0000 (08:47 -0700)]
[lldb] Get rid of helper CMake variables for Python

This patch is a big sed to rename the following variables:

  s/PYTHON_LIBRARIES/Python3_LIBRARIES/g
  s/PYTHON_INCLUDE_DIRS/Python3_INCLUDE_DIRS/g
  s/PYTHON_EXECUTABLE/Python3_EXECUTABLE/g
  s/PYTHON_RPATH/Python3_RPATH/g

I've also renamed the CMake module to better express its purpose and for
consistency with FindLuaAndSwig.

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

3 years ago[libomptarget][NFC] Sort list of plugins in chronological order
George Rokos [Mon, 17 Aug 2020 15:32:23 +0000 (08:32 -0700)]
[libomptarget][NFC] Sort list of plugins in chronological order

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

3 years agoReset PAL metadata when AMDGPU traget stream finishes
Steven Perron [Mon, 17 Aug 2020 14:56:11 +0000 (10:56 -0400)]
Reset PAL metadata when AMDGPU traget stream finishes

If the same stream object is used for multiple compiles, the PAL metadata from eariler compilations will leak into later one.  See https://github.com/GPUOpen-Drivers/llpc/issues/882 for how this is happening in LLPC.

No tests were added because multiple compiles will have to happen using the same pass manager, and I do not see a setup for that on the LLVM side.  Let me know if there is a good way to test this.

Reviewed By: nhaehnle

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

3 years ago[LLD][PowerPC] Implement GOT to PC-Rel relaxation
Nemanja Ivanovic [Mon, 17 Aug 2020 14:30:14 +0000 (09:30 -0500)]
[LLD][PowerPC] Implement GOT to PC-Rel relaxation

This patch implements the handling for the R_PPC64_PCREL_OPT relocation as well
as the GOT relocation for the associated R_PPC64_GOT_PCREL34 relocation.

On Power10 targets with PC-Relative addressing, the linker can relax
GOT-relative accesses to PC-Relative under some conditions. Since the sequence
consists of a prefixed load, followed by a non-prefixed access (load or store),
the linker needs to replace the first instruction (as the replacement
instruction will be prefixed). The compiler communicates to the linker that
this optimization is safe by placing the two aforementioned relocations on the
GOT load (of the address).
The linker then does two things:

- Convert the load from the got into a PC-Relative add to compute the address
  relative to the PC
- Find the instruction referred to by the second relocation (R_PPC64_PCREL_OPT)
  and replace the first with the PC-Relative version of it

It is important to synchronize the mapping from legacy memory instructions to
their PC-Relative form. Hence, this patch adds a file to be included by both
the compiler and the linker so they're always in agreement.

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

3 years ago[libc] Make benchmark boxplots transparent.
Anthony Steinhauser [Fri, 14 Aug 2020 02:43:16 +0000 (19:43 -0700)]
[libc] Make benchmark boxplots transparent.

So that the configuration box does not make a part of the plot invisible.

Reviewers: sivachandra

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

3 years ago[PowerPC] Fix thunk alignment issue when using pc-rel instruction
Victor Huang [Mon, 17 Aug 2020 13:38:05 +0000 (08:38 -0500)]
[PowerPC] Fix thunk alignment issue when using pc-rel instruction

Thunk alignment is added in thie patch when using pc-rel instructions
to avoid crossing the 64 byte boundary.

Patched by: nemanjai, NeHuang
Reviewed By: sfertile, MaskRay

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

3 years agoDAG: Add missing comment for transform
Matt Arsenault [Thu, 16 Jul 2020 12:52:43 +0000 (08:52 -0400)]
DAG: Add missing comment for transform

3 years ago[flang] Copy attributes and flags onto host-assoc symbols
Tim Keith [Mon, 17 Aug 2020 14:00:04 +0000 (07:00 -0700)]
[flang] Copy attributes and flags onto host-assoc symbols

As with use-associated symbols, copy the attributes and flags from the
original symbol onto host-associated symbols when they are created.

This was showing up as an error on a deallocate of a host-associated
name. We reported an error because the symbol didn't have the POINTER
or ALLOCATABLE attribute.

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

3 years ago[clangd] Fix Windows build when remote index is enabled.
Aleksandr Platonov [Mon, 17 Aug 2020 13:51:58 +0000 (16:51 +0300)]
[clangd] Fix Windows build when remote index is enabled.

CMake log:
```
CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:823 (add_executable):
  Target "clangd" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:150 (add_llvm_executable)
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:160 (add_clang_executable)
  D:/llvm-project/clang-tools-extra/clangd/tool/CMakeLists.txt:4 (add_clang_tool)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:821 (add_executable):
  Target "ClangdTests" links to target "Threads::Threads" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:1417 (add_llvm_executable)
  D:/llvm-project/clang-tools-extra/clangd/unittests/CMakeLists.txt:32 (add_unittest)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:527 (add_library):
  Target "RemoteIndexProtos" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
  D:/llvm-project/llvm/cmake/modules/FindGRPC.cmake:105 (add_clang_library)
  D:/llvm-project/clang-tools-extra/clangd/index/remote/CMakeLists.txt:2 (generate_grpc_protos)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:527 (add_library):
  Target "clangdRemoteIndex" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
  D:/llvm-project/clang-tools-extra/clangd/index/remote/CMakeLists.txt:11 (add_clang_library)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:527 (add_library):
  Target "clangdRemoteMarshalling" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
  D:/llvm-project/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt:1 (add_clang_library)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:823 (add_executable):
  Target "clangd-index-server" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
```

Reviewed By: kbobyrev

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

3 years agoAMDGPU/GlobalISel: Fix missing 256-bit AGPR mapping
Matt Arsenault [Wed, 12 Aug 2020 15:17:00 +0000 (11:17 -0400)]
AMDGPU/GlobalISel: Fix missing 256-bit AGPR mapping

3 years agoAMDGPU/GlobalISel: Fix using readfirstlane with ballot intrinsics
Matt Arsenault [Wed, 12 Aug 2020 16:34:46 +0000 (12:34 -0400)]
AMDGPU/GlobalISel: Fix using readfirstlane with ballot intrinsics

This should use the default mapping and insert a copy to the vcc bank,
and not try to insert a readfirstlane.

3 years agoAMDGPU: Don't look at dbg users for foldable operands
Matt Arsenault [Wed, 22 Jul 2020 19:20:38 +0000 (15:20 -0400)]
AMDGPU: Don't look at dbg users for foldable operands

These would have always failed to fold, so checking them or adding
them to the fold candidates is useless.

3 years ago[mlir] do not use llvm.cmpxchg with floats
Alex Zinenko [Thu, 13 Aug 2020 12:46:31 +0000 (14:46 +0200)]
[mlir] do not use llvm.cmpxchg with floats

According to the LLVM Language Reference, 'cmpxchg' accepts integer or pointer
types. Several MLIR tests were using it with floats as it appears possible to
programmatically construct and print such an instruction, but it cannot be
parsed back. Use integers instead.

Depends On D85899

Reviewed By: flaub, rriddle

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

3 years ago[flang] Add preprocessor test for defines passed on the command line
David Truby [Fri, 14 Aug 2020 12:22:00 +0000 (13:22 +0100)]
[flang] Add preprocessor test for defines passed on the command line

This adds a test for D85862 to ensure that preprocessor definitions
passed on command lines don't regress in future.

Reviewed By: tskeith

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

3 years agoGlobalISel: Remove unnecessary check for copy type
Matt Arsenault [Sat, 15 Aug 2020 14:26:21 +0000 (10:26 -0400)]
GlobalISel: Remove unnecessary check for copy type

COPY isn't allowed to change the type, but can mix no type with type.

3 years agoAMDGPU/GlobalISel: Fix using post-legal combiner without LegalizerInfo
Matt Arsenault [Sat, 15 Aug 2020 19:14:11 +0000 (15:14 -0400)]
AMDGPU/GlobalISel: Fix using post-legal combiner without LegalizerInfo

3 years agoAMDGPU: Fix using wrong offsets for global atomic fadd intrinsics
Matt Arsenault [Sat, 15 Aug 2020 02:19:22 +0000 (22:19 -0400)]
AMDGPU: Fix using wrong offsets for global atomic fadd intrinsics

Global instructions have the signed offsets.

3 years ago[mlir] Move data layout from LLVMDialect to module Op attributes
Alex Zinenko [Mon, 17 Aug 2020 11:35:27 +0000 (13:35 +0200)]
[mlir] Move data layout from LLVMDialect to module Op attributes

Legacy implementation of the LLVM dialect in MLIR contained an instance of
llvm::Module as it was required to parse LLVM IR types. The access to the data
layout of this module was exposed to the users for convenience, but in practice
this layout has always been the default one obtained by parsing an empty layout
description string. Current implementation of the dialect no longer relies on
wrapping LLVM IR types, but it kept an instance of DataLayout for
compatibility. This effectively forces a single data layout to be used across
all modules in a given MLIR context, which is not desirable. Remove DataLayout
from the LLVM dialect and attach it as a module attribute instead. Since MLIR
does not yet have support for data layouts, use the LLVM DataLayout in string
form with verification inside MLIR. Introduce the layout when converting a
module to the LLVM dialect and keep the default "" description for
compatibility.

This approach should be replaced with a proper MLIR-based data layout when it
becomes available, but provides an immediate solution to compiling modules with
different layouts, e.g. for GPUs.

This removes the need for LLVMDialectImpl, which is also removed.

Depends On D85650

Reviewed By: aartbik

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

3 years ago[llvm] support graceful failure of DataLayout parsing
Alex Zinenko [Mon, 17 Aug 2020 11:34:07 +0000 (13:34 +0200)]
[llvm] support graceful failure of DataLayout parsing

Existing implementation always aborts on syntax errors in a DataLayout
description. While this is meaningful for consuming textual IR modules, it is
inconvenient for users that may need fine-grained control over the layout from,
e.g., command-line options. Propagate errors through the parsing functions and
only abort in the top-level parsing function instead.

Reviewed By: mehdi_amini

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

3 years ago[lldb] Skip TestSimulatorPlatform with sanitized builds
Raphael Isemann [Mon, 17 Aug 2020 13:06:46 +0000 (15:06 +0200)]
[lldb] Skip TestSimulatorPlatform with sanitized builds

The test executable crashes when ran on a simulator. Skipping until this is
fixed.

rdar://67238668

3 years ago[SystemZ/ZOS]__(de)register_frame are not available on z/OS.
Kai Nacke [Thu, 2 Jul 2020 13:15:14 +0000 (15:15 +0200)]
[SystemZ/ZOS]__(de)register_frame are not available on z/OS.

The functions `__register_frame`/`__deregister_frame` are not
available on z/OS, so add a guard to not use them.

Reviewed By: lhames, abhina.sreeskantharajan

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

3 years ago[NFC] run update test script
Sam Parker [Mon, 17 Aug 2020 12:53:55 +0000 (13:53 +0100)]
[NFC] run update test script

On Transforms/LoopUnroll/runtime-small-upperbound.ll

3 years ago[NFC] Tweak a comment about the lock-free builtins
Luís Marques [Mon, 17 Aug 2020 12:43:53 +0000 (13:43 +0100)]
[NFC] Tweak a comment about the lock-free builtins

3 years ago[lldb][NFC] Use StringRef in CreateFunctionDeclaration/GetDeclarationName
Raphael Isemann [Mon, 17 Aug 2020 11:35:12 +0000 (13:35 +0200)]
[lldb][NFC] Use StringRef in CreateFunctionDeclaration/GetDeclarationName

CreateFunctionDeclaration should just take a StringRef. GetDeclarationName is
(only) used by CreateFunctionDeclaration so that's why now also takes a
StringRef.

3 years ago[llvm-readobj] - Remove unwrapOrError calls from GNUStyle<ELFT>::printRelocations.
Georgii Rymar [Thu, 13 Aug 2020 10:24:39 +0000 (13:24 +0300)]
[llvm-readobj] - Remove unwrapOrError calls from GNUStyle<ELFT>::printRelocations.

This fixes existent FIXMEs: we should not error out when unable to
find the number of relocations.

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

3 years ago[RISCV] Enable the use of the old mucounteren name
Sam Elliott [Mon, 17 Aug 2020 12:10:27 +0000 (13:10 +0100)]
[RISCV] Enable the use of the old mucounteren name

The RISC-V Privileged Specification 1.11 defines `mcountinhibit`, which
has the same numeric CSR value as `mucounteren` from 1.09.1. This patch
enables the use of the old `mucounteren` name.

Patch by Yuichi Sugiyama.

Reviewed By: lenary, jrtc27, pzheng

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

3 years ago[RISCV] Indirect branch generation in position independent code
Sam Elliott [Mon, 17 Aug 2020 11:25:45 +0000 (12:25 +0100)]
[RISCV] Indirect branch generation in position independent code

This fixes the "Unable to insert indirect branch" fatal error sometimes
seen when generating position-independent code.

Patch by msizanoen1

Reviewed By: jrtc27

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

3 years ago[gn build] Port c1f6ce0c732
LLVM GN Syncbot [Mon, 17 Aug 2020 12:02:24 +0000 (12:02 +0000)]
[gn build] Port c1f6ce0c732

3 years ago[InstCombine] fold abs(X)/X to cmp+select
Sanjay Patel [Sun, 16 Aug 2020 19:42:06 +0000 (15:42 -0400)]
[InstCombine] fold abs(X)/X to cmp+select

The backend can convert the select-of-constants to
bit-hack shift+logic if desirable.

https://alive2.llvm.org/ce/z/pgJT6E

  define i8 @src(i8 %x) {
  %0:
    %a = abs i8 %x, 1
    %d = sdiv i8 %x, %a
    ret i8 %d
  }
  =>
  define i8 @tgt(i8 %x) {
  %0:
    %cond = icmp sgt i8 %x, 255
    %r = select i1 %cond, i8 1, i8 255
    ret i8 %r
  }
  Transformation seems to be correct!

3 years ago[InstCombine] add tests for sdiv-of-abs; NFC
Sanjay Patel [Sun, 16 Aug 2020 19:11:11 +0000 (15:11 -0400)]
[InstCombine] add tests for sdiv-of-abs; NFC

3 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Sun, 16 Aug 2020 19:00:03 +0000 (15:00 -0400)]
[InstCombine] reduce code duplication; NFC

3 years ago[llvm-readobj/elf] - Refine the warning about the broken PT_DYNAMIC segment.
Georgii Rymar [Mon, 10 Aug 2020 14:50:16 +0000 (17:50 +0300)]
[llvm-readobj/elf] - Refine the warning about the broken PT_DYNAMIC segment.

Splitted out from D85519.

Currently we report "PT_DYNAMIC segment offset + size exceeds the size of the file",
this changes it to
"PT_DYNAMIC segment offset (0x1234) + file size (0x5678) exceeds the size of the file (0x68ab)"

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

3 years ago[DemandedBits] Improve accuracy of Add propagator
Simon Pilgrim [Mon, 17 Aug 2020 11:53:52 +0000 (12:53 +0100)]
[DemandedBits] Improve accuracy of Add propagator

The current demand propagator for addition will mark all input bits at and right of the alive output bit as alive. But carry won't propagate beyond a bit for which both operands are zero (or one/zero in the case of subtraction) so a more accurate answer is possible given known bits.

I derived a propagator by working through truth tables and using a bit-reversed addition to make demand ripple to the right, but I'm not sure how to make a convincing argument for its correctness in the comments yet. Nevertheless, here's a minimal implementation and test to get feedback.

This would help in a situation where, for example, four bytes (<128) packed into an int are added with four others SIMD-style but only one of the four results is actually read.

Known A:     0_______0_______0_______0_______
Known B:     0_______0_______0_______0_______
AOut:        00000000001000000000000000000000
AB, current: 00000000001111111111111111111111
AB, patch:   00000000001111111000000000000000

Committed on behalf of: @rrika (Erika)

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

3 years ago[DemandedBits] Reorder addition test checks. NFC.
Simon Pilgrim [Mon, 17 Aug 2020 11:46:31 +0000 (12:46 +0100)]
[DemandedBits] Reorder addition test checks. NFC.

As suggested on D72423 we should try to keep the same order as the original IR

3 years ago[NFC] Run update script on test
Sam Parker [Mon, 17 Aug 2020 11:50:30 +0000 (12:50 +0100)]
[NFC] Run update script on test

Update IndVarSimplify/no-iv-rewrite.ll

3 years ago[LLD][ELF] - Do not produce an invalid dynamic relocation order with --shuffle-sections.
Georgii Rymar [Mon, 10 Aug 2020 14:00:53 +0000 (17:00 +0300)]
[LLD][ELF] - Do not produce an invalid dynamic relocation order with --shuffle-sections.

Normally (when not on android with android relocation packing enabled),
we put IRelative relocations to ".rel[a].dyn", after other relocations,
to ensure that IRelatives are processed last by the dynamic loader.

To achieve that we add the `in.relaIplt` after the `part.relaDyn`:
https://github.com/llvm/llvm-project/blob/master/lld/ELF/Writer.cpp#L540

The problem is that `--shuffle-sections` might break the sections order.
This patch fixes it.

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

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

3 years ago[lldb][NFC] Remove name parameter from CreateFunctionTemplateDecl
Raphael Isemann [Mon, 17 Aug 2020 11:38:21 +0000 (13:38 +0200)]
[lldb][NFC] Remove name parameter from CreateFunctionTemplateDecl

It's unused and not documented.

3 years ago[lldb][NFC] Use expect_expr in more tests
Raphael Isemann [Mon, 17 Aug 2020 11:08:40 +0000 (13:08 +0200)]
[lldb][NFC] Use expect_expr in more tests

3 years ago[X86][AVX] Move lowerShuffleWithVPMOV inside explicit shuffle lowering cases
Simon Pilgrim [Mon, 17 Aug 2020 10:17:20 +0000 (11:17 +0100)]
[X86][AVX] Move lowerShuffleWithVPMOV inside explicit shuffle lowering cases

Perform lowerShuffleWithVPMOV as part of the v16i8/v8i16 shuffle lowering stages, which are the only types that are currently supported.

We need to expand support for lowering shuffles as truncations to fix the remaining regressions in D66004

3 years ago[lldb][NFC] Use the proper type for the 'storage' parameter of CreateFunctionDeclaration
Raphael Isemann [Mon, 17 Aug 2020 10:47:12 +0000 (12:47 +0200)]
[lldb][NFC] Use the proper type for the 'storage' parameter of CreateFunctionDeclaration

All the callers pass an enum and we cast the int anyway back to the actual type,
so we might as well just use the type for the parameter.

3 years ago[InlineCost] Fix scalable vectors in visitAlloca
Cullen Rhodes [Wed, 12 Aug 2020 18:03:46 +0000 (18:03 +0000)]
[InlineCost] Fix scalable vectors in visitAlloca

Discovered as part of the VLS type work (see D85128).

Reviewed By: efriedma

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

3 years ago[NFC][StackSafety] Move out sort from the loop
Vitaly Buka [Fri, 14 Aug 2020 11:17:08 +0000 (04:17 -0700)]
[NFC][StackSafety] Move out sort from the loop

3 years ago[lldb] Remove OS-specific string from TestInvalidArgsLog
Raphael Isemann [Mon, 17 Aug 2020 09:53:03 +0000 (11:53 +0200)]
[lldb] Remove OS-specific string from TestInvalidArgsLog

This is the error message from the OS, so we shouldn't check against the
OS-specific part of the string.

Fixes the test on Windows which returns a different error message.

3 years ago[lldb] Don't delete orphaned shared modules in SBDebugger::DeleteTarget
Raphael Isemann [Mon, 17 Aug 2020 09:03:36 +0000 (11:03 +0200)]
[lldb] Don't delete orphaned shared modules in SBDebugger::DeleteTarget

In D83876 the consensus seems that LLDB should never deleted orphaned modules
implicitly. However, SBDebugger::DeleteTarget is currently doing exactly that.
This code was added in 753406221b55b95141c8c1239660dc4db4e35ea5 but I don't see
any explanation in the commit, so I think we should delete it.

Reviewed By: clayborg

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

3 years ago[lldb/Utility] Simplify and generalize Scalar class
Pavel Labath [Mon, 27 Jul 2020 13:06:48 +0000 (15:06 +0200)]
[lldb/Utility] Simplify and generalize Scalar class

The class contains an enum listing all host integer types as well as
some non-host types. This setup is a remnant of a time when this class
was actually implemented in terms of host integer types. Now that we are
using llvm::APInt, they are mostly useless and mean that each function
needs to enumerate all of these cases even though it treats most of them
identically.

I only leave e_sint and e_uint to denote the integer signedness, but I
want to remove that in a follow-up as well.

Removing these cases simplifies most of these functions, with the only
exception being PromoteToMaxType, which can no longer rely on a simple
enum comparison to determine what needs to be promoted.

This also makes the class ready to work with arbitrary integer sizes, so
it does not need to be modified when someone needs to add a larger
integer size.

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

3 years ago[lldb] Forcefully complete a type when adding nested classes
Pavel Labath [Fri, 14 Aug 2020 12:21:09 +0000 (14:21 +0200)]
[lldb] Forcefully complete a type when adding nested classes

With -flimit-debug-info, we can run into cases when we only have a class
as a declaration, but we do have a definition of a nested class. In this
case, clang will hit an assertion when adding a member to an incomplete
type (but only if it's adding a c++ class, and not C struct).

It turns out we already had code to handle a similar situation arising
in the -gmodules scenario. This extends the code to handle
-flimit-debug-info as well, and reorganizes bits of other code handling
completion of types to move functions doing similar things closer
together.

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

3 years ago[lldb] Add SBModule::GarbageCollectAllocatedModules and clear modules after each...
Raphael Isemann [Mon, 17 Aug 2020 08:56:02 +0000 (10:56 +0200)]
[lldb] Add SBModule::GarbageCollectAllocatedModules and clear modules after each test run

Right now the only places in the SB API where lldb:: ModuleSP instances are
destroyed are in SBDebugger::MemoryPressureDetected (where it's just attempted
but not guaranteed) and in SBDebugger::DeleteTarget (which will be removed in
D83933). Tests that directly create an lldb::ModuleSP and never create a target
therefore currently leak lldb::Module instances. This triggers the sanity checks
in lldbtest that make sure that the global module list is empty after a test.

This patch adds SBModule::GarbageCollectAllocatedModules as an explicit way to
clean orphaned lldb::ModuleSP instances. Also we now start calling this method
at the end of each test run and move the sanity check behind that call to make
this work. This way even tests that don't create targets can pass the sanity
check.

This fixes TestUnicodeSymbols.py when D83865 is applied (which makes that the
sanity checks actually fail the test).

Reviewed By: JDevlieghere

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

3 years ago[lldb] Fix that log enable's -f parameter causes LLDB to crash when it can't open...
Raphael Isemann [Mon, 17 Aug 2020 08:30:23 +0000 (10:30 +0200)]
[lldb] Fix that log enable's -f parameter causes LLDB to crash when it can't open the log file

We didn't do anything with the llvm::Error we get from `Open`, so when we end up in the
error case we just crash due to the llvm::Error sanity check. Also add the missing newline
behind the error message so it no longer messes with the next (lldb) prompt.

Reviewed By: JDevlieghere

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

3 years ago[lldb] Get lldb-server platform's --socket-file working again
Raphael Isemann [Mon, 17 Aug 2020 08:25:20 +0000 (10:25 +0200)]
[lldb] Get lldb-server platform's --socket-file working again

`lldb-server platform --socket-file /any/path` currently always fails to create
the socket file.  This stopped working after D67424 which changed the
input variables of `writeFileAtomically` slightly. We're expected to
pass in a temporary path template (`/tmp/foo-%%%%%`) and the final
path we want to write. Instead we currently pass in the never set
`temp_file_path` as the temporary path (which will make this function always
fail) and pass in the temp_file_spec's path as the final path (which is actually
the template path such as `/tmp/foo-%%%%%`) instead of the actual path
we want to write (e.g. `/tmp/foo`).

Reviewed By: labath

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

3 years ago[VE] Support f128
Kazushi (Jam) Marukawa [Sat, 27 Jun 2020 10:08:09 +0000 (19:08 +0900)]
[VE] Support f128

Support f128 using VE instructions.  Update regression tests.
I've noticed there is no load or store i128 test, so I add them too.

Reviewed By: simoll

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