platform/upstream/llvm.git
3 years agoFix "Unknown arguments specified" to if in lldb
Christopher Tetreault [Wed, 21 Oct 2020 14:23:54 +0000 (07:23 -0700)]
Fix "Unknown arguments specified" to if in lldb

Reviewed By: labath

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

3 years ago[lldb] Port lldb gdb-server to libOption
Pavel Labath [Thu, 15 Oct 2020 15:22:33 +0000 (17:22 +0200)]
[lldb] Port lldb gdb-server to libOption

The existing help text was very terse and was missing several important
options. In the new version, I add a short description of each option
and a slightly longer description of the tool as a whole.

The new option list does not include undocumented no-op options:
--debug and --verbose. It also does not include undocumented short
aliases for long options, with two exceptions: -h, because it's
well-known; and -S (--setsid), as it's used in one test. Using these
options will now produce an error. I believe that is acceptable as users
aren't generally invoking lldb-server directly, and the only way to
learn about the short aliases was by looking at the source.

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

3 years agoRemove .svn from exclude list as we moved to git
Sylvestre Ledru [Wed, 21 Oct 2020 14:09:07 +0000 (16:09 +0200)]
Remove .svn from exclude list as we moved to git

Reviewed By: emaste

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

3 years ago[ARM] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans
Paul C. Anagnostopoulos [Tue, 20 Oct 2020 20:41:56 +0000 (16:41 -0400)]
[ARM] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans

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

3 years ago[nfc] [lldb] Fix harmless slicing of DWARFDIE
Jan Kratochvil [Wed, 21 Oct 2020 13:49:53 +0000 (15:49 +0200)]
[nfc] [lldb] Fix harmless slicing of DWARFDIE

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

3 years ago[DebugInfo] Follow up c521e44defb5 with an API improvement
Jeremy Morse [Wed, 21 Oct 2020 13:28:28 +0000 (14:28 +0100)]
[DebugInfo] Follow up c521e44defb5 with an API improvement

As mentioned post-commit in D85749, the 'substituteDebugValuesForInst'
method added in c521e44defb5 would be better off with a limit on the
number of operands to substitute. This handles the common case of
"substitute the first operand between these two differing instructions",
or possibly up to N first operands.

3 years agoOnly run when `arm` is registered. NFC.
Michael Liao [Wed, 21 Oct 2020 13:28:50 +0000 (09:28 -0400)]
Only run when `arm` is registered. NFC.

3 years ago[libc++] Revert "Include <__config_site> from <__config>"
Louis Dionne [Wed, 21 Oct 2020 13:17:30 +0000 (09:17 -0400)]
[libc++] Revert "Include <__config_site> from <__config>"

This temporarily reverts commit 1e46d1aa until I find a solution to fix
the libc++abi and libunwind test suites with that change.

3 years ago[CostModel] remove cost-kind predicate for memcpy cost
Sanjay Patel [Wed, 21 Oct 2020 12:25:09 +0000 (08:25 -0400)]
[CostModel] remove cost-kind predicate for memcpy cost

The default implementation base returns TCC_Expensive (currently
set to '4'), so that explains the test diff. This probably does
not make sense for most callers, but at least now the costs will
be consistently wrong instead of mysteriously wrong.

The ARM target has an override that tries to model codegen expansion,
and that should likely be adapted for general usage.

This probably does not affect anything because the vectorizers are
the primary users of the throughput cost, but memcpy is not listed
as a trivially vectorizable intrinsic.

3 years ago[libc++] Include <__config_site> from <__config>
Louis Dionne [Fri, 26 Jun 2020 16:08:59 +0000 (12:08 -0400)]
[libc++] Include <__config_site> from <__config>

Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

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

3 years ago[SystemZ] Mark unsaved argument R6 as live throughout function.
Jonas Paulsson [Thu, 15 Oct 2020 08:04:06 +0000 (10:04 +0200)]
[SystemZ] Mark unsaved argument R6 as live throughout function.

For historical reasons, the R6 register is a callee-saved argument
register. This means that if it is used to pass an argument to a function
that does not clobber it, it is live throughout the function.

This patch makes sure that in this special case any kill flags of it are
removed.

Review: Ulrich Weigand, Eli Friedman

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

3 years ago[LIT] fixed up accidentally committed EOF problems.
Ben Dunbobbin [Wed, 21 Oct 2020 12:29:58 +0000 (13:29 +0100)]
[LIT] fixed up accidentally committed EOF problems.

3 years ago[LIT] error if directly named test won't be run indirectly
Ben Dunbobbin [Wed, 21 Oct 2020 12:09:15 +0000 (13:09 +0100)]
[LIT] error if directly named test won't be run indirectly

Currently, a LIT test named directly (on the command line) will
be run even if the name of the test file does not meet the rules
to be considered a test in the LIT test configuration files for
its test suite. For example, if the test does not have a
recognised file extension.

This makes it relatively easy to write a LIT test that won't
actually be run. I did in: https://reviews.llvm.org/D82567

This patch adds an error to avoid users doing that. There is a
small performance overhead for this check. A command line option
has been added so that users can opt into the old behaviour.

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

3 years ago[llvm] Use early exits and get rid of if-return-else-return pattern; NFC
Kirill Bobyrev [Wed, 21 Oct 2020 12:18:36 +0000 (14:18 +0200)]
[llvm] Use early exits and get rid of if-return-else-return pattern; NFC

https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code

Reviewed By: kadircet

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

3 years ago[llvm-mca] Add test for cortex-a57 memory instructions
Evgeny Leviant [Wed, 21 Oct 2020 12:09:26 +0000 (15:09 +0300)]
[llvm-mca] Add test for cortex-a57 memory instructions

3 years ago[clang testing] Fix a read-only source build system failure
David Zarzycki [Wed, 21 Oct 2020 12:07:26 +0000 (08:07 -0400)]
[clang testing] Fix a read-only source build system failure

3 years ago[Clang] Update newpm pipeline test in clang after D87322.
Florian Hahn [Wed, 21 Oct 2020 11:59:50 +0000 (12:59 +0100)]
[Clang] Update newpm pipeline test in clang after D87322.

This fixes a test failure because a LLVM pipeline test file in clang/
did not get updated in 88241ffb5636.

3 years ago[InstCombine] foldOrOfICmps - use m_Specific instead of explicit comparisons. NFCI.
Simon Pilgrim [Wed, 21 Oct 2020 10:53:25 +0000 (11:53 +0100)]
[InstCombine] foldOrOfICmps - use m_Specific instead of explicit comparisons. NFCI.

3 years ago[DAG] getNode(ISD::EXTRACT_SUBVECTOR) Drop unnecessary N2C null check - we assert...
Simon Pilgrim [Wed, 21 Oct 2020 10:08:25 +0000 (11:08 +0100)]
[DAG] getNode(ISD::EXTRACT_SUBVECTOR) Drop unnecessary N2C null check - we assert that this isn't null and have already used the pointer. NFCI.

Fixes cppcheck + null dereference warning.

3 years agoAdd "SkipDead" parameter to TargetInstrInfo::DefinesPredicate
Nicholas Guy [Mon, 28 Sep 2020 15:49:41 +0000 (16:49 +0100)]
Add "SkipDead" parameter to TargetInstrInfo::DefinesPredicate

Some instructions may be removable through processes such as IfConversion,
however DefinesPredicate can not be made aware of when this should be considered.
This parameter allows DefinesPredicate to distinguish these removable instructions
on a per-call basis, allowing for more fine-grained control from processes like
ifConversion.

Renames DefinesPredicate to ClobbersPredicate, to better reflect it's purpose

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

3 years ago[TargetLowering] Check boolean content when folding bit compare
Sven van Haastregt [Wed, 21 Oct 2020 10:46:55 +0000 (11:46 +0100)]
[TargetLowering] Check boolean content when folding bit compare

Updates an optimization that relies on boolean contents being either 0
or 1 to properly check for this before triggering.

The following:
  (X & 8) != 0 --> (X & 8) >> 3
Produces unexpected results when a boolean 'true' value is represented
by negative one.

Patch by Erik Hogeman.

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

3 years ago[TargetLowering] Add test for bit comparison fold
Sven van Haastregt [Wed, 21 Oct 2020 09:02:50 +0000 (10:02 +0100)]
[TargetLowering] Add test for bit comparison fold

This adds a test covering an issue in bit comparison folding.  The
issue will be addressed in the subsequent commit.

Patch by Erik Hogeman.

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

3 years ago[AMDGPU] Fix off by one in assert
Sebastian Neubauer [Tue, 20 Oct 2020 16:23:24 +0000 (18:23 +0200)]
[AMDGPU] Fix off by one in assert

D89217 did not subtract one when accessing SubRegFromChannelTable in one
place.

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

3 years ago[Driver] Incorporate -mfloat-abi in the computed triple on ARM
John Brawn [Wed, 21 Oct 2020 10:18:04 +0000 (11:18 +0100)]
[Driver] Incorporate -mfloat-abi in the computed triple on ARM

LLVM assumes that when it creates a call to a C library function it
can use the C calling convention. On ARM the effective calling
convention is determined from the target triple, however using
-mfloat-abi=hard on ARM means that calls to (and definitions of) C
library functions use the arm_aapcs_vfpcc calling convention which can
result in a mismatch.

Fix this by incorporating -mfloat-abi into the target triple, similar
to how -mbig-endian and -march/-mcpu are. This only works for EABI
targets and not Android or iOS, but there the float abi is fixed so
instead give an error.

Fixes PR45524

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

3 years ago[ADT] Fix for ImmutableMapRef
Adam Balogh [Thu, 15 Oct 2020 13:07:48 +0000 (15:07 +0200)]
[ADT] Fix for ImmutableMapRef

The `Root` member of `ImmutableMapRef` was changed recently from a plain
pointer to `IntrusiveRefCntPtr`. However, the `Profile` member function
was not adjusted. This results in comilation error whenever the
`Profile` method is used on an `ImmutableMapRef`. This patch fixes this
issue and also adds unit tests for `ImmutableMapRef`.

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

3 years ago[InstructionSimplify] And precommit more tests for D89317. NFC.
Sjoerd Meijer [Wed, 21 Oct 2020 09:53:28 +0000 (10:53 +0100)]
[InstructionSimplify] And precommit more tests for D89317. NFC.

3 years ago[mlir] ODS: support TableGen dag objects to specify OpBuilder parameters
Alex Zinenko [Fri, 16 Oct 2020 09:40:34 +0000 (11:40 +0200)]
[mlir] ODS: support TableGen dag objects to specify OpBuilder parameters

Historically, custom builder specification in OpBuilder has been accepting the
formal parameter list for the builder method as a raw string containing C++.
While this worked well to connect the signature and the body, this became
problematic when ODS needs to manipulate the parameter list, e.g. to inject
OpBuilder or to trim default values when generating the definition. This has
also become inconsistent with other method declarations, in particular in
interface definitions.

Introduce the possibility to define OpBuilder formal parameters using a
TableGen dag similarly to other methods. Additionally, introduce a mechanism to
declare parameters with default values using an additional class. This
mechanism can be reused in other methods. The string-based builder signature
declaration is deprecated and will be removed after a transition period.

Reviewed By: jpienaar

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

3 years ago[Passes] Move ADCE before DSE & LICM.
Florian Hahn [Wed, 21 Oct 2020 09:21:50 +0000 (10:21 +0100)]
[Passes] Move ADCE before DSE & LICM.

The adjustment seems to have very little impact on optimizations.
The only binary change with -O3 MultiSource/SPEC2000/SPEC2006 on X86 is
in consumer-typeset and the size there actually decreases by -0.1%, with
not significant changes in the stats.

On its own, it is mildly positive in terms of compile-time, most likely
due to LICM & DSE having to process slightly less instructions. It
should also be unlikely that DSE/LICM make much new code dead.

http://llvm-compile-time-tracker.com/compare.php?from=df63eedef64d715ce1f31843f7de9c11fe1e597f&to=e3bdfcf94a9eeae6e006d010464f0c1b3550577d&stat=instructions

With DSE & MemorySSA, it gives some nice compile-time improvements, due
to the fact that DSE can re-use the PDT from ADCE, if it does not make
any changes:

http://llvm-compile-time-tracker.com/compare.php?from=15fdd6cd7c24c745df1bb419e72ff66fd138aa7e&to=481f494515fc89cb7caea8d862e40f2c910dc994&stat=instructions

Reviewed By: xbolva00

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

3 years ago[InstructionSimplify] Precommit more tests for D89317. NFC.
Sjoerd Meijer [Wed, 21 Oct 2020 09:02:04 +0000 (10:02 +0100)]
[InstructionSimplify] Precommit more tests for D89317. NFC.

3 years ago[AMDGPU][TableGen] Make more use of !ne !not !and !or. NFC.
Jay Foad [Wed, 21 Oct 2020 08:17:28 +0000 (09:17 +0100)]
[AMDGPU][TableGen] Make more use of !ne !not !and !or. NFC.

3 years agoReapply "[clang] Improve handling of physical registers in inline
Jonas Paulsson [Wed, 14 Oct 2020 06:48:29 +0000 (08:48 +0200)]
Reapply "[clang] Improve handling of physical registers in inline
         assembly operands."

Earlyclobbers are now excepted from this change (original commit: c78da03).

Review: Ulrich Weigand, Nick Desaulniers

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

3 years ago[compiler-rt][builtins][RISCV] Always include __mul[sd]i3 builtin definitions
Luís Marques [Wed, 21 Oct 2020 08:47:25 +0000 (09:47 +0100)]
[compiler-rt][builtins][RISCV] Always include __mul[sd]i3 builtin definitions

The RISC-V implementations of the `__mulsi3`, `__muldi3` builtins were
conditionally compiling the actual function definitions depending on whether
the M extension was present or not. This caused Compiler-RT testing failures
for RISC-V targets with the M extension, as when these sources were included
the `librt_has_mul*i3` features were still being defined. These `librt_has_*`
definitions are used to conditionally run the respective tests. Since the
actual functions were not being compiled-in, the generic test for `__muldi3`
would fail. This patch makes these implementations follow the normal
Compiler-RT convention of always including the definition, and conditionally
running the respective tests by using the lit conditional
`REQUIRES: librt_has_*`.

Since the `mulsi3_test.c` wasn't actually RISC-V-specific, this patch also
moves it out of the `riscv` directory. It now only depends on
`librt_has_mulsi3` to run.

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

3 years ago[NFC][LSAN] Use InitializeCommonFlags in LSAN
Vitaly Buka [Wed, 21 Oct 2020 08:33:21 +0000 (01:33 -0700)]
[NFC][LSAN] Use InitializeCommonFlags in LSAN

3 years ago[X86] Add clang release notes for HRESET and minor change for llvm release notes...
Wang, Pengfei [Wed, 21 Oct 2020 07:57:43 +0000 (15:57 +0800)]
[X86] Add clang release notes for HRESET and minor change for llvm release notes. (NFC)

3 years ago[mlir] Fix copy-pasted docstrings in Python bindings
Alex Zinenko [Tue, 20 Oct 2020 09:22:29 +0000 (11:22 +0200)]
[mlir] Fix copy-pasted docstrings in Python bindings

Docstrings for `__str__` method in many classes was recycling the constant
string defined for `Type`, without being types themselves. Use proper
docstrings instead. Since they are succint, use string literals instead of
top-level constants to avoid further mistakes.

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

3 years ago[mlir] Use the correct base class for Attributes in Python bindings
Alex Zinenko [Tue, 20 Oct 2020 09:22:02 +0000 (11:22 +0200)]
[mlir] Use the correct base class for Attributes in Python bindings

The pybind class typedef for concrete attribute classes was erroneously
deriving all of them from PyAttribute instead of the provided base class. This
has not been triggering any error because only one level of the hierarchy is
currently exposed.

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

3 years ago[mlir] Expose Value hierarchy to Python bindings
Alex Zinenko [Tue, 20 Oct 2020 09:21:05 +0000 (11:21 +0200)]
[mlir] Expose Value hierarchy to Python bindings

Values are ubiquitous in the IR, in particular block argument and operation
results are Values. Define Python classes for BlockArgument, OpResult and their
common ancestor Value. Define pseudo-container classes for lists of block
arguments and operation results, and use these containers to access the
corresponding values in blocks and operations.

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

3 years ago[X86] Remove period from end of error message in assembler
Craig Topper [Wed, 21 Oct 2020 07:42:39 +0000 (00:42 -0700)]
[X86] Remove period from end of error message in assembler

Addresses post-commit feedback from D89837.

3 years ago[SVE][CodeGen] Replace use of TypeSize comparison operator in CreateStackTemporary
David Sherwood [Wed, 30 Sep 2020 12:36:59 +0000 (13:36 +0100)]
[SVE][CodeGen] Replace use of TypeSize comparison operator in CreateStackTemporary

We were previously relying upon the TypeSize comparison operators to
obtain the maximum size of two types, however use of such operators is
being deprecated in favour of making the caller aware that it could
be dealing with scalable vector types. I have changed the code to assert
that the two types have the same scalable property and thus we can
simply take the maximum of the known minimum sizes instead.

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

3 years ago[SVE] Remove reliance on TypeSize comparison operators in unit tests
David Sherwood [Fri, 9 Oct 2020 13:29:15 +0000 (14:29 +0100)]
[SVE] Remove reliance on TypeSize comparison operators in unit tests

The EXPECT_XY comparison functions all rely upon using the existing
TypeSize comparison operators, which we are deprecating in favour
of isKnownXY. I've changed all such cases to compare either the known
minimum size or the fixed size.

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

3 years ago[libcxx] [test] Split the file_time_type synopsis test
Martin Storsjö [Fri, 16 Oct 2020 09:49:01 +0000 (12:49 +0300)]
[libcxx] [test] Split the file_time_type synopsis test

Split the resolution check to a separate test, which is marked as
unsupported on windows.

On windows (both with MS STL and libstdc++), the file time has
100 ns resolution; the standard doesn't mandate a specific resolution.

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

3 years agoRevert "[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2)...
Martin Storsjö [Wed, 21 Oct 2020 06:33:51 +0000 (09:33 +0300)]
Revert "[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support"

Also revert "[InstCombine] foldOrOfICmps - use m_Specific instead of
explicit comparisons. NFCI." to make the primarily intended revert
work.

This reverts commits ce13549761b6a22263e051dda09ef5122435008b and
e372a5f86f6488bb0c2593a665d51fdd3a97c6e4.

This commit caused failed asserts e.g. like this:

$ cat repro.cpp
bool a(char b) {
  return b >= '0' && b <= '9' || (b | 32) >= 'a' && (b | 32) <= 'z';
$ clang++ -target x86_64-linux-gnu -c -O2 repro.cpp
clang++: ../include/llvm/ADT/APInt.h:1151: bool llvm::APInt::operator==(const
llvm::APInt&) const: Assertion `BitWidth == RHS.BitWidth && "Comparison
requires equal bit widths"' failed.

3 years ago[NFC][PowerPC]Add tests for folding RLWINM before and after RA.
Esme-Yi [Wed, 21 Oct 2020 06:38:22 +0000 (06:38 +0000)]
[NFC][PowerPC]Add tests for folding RLWINM before and after RA.

3 years agoRevert "[SCEV] Prove implications of different type via truncation"
Max Kazantsev [Wed, 21 Oct 2020 06:03:46 +0000 (13:03 +0700)]
Revert "[SCEV] Prove implications of different type via truncation"

This reverts commit 80852a4f2fb154c6094bb9d9e3457757d5a60ad1.

Test is now broken because underlying required patch was also reverted SUDDENLY.

3 years ago[SCEV] Prove implications of different type via truncation
Max Kazantsev [Wed, 21 Oct 2020 05:42:40 +0000 (12:42 +0700)]
[SCEV] Prove implications of different type via truncation

When we need to prove implication of expressions of different type width,
the default strategy is to widen everything to wider type and prove in this
type. This does not interact well with AddRecs with negative steps and
unsigned predicates: such AddRec will likely not have a `nuw` flag, and its
`zext` to wider type will not be an AddRec. In contraty, `trunc` of an AddRec
in some cases can easily be proved to be an `AddRec` too.

This patch introduces an alternative way to handling implications of different
type widths. If we can prove that wider type values actually fit in the narrow type,
we truncate them and prove the implication in narrow type.

Differential Revision: https://reviews.llvm.org/D89548
Reviewed By: fhahn

3 years ago[X86] Error on using h-registers with REX prefix in the assembler instead of leaving...
Craig Topper [Wed, 21 Oct 2020 03:59:27 +0000 (20:59 -0700)]
[X86] Error on using h-registers with REX prefix in the assembler instead of leaving it to a fatal error in the encoder.

Using a fatal error is bad for user experience.

Reviewed By: pengfei

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

3 years agoRevert D89381 "[SCEV] Recommit "Use nw flag and symbolic iteration count to sharpen...
Fangrui Song [Wed, 21 Oct 2020 04:03:58 +0000 (21:03 -0700)]
Revert D89381 "[SCEV] Recommit "Use nw flag and symbolic iteration count to sharpen ranges of AddRecs", attempt 2"

This reverts commit a10a64e7e334dc878d281aba9a46f751fe606567.

It broke polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll
The difference suggests that this may be a serious issue.

3 years ago[NFC][MC] Use [MC]Register in MachineVerifier
Mircea Trofin [Tue, 20 Oct 2020 19:09:38 +0000 (12:09 -0700)]
[NFC][MC] Use [MC]Register in MachineVerifier

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

3 years agoRemove unnecessary header include which violates layering
Geoffrey Martin-Noble [Wed, 21 Oct 2020 02:35:17 +0000 (19:35 -0700)]
Remove unnecessary header include which violates layering

This was introduced in https://reviews.llvm.org/D89774, but I don't
think it should be necessary.

Reviewed By: TaWeiTu, aeubanks

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

3 years ago[AMDGPU][NFC] Fix missing size in comment
Carl Ritson [Wed, 21 Oct 2020 02:38:21 +0000 (11:38 +0900)]
[AMDGPU][NFC] Fix missing size in comment

3 years ago[Polly] Delete unused lambda capture after 7175cffb2133048018df74c1b49d1d4962ea18f2
Fangrui Song [Wed, 21 Oct 2020 01:34:31 +0000 (18:34 -0700)]
[Polly] Delete unused lambda capture after 7175cffb2133048018df74c1b49d1d4962ea18f2

3 years agoRevert "This is a test commit"
TaWeiTu [Wed, 21 Oct 2020 01:34:15 +0000 (09:34 +0800)]
Revert "This is a test commit"

This reverts commit cbe0ee1a94d11bd32019920c8f55ebd58054542a.

3 years agoThis is a test commit
TaWeiTu [Wed, 21 Oct 2020 01:33:36 +0000 (09:33 +0800)]
This is a test commit

3 years ago[test] Fix -fbasic-block-sections= test on Windows after D89500
Fangrui Song [Wed, 21 Oct 2020 01:31:21 +0000 (18:31 -0700)]
[test] Fix -fbasic-block-sections= test on Windows after D89500

3 years ago[llvm] Fix ODRViolations for VersionTuple YAML specializations NFC
Cyndy Ishida [Wed, 21 Oct 2020 00:50:29 +0000 (17:50 -0700)]
[llvm] Fix ODRViolations for VersionTuple YAML specializations NFC

It appears for Swift there was confusing errors when trying to parse APINotes, when libAPINotes and libInterfaceStub are linked, they both export symbol
`__ZN4llvm4yaml7yamlizeINS_12VersionTupleEEENSt3__19enable_ifIXsr16has_ScalarTraitsIT_EE5valueEvE4typeERNS0_2IOERS5_bRNS0_12EmptyContextE`, and discovered
same symbol defined within llvm-ifs.

This consolidates the boilerplate into YAMLTraits and defers the specific validation in reading the whole input.
fixes: rdar://problem/70450563

Reviewed By: phosek, dblaikie

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

3 years agoSourceManager: Simplify early returns in ContentCache::getBufferOrNone, NFC
Duncan P. N. Exon Smith [Mon, 19 Oct 2020 19:28:38 +0000 (15:28 -0400)]
SourceManager: Simplify early returns in ContentCache::getBufferOrNone, NFC

As suggested in the review for https://reviews.llvm.org/D89430, simplify
the logic for marking the buffer as invalid in the early return paths.

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

3 years ago[lldb] Don't strip LLDB.framework on install
Jonas Devlieghere [Wed, 21 Oct 2020 01:15:45 +0000 (18:15 -0700)]
[lldb] Don't strip LLDB.framework on install

The framework build will run dsymutil after LLDB.framework is installed.

3 years ago[flang] Fix call to CHECK() on erroneous subroutine declaration
Peter Steinfeld [Tue, 20 Oct 2020 22:05:35 +0000 (15:05 -0700)]
[flang] Fix call to CHECK() on erroneous subroutine declaration

When processing declarations in resolve-names.cpp, we were returning a
symbol that had SubprogramName details to PushSubprogramScope(), which
expects a symbol with Subprogram details.

I adjusted the code and added a test.

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

3 years agoContentCache: Simplify by always owning the MemoryBuffer
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 22:57:04 +0000 (18:57 -0400)]
ContentCache: Simplify by always owning the MemoryBuffer

This changes `ContentCache::Buffer` to use
`std::unique_ptr<MemoryBuffer>` instead of the `PointerIntPair`. It
drops the (mostly unused) `DoNotFree` bit, instead creating a (new)
non-owning `MemoryBuffer` instance when passed a `MemoryBufferRef`.

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

3 years agoNFC: Fix -Wsign-compare warnings on 32-bit builds
Hubert Tong [Wed, 21 Oct 2020 00:50:38 +0000 (20:50 -0400)]
NFC: Fix -Wsign-compare warnings on 32-bit builds

Comparing 32-bit `ptrdiff_t` against 32-bit `unsigned` results in
`-Wsign-compare` warnings for both GCC and Clang.

The warning for the cases in question appear to identify an issue
where the `ptrdiff_t` value would be mutated via conversion to an
unsigned type.

The warning is resolved by using the usual arithmetic conversions to
safely preserve the value of the `unsigned` operand while trying to
convert to a signed type. Host platforms where `unsigned` has the same
width as `unsigned long long` will need to make a different change, but
using an explicit cast has disadvantages that can be avoided for now.

Reviewed By: dantrushin

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

3 years agoDon't instantiate lambda closure types in default member initializers
Richard Smith [Wed, 21 Oct 2020 00:35:15 +0000 (17:35 -0700)]
Don't instantiate lambda closure types in default member initializers
when instantiating the enclosing class.

We'll build new lambda closure types if and when we instantiate the
default member initializer, and instantiating the closure type by itself
can go wrong in cases where we fully-instantiate nested classes (in
explicit instantiations of the enclosing class and when the enclosing
class is a local class) -- we will instantiate the 'operator()' as a
regular function rather than as a lambda call operator, so it doesn't
get to use its captures, has the wrong 'this' type, etc.

3 years ago[AMDGPU] Avoid inserting noops during scheduling
Austin Kerbow [Mon, 19 Oct 2020 23:54:24 +0000 (16:54 -0700)]
[AMDGPU] Avoid inserting noops during scheduling

Passes that are run after the post-RA scheduler may insert instructions like
waitcnt which eliminate the need for certain noops. After this patch the
scheduler is still aware of possible latency from hazards but noops will
not be inserted until the dedicated hazard recognizer pass is run.

Depends on D89753.

Reviewed By: foad

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

3 years ago[HazardRec] Allow inserting multiple wait-states simultaneously
Austin Kerbow [Mon, 19 Oct 2020 21:38:02 +0000 (14:38 -0700)]
[HazardRec] Allow inserting multiple wait-states simultaneously

If a target can encode multiple wait-states into a noop allow emitting such
instructions directly.

Reviewed By: rampitec, dmgreen

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

3 years agoDon't permit array bound constant folding in OpenCL.
Richard Smith [Fri, 16 Oct 2020 00:50:48 +0000 (17:50 -0700)]
Don't permit array bound constant folding in OpenCL.

Permitting non-standards-driven "do the best you can" constant-folding
of array bounds is permitted solely as a GNU compatibility feature. We
should not be doing it in any language mode that is attempting to be
conforming.

From https://reviews.llvm.org/D20090 it appears the intent here was to
permit `__constant int` globals to be used in array bounds, but the
change in that patch only added half of the functionality necessary to
support that in the constant evaluator. This patch adds the other half
of the functionality and turns off constant folding for array bounds in
OpenCL.

I couldn't find any spec justification for accepting the kinds of cases
that D20090 accepts, so a reference to where in the OpenCL specification
this is permitted would be useful.

Note that this change also affects the code generation in one test:
because after 'const int n = 0' we now treat 'n' as a constant
expression with value 0, it's now a null pointer, so '(local int *)n'
forms a null pointer rather than a zero pointer.

Reviewed By: Anastasia

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

3 years agoImprove file doesnt exist error with -fbasic-block-sections=
Sriraman Tallam [Tue, 20 Oct 2020 23:39:44 +0000 (16:39 -0700)]
Improve file doesnt exist error with -fbasic-block-sections=

With -fbasicblock-sections=, let the front-end handle the case where the file
doesnt exist. The driver only checks if the option syntax is right.

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

3 years agoclang/Basic: ContentCache::InvalidFlag => ContentCache::IsBufferInvalid, NFC
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 21:54:44 +0000 (17:54 -0400)]
clang/Basic: ContentCache::InvalidFlag => ContentCache::IsBufferInvalid, NFC

Move a flag out of the `MemoryBuffer*` to unblock changing it to a
`unique_ptr`. There are plenty of bits available in the bitfield below.

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

3 years ago[Polly] Reuse multiple uses in operand tree.
Michael Kruse [Fri, 16 Oct 2020 17:37:34 +0000 (12:37 -0500)]
[Polly] Reuse multiple uses in operand tree.

Recursively traversing the operand tree leads to an exponential blowup
if instructions are used multiple times due to every path leading to an
additional copy of the instructions after forwarding. This problem was
marked as a TODO in the code and was reported as a bug in llvm.org/PR47340.

Fix by caching already visited instructions and returning the cached
version when already visited. Instead of calling forwardTree() twice,
return a ForwardingAction structure that contains a lambda which will
carry-out the forwarding when requested. The lambdas are executed in
reverse-postorder to mimic the previous recursive calls unless there
is a reuse.

Fixes llvm.org/PR47340

3 years ago[GWP-ASan] Rework utilities (NFC)
Kostya Kortchinsky [Tue, 20 Oct 2020 18:15:52 +0000 (11:15 -0700)]
[GWP-ASan] Rework utilities (NFC)

Few changes wrt utilities:
- split `Check` into a platform agnostic condition test and a platform
  specific termination, for which we introduce the function `die`.
- add a platform agnostic `utilities.cpp` that gets the allocation
  alignment functions original in the platform specific file, as they
  are reusable by all platforms.

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

3 years ago[AMDGPU] Optimize waitcnt insertion for flat memory operations
Tony [Fri, 16 Oct 2020 07:09:38 +0000 (07:09 +0000)]
[AMDGPU] Optimize waitcnt insertion for flat memory operations

Change waitcnt insertion to check the memory operand tokens to see if
flat memory operations access VMEM in the same way it does to check if
accessing LDS. This avoids adding waitcnt for counters for address
spaces that are not accessed.

In addition, only generate the pessimistic waitcnt 0 if a flat memory
operation appears to access both VMEM and LDS.

This benefits flat memory operations that explicitly specify the
address space as GLOBAL or LOCAL.

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

3 years ago[X86] Move 'int $3' -> 'int3' handling in the assembler to processInstruction.
Craig Topper [Tue, 20 Oct 2020 21:31:47 +0000 (14:31 -0700)]
[X86] Move 'int $3' -> 'int3' handling in the assembler to processInstruction.

Instead of handling before parsing, just fix it after parsing.

3 years ago[X86] Move 's{hr,ar,hl} , <op>' to 'shift <op>' optimization in the assembler into...
Craig Topper [Tue, 20 Oct 2020 21:17:07 +0000 (14:17 -0700)]
[X86] Move 's{hr,ar,hl} , <op>' to 'shift <op>' optimization in the assembler into processInstruction.

Instead of detecting the mnemonic and hacking the operands before
parsing. Just fix it up after parsing.

3 years ago[libc++] Get rid of <sstream> in the valarray tests
Louis Dionne [Mon, 19 Oct 2020 20:51:33 +0000 (16:51 -0400)]
[libc++] Get rid of <sstream> in the valarray tests

3 years agoclang/Basic: Remove SourceManager::getBufferPointer, NFC
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 22:17:01 +0000 (18:17 -0400)]
clang/Basic: Remove SourceManager::getBufferPointer, NFC

Inline `Source::getBufferPointer` into its only remaining caller,
`getBufferOrNone`. No functionality change.

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

3 years ago[AsmWriter] Construct SlotTracker with the function
Kazu Hirata [Tue, 20 Oct 2020 22:01:39 +0000 (15:01 -0700)]
[AsmWriter] Construct SlotTracker with the function

This patch teaches BasicBlock::print to construct an instance of
SlotTracker with the containing function.

Without this patch, we dump:

*** IR Dump After LoopInstSimplifyPass ***
; Preheader:
  br label %1

; Loop:
<badref>:                                         ; preds = %1, %0
  br label %1

Note "<badref>" above.  This happens because BasicBlock::print calls:

  SlotTracker SlotTable(this->getModule());

Note that this constructor does not add the contents of functions to
the slot table.  That is, basic blocks are left unnumbered.

This patch fixes the problem by switching to:

  SlotTracker SlotTable(this->getParent());

which does add the contents of the Module and the function,
this->getParent(), to the slot table.

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

3 years agoFix pretty printing of linalg GenericOps when there are no inputs.
Federico Lebrón [Tue, 20 Oct 2020 21:37:38 +0000 (14:37 -0700)]
Fix pretty printing of linalg GenericOps when there are no inputs.

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

3 years agoGet the address space within getVectorPtrTy
Christopher Tetreault [Tue, 20 Oct 2020 18:32:28 +0000 (11:32 -0700)]
Get the address space within getVectorPtrTy

getVectorPtrTy is private to VectorBlockGenerator, and all uses query
the address space from the passed-in pointer prior to calling it.

Reviewed By: efriedma

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

3 years ago[clangd][ObjC] Support nullability annotations
David Goldman [Fri, 16 Oct 2020 18:14:37 +0000 (14:14 -0400)]
[clangd][ObjC] Support nullability annotations

Nullability annotations are implmented using attributes; previusly
clangd would skip over AttributedTypeLoc since their location
points to the attribute instead of the modified type.

Also add some test cases for this.

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

3 years ago[LSAN][NFC] Reformat test
Vitaly Buka [Tue, 20 Oct 2020 21:16:27 +0000 (14:16 -0700)]
[LSAN][NFC] Reformat test

3 years ago[hwasan] Increase max allocation size to 1Tb.
Evgenii Stepanov [Mon, 19 Oct 2020 23:38:03 +0000 (16:38 -0700)]
[hwasan] Increase max allocation size to 1Tb.

2Gb is unreasonably low on devices with 12Gb RAM and more.

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

3 years agoclang/Basic: Replace SourceManager::getMemoryBufferForFile, NFC
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 22:06:29 +0000 (18:06 -0400)]
clang/Basic: Replace SourceManager::getMemoryBufferForFile, NFC

Replace `SourceManager::getMemoryBufferForFile`, which returned a
dereferenceable `MemoryBuffer*` and had a `bool*Invalid` out parameter,
with `getMemoryBufferForFileOrNone` (returning
`Optional<MemoryBufferRef>`) and `getMemoryBufferForFileOrFake`
(returning `MemoryBufferRef`).

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

3 years ago[libc++] Remove uses of verbose_assert.h in Filesystem tests
Louis Dionne [Tue, 20 Oct 2020 20:47:47 +0000 (16:47 -0400)]
[libc++] Remove uses of verbose_assert.h in Filesystem tests

For a modest loss of debugability in the tests, this allows more tests
to run on platforms that do not have support for <iostream>.

3 years ago[Apple-stage2] Install FileCheck and yaml2obj in the toolchain
Jonas Devlieghere [Tue, 20 Oct 2020 20:46:34 +0000 (13:46 -0700)]
[Apple-stage2] Install FileCheck and yaml2obj in the toolchain

rdar://70274446

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

3 years agoDriver: Add integer sanitizers to trapping group automatically.
Peter Collingbourne [Tue, 20 Oct 2020 05:18:18 +0000 (22:18 -0700)]
Driver: Add integer sanitizers to trapping group automatically.

In D86000 we added a new sanitizer to the integer group
without adding it to the trapping group. This broke usage of
-fsanitize=integer -fsanitize-trap=integer or -fsanitize=integer
-fsanitize-minimal-runtime.

I think we can reasonably expect any new integer sanitizers to be
compatible with trapping and the minimal runtime, so add them to the
trapping group automatically.

Also add a test to ensure that any future additions of sanitizers
to the integer group will most likely result in test failures which
would lead to updates to the minimal runtime if necessary. For this
particular sanitizer no updates are required because it uses the
existing shift_out_of_bounds callback function.

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

3 years ago[AMDGPU] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans
Paul C. Anagnostopoulos [Mon, 19 Oct 2020 14:52:15 +0000 (10:52 -0400)]
[AMDGPU] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans

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

3 years ago[libc++] Make it easier to add new restrictions for feature-test macro tests
Louis Dionne [Tue, 20 Oct 2020 19:52:57 +0000 (15:52 -0400)]
[libc++] Make it easier to add new restrictions for feature-test macro tests

3 years ago[libc++] Decouple debug mode tests from iostreams
Louis Dionne [Thu, 15 Oct 2020 21:54:15 +0000 (17:54 -0400)]
[libc++] Decouple debug mode tests from iostreams

3 years ago[ConstantFold] Fold the comparison of bitcasted global values
Shimin Cui [Tue, 20 Oct 2020 19:41:49 +0000 (12:41 -0700)]
[ConstantFold] Fold the comparison of bitcasted global values

This is to simplify icmp instructions in the form like:

%cmp = icmp eq i32 (i8*, i8*)* bitcast (i32 (i32**, i32**)* @f32 to i32
%(i8*, i8*)), bitcast (i32 (i64**, i64**) @f64 to i32 (i8*, i8*)*)

Here @f32 and @f64 are two functions.

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

3 years ago[lldb] Add a page to the docs with (external) links on how to use LLDB
Jonas Devlieghere [Tue, 20 Oct 2020 18:42:09 +0000 (11:42 -0700)]
[lldb] Add a page to the docs with (external) links on how to use LLDB

In a discussion with Jim last week we came to the realization that often
we get asked about things that might not be documented on the website,
but that have been pretty well explained elsewhere. In those situations
it's often easier to quickly answer the question than searching for that
presentation you gave 3 years ago if you remember at all.

This often results in us having to answer the same questions over and
over again. We could add the questions and their answer to the website,
but that means we (1) have to duplicate the work and (2) now have to
maintain it.

A more efficient solution is to add a page with external resources with
the caveat that they might be outdated. That's exactly the purpose of
this patch.

I've added a few links that came to mind, but I don't want to be the
arbiter of what should and should not be included. I'd hope that over
time the community can crowd-source the best resources.

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

3 years ago[NFC][Regalloc] Type 2 statics in terms of Register
Mircea Trofin [Mon, 19 Oct 2020 18:10:47 +0000 (11:10 -0700)]
[NFC][Regalloc] Type 2 statics in terms of Register

Using Register instead of unsigned.

Also added isStack to mirror the other members, and eventually remove
the static testers.

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

3 years agoHandle value uses wrapped in metadata for the use-list order
David Stenberg [Tue, 20 Oct 2020 17:30:39 +0000 (19:30 +0200)]
Handle value uses wrapped in metadata for the use-list order

When generating the use-list order, also consider value uses that are
operands which are wrapped in metadata; e.g. llvm.dbg.value operands.

This fixes PR36778. The test case is based on the reproducer from that
report.

Reviewed By: dexonsmith

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

3 years ago[gn build] Port 848a68a032d
LLVM GN Syncbot [Tue, 20 Oct 2020 17:56:26 +0000 (17:56 +0000)]
[gn build] Port 848a68a032d

3 years agoDomTree: Extract (mostly) read-only logic into type-erased base classes
Nicolai Hähnle [Tue, 20 Oct 2020 17:51:44 +0000 (19:51 +0200)]
DomTree: Extract (mostly) read-only logic into type-erased base classes

Avoid having to instantiate and compile a subset of the dominator tree logic
separately for each node type. More importantly, this allows generic
algorithms to be built on top of dominator trees without writing them as
templates -- such algorithms can now use opaque CfgBlockRef and
CfgInterface instead.

A type-erased implementation of dominator trees could be written in
terms of CfgInterface as well, but doing so would change the current
trade-off: it would slightly reduce code size at the cost of a slight
runtime overhead.

This patch does not change the trade-off, as it only does type-erasure
where basic blocks can be treated in a fully opaque way, i.e. it only
moves methods that don't require iteration over CFG successors and
predecessors.

v5:
- rename generic_{begin,end,children} back without the generic_ prefix
  and refer explictly to base class methods in NewGVN, which wants to
  mutate the order of dominator tree node children directly

v6:
- style change: iDom -> idom; it's arguable whether this is really
  invalid, since it is actually standard camelCase, but clang-tidy
  complains about it so... *shrug*
- rename {to,from}Generic -> {wrap,unwrap}Ref

Change-Id: Ib860dc04cf8bb093d8ed00be7def40d662213672

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

3 years agolldb: Migrate to MemoryBufferRef for createFileID (after 51d1d585e5838ea0f02f1271f754...
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 17:50:52 +0000 (13:50 -0400)]
lldb: Migrate to MemoryBufferRef for createFileID (after 51d1d585e5838ea0f02f1271f7543c4e43639969)

I missed these two lldb users before deleting the `UnownedTag` API for
`createFileID` in 51d1d585e5838ea0f02f1271f7543c4e43639969. This should
fix the build.

3 years ago[NPM] port -unify-loop-exits to NPM
Ta-Wei Tu [Tue, 20 Oct 2020 17:41:38 +0000 (10:41 -0700)]
[NPM] port -unify-loop-exits to NPM

Reviewed By: aeubanks

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

3 years ago[AMDGPU] Remove getAllVGPR32() which cannot handle Accum VGPRs properly
vnalamot [Tue, 20 Oct 2020 16:31:09 +0000 (22:01 +0530)]
[AMDGPU] Remove getAllVGPR32() which cannot handle Accum VGPRs properly

Remove getAllVGPR32() interface and update the SGPR spill code to use
a proper method to get the relevant VGPR registers list.

Reviewed By: arsenm

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

3 years agoFileManager: Test FileManager::getFileRef
Duncan P. N. Exon Smith [Thu, 15 Oct 2020 14:36:00 +0000 (10:36 -0400)]
FileManager: Test FileManager::getFileRef

Add a test demonstrating `getFileRef`'s behaviour, which isn't obvious
from code inspection when it's handling a redirected file.

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

3 years agoclang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager...
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 21:17:34 +0000 (17:17 -0400)]
clang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager::getBuffer)

In order to drop the final callers to `SourceManager::getBuffer`, change
`FrontendInputFile` to use `Optional<MemoryBufferRef>`. Also updated
the "unowned" version of `SourceManager::createFileID` to take a
`MemoryBufferRef` (it now calls `MemoryBuffer::getMemBuffer`, which
creates a `MemoryBuffer` that does not own the buffer data).

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

3 years ago[NPM] Port -mergereturn to NPM
Ta-Wei Tu [Tue, 20 Oct 2020 17:32:28 +0000 (10:32 -0700)]
[NPM] Port -mergereturn to NPM

Reviewed By: aeubanks

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

3 years agoASAN: Support detect_invalid_pointer_pairs=1 with detect_stack_use_after_return=1
Martin Liska [Fri, 16 Oct 2020 13:08:52 +0000 (15:08 +0200)]
ASAN: Support detect_invalid_pointer_pairs=1 with detect_stack_use_after_return=1

Do not crash when AsanThread::GetStackVariableShadowStart does not find
a variable for a pointer on a shadow stack.

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

3 years agoWrap CfgTraitsFor in namespace llvm to please GCC 5
Lei Zhang [Tue, 20 Oct 2020 17:04:02 +0000 (13:04 -0400)]
Wrap CfgTraitsFor in namespace llvm to please GCC 5