platform/upstream/llvm.git
2 years ago[clang-repl] Recover the lookup tables of the primary context.
Purva-Chaudhari [Sun, 29 May 2022 04:55:10 +0000 (04:55 +0000)]
[clang-repl] Recover the lookup tables of the primary context.

Before this patch, there was re-declaration error if error was encountered in
the same line. The recovery support acted only if this type of error was
encountered in the first line of the program and not in subsequent lines.

For example:

```
clang-repl> int i=9;
clang-repl> int j=9; err;
input_line_3:1:5: error: redefinition of 'j'
int j = 9;
```

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

2 years ago[clang] Remove `rm` script which is no longer necessary
Yuki Okushi [Sat, 28 May 2022 16:26:46 +0000 (01:26 +0900)]
[clang] Remove `rm` script which is no longer necessary

8b4fa2c98e07997469f53bee30c0d24a61dc7c8c added this to remove left-over files on January.
Now we could assume they're cleaned up and this `rm` script is no longer necessary as FIXME states.

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

2 years ago[MLIR][Presburger] Add applyDomain/Range to IntegerRelation
Groverkss [Sat, 28 May 2022 20:36:11 +0000 (02:06 +0530)]
[MLIR][Presburger] Add applyDomain/Range to IntegerRelation

This patch adds support for applying a relation on domain/range of a relation.

Reviewed By: arjunp, ftynse

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

2 years ago[VPlan] Use Exiting-block instead of Exit-block terminology (NFC).
Florian Hahn [Sat, 28 May 2022 20:16:05 +0000 (21:16 +0100)]
[VPlan] Use Exiting-block instead of Exit-block terminology (NFC).

In LLVM's common loop terminology, an exit block is a block outside a
loop with a predecessor inside the loop. An exiting block is a block
inside the loop which branches to an exit block outside the loop.

This patch updates a few places where VPlan was using ExitBlock for a
block exiting a region. Those instances have been updated to use
ExitingBlock.

Reviewed By: Ayal

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

2 years agoIncrease the default maximum stack walk
Jason Molenda [Sat, 28 May 2022 20:09:36 +0000 (13:09 -0700)]
Increase the default maximum stack walk

lldb will only backtrace a fixed number of stack frames, as a
last-ditch attempt to avoid a runaway looping backtrace.  It's
unusual that anyone ends up depending on this final safety net in
years. I picked the original number of 300000 was picked by seeing
how many stack frames I could make in a small recursive function
on Darwin systems before using the default stack space.  Checking
again today on a modern system, I can exceed this limit & lldb will
not show the original invocation of the recursing call.  Double the
old value to cover this larger maximum possible stack frame count,
as a default value.
(`target.process.thread.max-backtrace-depth`)

2 years ago[flang] Make extension explicit: exponent-letter matching kind-param
Emil Kieri [Fri, 27 May 2022 22:27:59 +0000 (00:27 +0200)]
[flang] Make extension explicit: exponent-letter matching kind-param

As an extension for REAL literals, we allow an exponent letter which
matches an explicit kind-param. The standard requires the exponent
to be 'E' if a kind-param is present. This patch
 - documents this extension in Extensions.md
 - enables a portability warning if it is used with -pedantic

The test case for this, kinds05.f90, needs D125804, which makes
test_errors.py test warnings as well, to actually test the warnings.
I include it already now to keep things together, it will do no harm
(I hope ...).

We also add WARNING-directives to the test kinds04.f90 in preparation
for D125804. As the exponent-letter 'Q' does not imply the same kind
on all platforms, the emitted warnings are platform-dependent.
Therefore, the test is duplicated into two variants which are run
conditionally.

Finally, we promote the portability warning for when the exponent letter
is neither 'E' nor matching the kind-param to a standard warning.

Reviewed By: klausler

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

2 years ago[clang][cmake] Fixed typo in hmaptool CMakeLists.txt
Daniel Hannon [Sat, 28 May 2022 17:10:10 +0000 (10:10 -0700)]
[clang][cmake] Fixed typo in hmaptool CMakeLists.txt

There was a typo in the CMakeLists.txt for hmap tool that installed it to the wrong directory

https://github.com/llvm/llvm-project/issues/55753

Reviewed By: keith

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

2 years ago[flang] Make generic resolution conform to 15.5.5.2 w/r/t host association
Peter Klausler [Thu, 26 May 2022 23:56:27 +0000 (16:56 -0700)]
[flang] Make generic resolution conform to 15.5.5.2 w/r/t host association

When two or more generic interfaces are available by declaration or
by USE association at different scoping levels, we need to search
the outer generic interfaces as well as the inner ones, but only after
the inner ones have failed to produce a specific procedure that matches
a given set of actual arguments.  This means that it is possible for
a specific procedure of a generic interface of an inner scope to override
a conflicting specific procedure of a generic interface of an outer
scope.

Also cope with forward references to derived types when a generic
interface is also in scope.

Fixes LLVM bug https://github.com/llvm/llvm-project/issues/55240 and
LLVM bug https://github.com/llvm/llvm-project/issues/55300.

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

2 years ago[nfc][flang] Fix spelling errors and usage in an error message
Peter Klausler [Thu, 26 May 2022 18:01:19 +0000 (11:01 -0700)]
[nfc][flang] Fix spelling errors and usage in an error message

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

2 years agoRemove `deplibs` keyword completely
Yuki Okushi [Fri, 27 May 2022 10:21:52 +0000 (19:21 +0900)]
Remove `deplibs` keyword completely

D102763 removed the almost support of `deplibs` but it seems `kw_deplibs` was missed.
This patch removes it.

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

2 years ago[flang] Avoid spurious warnings from reading module files
Peter Klausler [Tue, 24 May 2022 22:06:12 +0000 (15:06 -0700)]
[flang] Avoid spurious warnings from reading module files

When processing the literal constants of the various kinds of
INTEGER that are too large by 1 (e.g., 2147483648_4) in expression
analysis, emit a portability warning rather than a fatal error if
the literal constant appears as the operand to a unary minus, since
the folded result will be in range.  And don't emit any warning if
the negated literal is coming from a module file -- f18 wrote the
module file and the warning would simply be confusing, especially to
the programmer that wrote (-2147483647_4-1) in the first place.

Further, emit portability warnings for the canonical expressions for
infinities and NaN (-1./0., 0./0., & 1./0.), but not when they appear
in a module file, for the same reason.  The Fortran language has no
syntax for these special values so we have to emit expressions that
fold to them.

Fixes LLVM bugs https://github.com/llvm/llvm-project/issues/55086 and
https://github.com/llvm/llvm-project/issues/55081.

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

2 years ago[docs] Update the label name for new contributors
Yuki Okushi [Fri, 27 May 2022 09:03:30 +0000 (18:03 +0900)]
[docs] Update the label name for new contributors

The `beginner` label is deprecated
and the `good first issue` label is now preferred.

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

2 years ago[libc++] Minor emscripten changes from downstream
Sam Clegg [Sat, 22 May 2021 13:39:33 +0000 (06:39 -0700)]
[libc++] Minor emscripten changes from downstream

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

2 years ago[flang][OpenMP] Fix pointer variables in atomic read/write
Peixin-Qiao [Sat, 28 May 2022 08:41:14 +0000 (16:41 +0800)]
[flang][OpenMP] Fix pointer variables in atomic read/write

For pointer variables, using getSymbolAddress cannot get the coorect
address for atomic read/write operands. Use genExprAddr to fix it.

Reviewed By: shraiysh, NimishMishra

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

2 years ago[flang][OpenMP][OpenACC] Fix exit of a region
Peixin-Qiao [Sat, 28 May 2022 08:34:26 +0000 (16:34 +0800)]
[flang][OpenMP][OpenACC] Fix exit of a region

The stop statement is allowed in OpenMP/OpenACC block region.

Reviewed By: kiranchandramohan, shraiysh

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

2 years ago[gn build] Port 30c37fb89cb7
LLVM GN Syncbot [Sat, 28 May 2022 08:16:52 +0000 (08:16 +0000)]
[gn build] Port 30c37fb89cb7

2 years ago[libc++] Granularize more of <type_traits>
Nikolas Klauser [Thu, 26 May 2022 09:49:01 +0000 (11:49 +0200)]
[libc++] Granularize more of <type_traits>

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[libc++] Remove unused __functional includes
Nikolas Klauser [Fri, 20 May 2022 22:45:51 +0000 (00:45 +0200)]
[libc++] Remove unused __functional includes

Reviewed By: ldionne, #libc

Spies: arichardson, smeenai, libcxx-commits, arphaman

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

2 years ago[Lex] Fix crash during dependency scanning while skipping an unmatched `#if`
Argyrios Kyrtzidis [Sat, 28 May 2022 06:59:30 +0000 (23:59 -0700)]
[Lex] Fix crash during dependency scanning while skipping an unmatched `#if`

2 years ago[CompilerInstance] Fix weird condition on `createCodeCompletionConsumer`
Yuki Okushi [Fri, 27 May 2022 08:42:49 +0000 (17:42 +0900)]
[CompilerInstance] Fix weird condition on `createCodeCompletionConsumer`

Fixes llvm#53545

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

2 years ago[Driver] Replace err_invalid_branch_protection with err_drv_unsupported_option_argument
Fangrui Song [Sat, 28 May 2022 05:28:39 +0000 (22:28 -0700)]
[Driver] Replace err_invalid_branch_protection with err_drv_unsupported_option_argument

The convention is to use err_drv_unsupported_option_argument instead of adding a
new diagnostic for every option.

2 years ago[ARM][AArch64] Change -mharden-sls= to use err_drv_unsupported_option_argument
Fangrui Song [Sat, 28 May 2022 05:03:48 +0000 (22:03 -0700)]
[ARM][AArch64] Change -mharden-sls= to use err_drv_unsupported_option_argument

Update the diagnostic in D81404: the convention is to use
err_drv_unsupported_option_argument instead of adding a new diagnostic for every
option.

Reviewed By: nickdesaulniers

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

2 years ago[scudo] Clean up Zircon header file uses
Roland McGrath [Sat, 28 May 2022 01:22:38 +0000 (18:22 -0700)]
[scudo] Clean up Zircon header file uses

Make fuchsia.h and fuchsia.cpp each include what they use.

2 years ago[mlir][bufferization] Add extra filter mechanism to bufferizeOp
Matthias Springer [Sat, 28 May 2022 02:48:36 +0000 (04:48 +0200)]
[mlir][bufferization] Add extra filter mechanism to bufferizeOp

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

2 years ago[mlir][bufferize][NFC] Split analysis+bufferization of ModuleBufferization
Matthias Springer [Sat, 28 May 2022 02:42:47 +0000 (04:42 +0200)]
[mlir][bufferize][NFC] Split analysis+bufferization of ModuleBufferization

Analysis and bufferization can now be run separately.

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

2 years ago[mlir][bufferization][NFC] Remove post-analysis step infrastructure
Matthias Springer [Sat, 28 May 2022 02:36:24 +0000 (04:36 +0200)]
[mlir][bufferization][NFC] Remove post-analysis step infrastructure

Now that analysis and bufferization are better separated, post-analysis steps are no longer needed. Users can directly interleave analysis and bufferization as needed.

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

2 years ago[mlir][bufferization][NFC] Move OpFilter out of BufferizationOptions
Matthias Springer [Fri, 27 May 2022 23:45:55 +0000 (01:45 +0200)]
[mlir][bufferization][NFC] Move OpFilter out of BufferizationOptions

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

2 years ago[OpenACC][OpenMP] Document atomic-in-teams extension
Joel E. Denny [Fri, 27 May 2022 22:53:19 +0000 (18:53 -0400)]
[OpenACC][OpenMP] Document atomic-in-teams extension

That is, put D126323 in the status doc and explain its relationship to
OpenACC support.

Reviewed By: jdoerfert

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

2 years ago[RISCV] Allow PRE of vsetvli involving non-1 LMUL
Philip Reames [Fri, 27 May 2022 22:37:42 +0000 (15:37 -0700)]
[RISCV] Allow PRE of vsetvli involving non-1 LMUL

This is a follow up to address a review comment from D124869. When deciding whether to PRE a vsetvli, we can allow non-LMUL1 vsetvlis.

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

2 years ago[LSR][TTI][PowerPC][SystemZ][X86] Add const-ness to TTI::isLSRCostLess. NFC
eopXD [Wed, 25 May 2022 03:06:34 +0000 (20:06 -0700)]
[LSR][TTI][PowerPC][SystemZ][X86] Add const-ness to TTI::isLSRCostLess. NFC

Reviewed By: Meinersbur

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

2 years ago[bazel] BLAKE3: Adopt aarch64 and x86_64.
NAKAMURA Takumi [Fri, 27 May 2022 14:39:52 +0000 (23:39 +0900)]
[bazel] BLAKE3: Adopt aarch64 and x86_64.

FIXME: arm(32) may be applicable here. I haven't tested yet.

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

2 years ago[lldb] Fix cross compiling on macOS
Martin Storsjö [Fri, 27 May 2022 13:37:43 +0000 (16:37 +0300)]
[lldb] Fix cross compiling on macOS

When cross compiling, a separate nested cmake is spawned, for building
host code generation tools such as lldb-tblgen.

When cross compiling on macOS, the nested native build would trigger
the lldb check for libc++, if testing is enabled (which it is by default).
(Even if `LLDB_INCLUDE_TESTS=OFF` is set on the main build, it has to
be passed separately in `CROSS_TOOLCHAIN_FLAGS_NATIVE` to reach the
nested build.)

Skip this check when building the host tools when cross compiling, as
the user won't try to run tests in that nested build.

(Alternatively, we could consider disabling all the `*_INCLUDE_TESTS`
by default in the nested host tools build.)

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

2 years ago[RISCV] Correct load/store alignments in sink-splat-operands.ll. NFC
Craig Topper [Fri, 27 May 2022 21:39:30 +0000 (14:39 -0700)]
[RISCV] Correct load/store alignments in sink-splat-operands.ll. NFC

These should be aligned to the natural alignment of the element.
Probably copy/paste mistake from the i32 tests.

Reviewed By: reames

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

2 years ago[mlir][sparse] Fixes C++98 warning
wren romano [Fri, 27 May 2022 19:42:46 +0000 (12:42 -0700)]
[mlir][sparse] Fixes C++98 warning

The semicolons were introduced in D126105 in order to correct clang-format, but I forgot this file must be compiled as C++98 rather than C++11.

Reviewed By: aartbik

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

2 years ago[RISCV] Add a vsetvli PRE test involving non-1 LMUL
Philip Reames [Fri, 27 May 2022 19:51:54 +0000 (12:51 -0700)]
[RISCV] Add a vsetvli PRE test involving non-1 LMUL

2 years ago[RISCV] Use template version of SignExtend64 for constant extends. NFC
Craig Topper [Fri, 27 May 2022 20:10:47 +0000 (13:10 -0700)]
[RISCV] Use template version of SignExtend64 for constant extends. NFC

We were inconsistent about which one we used.

2 years ago[CMake] Make FindLibEdit.cmake more robust
Tobias Ribizel [Fri, 27 May 2022 20:06:45 +0000 (13:06 -0700)]
[CMake] Make FindLibEdit.cmake more robust

FindLibEdit uses pkg-config to find the necessary flags, but this may break with cross-compilation,
because the PkgConfig module in CMake doesn't respect the SYSROOT specified in a toolchain file.
Instead of taking the parameters from pkg-config for granted, we check whether our compiler can
actually include and link against the library.

Fixes #55445
Fixes #55671

Reviewed By: MaskRay

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

2 years ago[runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZ
Louis Dionne [Thu, 26 May 2022 15:49:47 +0000 (11:49 -0400)]
[runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZ

Since those features are general properties of the environment, it makes
sense to use them from libc++abi too, and so the name libcpp-has-no-xxx
doesn't make sense.

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

2 years ago[libc++][NFC] Rename rand.dis to rand.dist
Nikolas Klauser [Mon, 23 May 2022 16:47:52 +0000 (18:47 +0200)]
[libc++][NFC] Rename rand.dis to rand.dist

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgrang, mstorsjo

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

2 years ago[RISCV] Remove unused variables. NFC
Craig Topper [Fri, 27 May 2022 19:13:41 +0000 (12:13 -0700)]
[RISCV] Remove unused variables. NFC

2 years ago[lld][WebAssembly] Fix crash on undefined+weak function syms in LTO objects
Sam Clegg [Fri, 27 May 2022 15:34:31 +0000 (08:34 -0700)]
[lld][WebAssembly] Fix crash on undefined+weak function syms in LTO objects

Symbols from LTO objects don't contain Wasm signatures, but we need a
signature when we create undefined/stub functions for missing weakly
undefined symbols.

Luckily, after LTO, we know that symbols that are not referenced by a
regular object file must not be needed in the final output so there
is no need to generate undefined/stub function for them.

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

2 years ago[llvm-lib] Ignore /LTCG option
Pengxuan Zheng [Thu, 19 May 2022 18:30:57 +0000 (11:30 -0700)]
[llvm-lib] Ignore /LTCG option

"The /LTCG option to LIB specifies that the inputs from cl.exe include object
files generated by using the /GL compiler option."

Based on Microsoft's description
above (https://docs.microsoft.com/en-us/cpp/build/reference/running-lib?view=msvc-170),
there doesn't seem to be anything llvm-lib needs to do to support the flag.

Reviewed By: rnk

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

2 years ago[RISCV] Return false from isOffsetFoldingLegal instead of reversing the fold in lowering.
Craig Topper [Fri, 27 May 2022 17:16:32 +0000 (10:16 -0700)]
[RISCV] Return false from isOffsetFoldingLegal instead of reversing the fold in lowering.

When lowering GlobalAddressNodes, we were removing a non-zero offset and
creating a separate ADD.

It already comes out of SelectionDAGBuilder with a separate ADD. The
ADD was being removed by DAGCombiner.

This patch disables the DAG combine so we don't have to reverse it.
Test changes all look to be instruction order changes. Probably due
to different DAG node ordering.

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

2 years agoAMDGPU: Add G_AMDGPU_MAD_64_32 instructions
Nicolai Hähnle [Thu, 28 Apr 2022 22:52:44 +0000 (17:52 -0500)]
AMDGPU: Add G_AMDGPU_MAD_64_32 instructions

These generic instructions are trivially selected to
V_MAD_[IU]64_[IU]32 instructions when run on the VALU.

When at least both factors are scalar, it is usually better to execute
some or all of the instruction on the SALU. To this end, we lower the
instruction to simpler instructions that are supported on the SALU
when applying the register bank mapping.

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

2 years ago[TSan][Darwin] Deflake test
Julian Lettner [Fri, 27 May 2022 17:15:18 +0000 (10:15 -0700)]
[TSan][Darwin] Deflake test

The asserted order of THREAD_DESTROY and end of main() is not
guaranteed:
```
 7: Hello from pthread
 8: THREAD_TERMINATE 0x7e8000104000, self: 0x7e8000104000, name: child thread
 9: Done.
10: THREAD_DESTROY 0x7e8000104000, self: 0x7e8000104000, name: child thread
```

Resulting in:
```
error: CHECK: expected string not found in input
// CHECK: Done.
```

Remove checking for "Done." (end of main()) to deflake this test.
Alternatively, we could use `CHECK-DAG`.

rdar://94036145

2 years ago[runtimes] Officially deprecate the legacy testing configuration system
Louis Dionne [Thu, 26 May 2022 15:12:45 +0000 (11:12 -0400)]
[runtimes] Officially deprecate the legacy testing configuration system

Add a warning and tweak the release note to explain that the deprecation
targets libc++, libc++abi and libuwnind as well.

Also, as a fly-by, ensure that our CI runs the legacy testing configuration
for libc++, libc++abi and libunwind. This doesn't matter too much since
it's deprecated, but we might as well test it properly.

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

2 years ago[libc++] Add various missing _LIBCPP_HIDE_FROM_ABI
Louis Dionne [Thu, 26 May 2022 19:24:59 +0000 (15:24 -0400)]
[libc++] Add various missing _LIBCPP_HIDE_FROM_ABI

Those were spotted when a project unintentionally started exporting
these symbols from its ABI just by using the libc++ headers.

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

2 years ago[OpenMP][mlir] fix broken build
Aart Bik [Fri, 27 May 2022 16:48:50 +0000 (09:48 -0700)]
[OpenMP][mlir] fix broken build

Reviewed By: Mogball

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

2 years agoRevert "[Clang] Extend -gen-reproducer flag"
Alex Brachet [Fri, 27 May 2022 17:03:32 +0000 (17:03 +0000)]
Revert "[Clang] Extend -gen-reproducer flag"

This reverts commit 684c080108766b4f112f172fed4a49059484614d.

2 years ago[libc++] Use __libcpp_clz for a tighter __log2i function
Hans Wennborg [Thu, 19 May 2022 09:06:11 +0000 (11:06 +0200)]
[libc++] Use __libcpp_clz for a tighter __log2i function

While looking at D113413 I noticed that __log2i could perhaps be
improved to be both slightly smaller and faster.

projects/libcxx/benchmarks/sort.libcxx.out --benchmark_filter=BM_Sort_uint32_QuickSortAdversary*
suggests this is performance neutral, but it shaves a few bytes off the
benchmark binary, and even more off a Chromium build.

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

2 years agocmake: use llvm dir variables for clang/utils/hmaptool
Matheus Izvekov [Tue, 24 May 2022 16:21:34 +0000 (18:21 +0200)]
cmake: use llvm dir variables for clang/utils/hmaptool

Install hmaptool using the LLVM specific variables, so
everything goes in the right place in case llvm is included
from a top level CMakeLists.txt.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: stephenneuendorffer

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

2 years ago[WebAssembly] Consolidate sectionTypeToString in BinaryFormat [NFC]
Derek Schuff [Fri, 27 May 2022 15:23:37 +0000 (08:23 -0700)]
[WebAssembly] Consolidate sectionTypeToString in BinaryFormat [NFC]

Currently there are 2 duplicate implementation, and I want to add
a use in a 3rd place. Combine them in lib/BinaryFormat so they can
be shared.

Also update toString for symbol and reloc types to use StringRef

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

2 years ago[OpenMP] Support operation conversion to LLVM for threadprivate directive
PeixinQiao [Fri, 27 May 2022 16:06:57 +0000 (00:06 +0800)]
[OpenMP] Support operation conversion to LLVM for threadprivate directive

This supports the operation conversion for threadprivate directive. The
support for memref type conversion is not implemented.

Reviewed By: kiranchandramohan, shraiysh

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

2 years ago[InstCombine] fold multiply by signbit-splat to cmp+select
Sanjay Patel [Fri, 27 May 2022 15:27:14 +0000 (11:27 -0400)]
[InstCombine] fold multiply by signbit-splat to cmp+select

(ashr i32 X, 31) * C --> (X < 0) ? -C : 0
https://alive2.llvm.org/ce/z/G8u9SS

With a constant operand, this is an improvement in IR
and codegen (where it can be converted to a mask op).

Without a constant operand, we would have to negate
the operand, so that is probably better left to the backend.

This is similar but not the same optimization that is requested
in #55618.

2 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Fri, 27 May 2022 15:07:51 +0000 (11:07 -0400)]
[InstCombine] reduce code duplication; NFC

2 years ago[Clang][Driver] Fix include paths for `--sysroot /` on Linux
Egor Zhdan [Tue, 24 May 2022 11:00:50 +0000 (12:00 +0100)]
[Clang][Driver] Fix include paths for `--sysroot /` on Linux

Currently if `--sysroot /` is passed to the Clang driver, the include paths generated by the Clang driver will start with a double slash: `//usr/include/...`.
 If VFS is used to inject files into the include paths (for example, the Swift compiler does this), VFS will get confused and the injected files won't be visible.

This change makes sure that the include paths start with a single slash.

Fixes #28283.

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

2 years ago[Clang] Extend -gen-reproducer flag
Alex Brachet [Fri, 27 May 2022 15:49:13 +0000 (15:49 +0000)]
[Clang] Extend -gen-reproducer flag

-gen-reproducer causes crash reproduction to be emitted even
when clang didn't crash, and now can optionally take an argument
of never, on-crash (default), on-error and always.

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

2 years ago[PowerPC][AIX] Allow VSX patterns to be 32-bit and 64-bit safe on P8+.
Amy Kwan [Thu, 26 May 2022 14:24:12 +0000 (09:24 -0500)]
[PowerPC][AIX] Allow VSX patterns to be 32-bit and 64-bit safe on P8+.

This patch updates two patterns involving `scalar_to_vector` and
`SCALAR_TO_VECTOR_PERMUTED` nodes to be safe for both 64-bit and 32-bit by
pulling the patterns out of the 64-bit specific guard. These patterns are
matched on POWER8 and above.

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

2 years agoAdd llvm-debuginfod-find tool to Bazel build
Daniele Vettorel [Fri, 27 May 2022 14:17:29 +0000 (10:17 -0400)]
Add llvm-debuginfod-find tool to Bazel build

Add missing `llvm-debuginfod-find` tool to the Bazel build.

Patch by: vettoreldaniele.

Reviewed By: GMNGeoffrey

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

2 years ago[analyzer] Fix wrong annotation of LazyCompoundVal::getStore
Balazs Benics [Fri, 27 May 2022 14:05:33 +0000 (16:05 +0200)]
[analyzer] Fix wrong annotation of LazyCompoundVal::getStore

The build bot https://lab.llvm.org/buildbot#builders/5/builds/24183
uncovered a wrong nonnull annotation intoduced by D126198.

2 years ago[workflow] Don't fail workflow if we already have a PR for an issue
Tobias Hieta [Fri, 27 May 2022 14:02:15 +0000 (16:02 +0200)]
[workflow] Don't fail workflow if we already have a PR for an issue

When running /cherry-pick several times you will get an
error when it tries to create a new PR since there already
is one.

This checks if we have PR first.

Fixes #54862

Reviewed By: tstellar

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

2 years ago[clang][dataflow] Improve handling of constructor initializers.
Yitzhak Mandelbaum [Wed, 25 May 2022 18:51:13 +0000 (18:51 +0000)]
[clang][dataflow] Improve handling of constructor initializers.

Currently, we assert that `CXXCtorInitializer`s are field initializers. Replace
the assertion with an early return. Otherwise, we crash every time we process a
constructor with a non-field (e.g. base class) initializer.

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

2 years ago[clang][dataflow] Remove private-field filtering from `StorageLocation` creation.
Yitzhak Mandelbaum [Wed, 25 May 2022 17:57:27 +0000 (17:57 +0000)]
[clang][dataflow] Remove private-field filtering from `StorageLocation` creation.

The API for `AggregateStorageLocation` does not allow for missing fields (it asserts). Therefore, it is incorrect to filter out any fields at location-creation time which may be accessed by the code. Currently, we limit filtering to private, base-calss fields on the assumption that those can never be accessed. However, `friend` declarations can invalidate that assumption, thereby breaking our invariants.

This patch removes said field filtering to avoid violating the invariant of "no missing fields" for `AggregateStorageLocation`.

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

2 years ago[flang][OpenMP][NFC] Cleanup the sections tests
Shraiysh Vaishay [Fri, 27 May 2022 12:49:14 +0000 (18:19 +0530)]
[flang][OpenMP][NFC] Cleanup the sections tests

This patch cleans up the sections tests as per the recent effort to
separate integration tests from unit tests.

Reviewed By: kiranchandramohan, peixin

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

2 years agoAlso remove the empty StoredDeclsList entry from the lookup table
Vassil Vassilev [Fri, 27 May 2022 11:16:24 +0000 (11:16 +0000)]
Also remove the empty StoredDeclsList entry from the lookup table

In case where we have removed all declarations for a given declaration name
entry we should remove the whole StoredDeclsMap entry.

This patch improves consistency in the lookup tables and helps cling/clang-repl
error recovery.

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

2 years ago[mlir][llvm] Fix compiler error on GCC 9
Daniil Dudkin [Fri, 27 May 2022 12:33:02 +0000 (15:33 +0300)]
[mlir][llvm] Fix compiler error on GCC 9

This patch fixes the following compiler error:

    error: declaration of ‘mlir::LLVM::cconv::CConv mlir::LLVM::detail::CConvAttrStorage::CConv’ changes meaning of ‘CConv’ [-fpermissive]

CConv as a member variable name was shadowing CConv as an enumeration,
hence the compiler error.

Reviewed By: ftynse, alexbatashev

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

2 years ago[LLD][test] Update `zlib` tests for LLD commit c78c00dc16
Andrew Ng [Fri, 27 May 2022 11:02:36 +0000 (12:02 +0100)]
[LLD][test] Update `zlib` tests for LLD commit c78c00dc16

Updates for these tests were missed because I didn't have zlib-dev
installed and thus the tests were unsupported and not run.

2 years ago[flang] Support correct continuations for compiler directives
Daniil Dudkin [Fri, 27 May 2022 10:45:15 +0000 (13:45 +0300)]
[flang] Support correct continuations for compiler directives

If a line is over 72 characters long, flang's preprocessor cuts it there
and continues on the next line.
For this purpose it uses the standard way of continuing line with & on each line.
However, it doesn't work with long compiler directives, like OpenMP or OpenACC ones.
The line that continues the directive also has to
contain the corresponding sentinel at the beginning.

This change implements the described functionality.
Also, some code was refactored in order to simplify and reuse existing code.

Reviewed By: klausler

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

2 years ago[RISCV][NFC] Unify compatibility checks under one function
Fraser Cormack [Thu, 26 May 2022 14:11:02 +0000 (15:11 +0100)]
[RISCV][NFC] Unify compatibility checks under one function

Split off from D125021.

We were duplicating logic across different phases. Since we want to
ensure a consistency of logic across phases for correctness, this patch
combines our multiple compatibility checks into one function to better
convey this.

Several methods were made const too.

Reviewed By: reames

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

2 years ago[MLIR][Presburger] Add intersectDomain/Range to IntegerRelation
Groverkss [Fri, 27 May 2022 10:21:40 +0000 (15:51 +0530)]
[MLIR][Presburger] Add intersectDomain/Range to IntegerRelation

This patch adds support for intersection a set with a relation.

Reviewed By: arjunp

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

2 years ago[Doc][OpenCL] Misc wording improvements for SPIR-V
Anastasia Stulova [Fri, 27 May 2022 10:12:44 +0000 (11:12 +0100)]
[Doc][OpenCL] Misc wording improvements for SPIR-V

2 years ago[llvm-ar][test] add special case of replace converting a regular to a thin archive
Ben Dunbobbin [Fri, 27 May 2022 10:02:04 +0000 (11:02 +0100)]
[llvm-ar][test] add special case of replace converting a regular to a thin archive

Add a regression test for:
  https://github.com/llvm/llvm-project/issues/55527

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

2 years ago[LLD][ELF] Drop the string null terminator from the hash in splitStrings
Andrew Ng [Thu, 26 May 2022 15:03:09 +0000 (16:03 +0100)]
[LLD][ELF] Drop the string null terminator from the hash in splitStrings

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

2 years ago[mlir][Tablegen-LSP] Add support for a tracking definitions and references
River Riddle [Tue, 10 May 2022 17:23:57 +0000 (10:23 -0700)]
[mlir][Tablegen-LSP] Add support for a tracking definitions and references

This essentially builds an index for the parsed records and record values (fields).
This covers quite a few cases, but is limited by the currently lackluster location
tracking in tablegen. A followup will work on plumbing more locations through
tablegen, which should greatly improve what we can do here.

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

2 years ago[mlir][Tablegen-LSP] Add support for include file link and hover
River Riddle [Mon, 9 May 2022 22:22:12 +0000 (15:22 -0700)]
[mlir][Tablegen-LSP] Add support for include file link and hover

This allows for following links to include files. This support is effectively
identical to the logic in the PDLL language server, and code is shared as
much as possible.

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

2 years ago[mlir][Tablegen-LSP] Add support for a compilation database
River Riddle [Mon, 9 May 2022 22:05:03 +0000 (15:05 -0700)]
[mlir][Tablegen-LSP] Add support for a compilation database

This provides a format for externally specifying the include directories
for a source file. The format of the tablegen database is exactly the
same as that for PDLL, namely it includes the absolute source file name and
the set of include directories. The database format is shared to simplify
the infra, and also because the format itself is general enough to share. Even
if we desire to expand in the future to contain the actual compilation command,
nothing there is specific enough that we would need two different formats.

As with PDLL, support for generating the database is added to our mlir_tablegen
cmake command.

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

2 years ago[AArch64] Add support for FMA intrinsics to shouldSinkOperands.
Florian Hahn [Fri, 27 May 2022 09:37:02 +0000 (10:37 +0100)]
[AArch64] Add support for FMA intrinsics to shouldSinkOperands.

If the fma operates on a legal vector type, the indexed variants can be
used, if the second operand is a splat of a valid index.

Reviewed By: dmgreen

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

2 years ago[Support] Reduce allocations in parallelForEach with move
Andrew Ng [Wed, 25 May 2022 18:18:18 +0000 (19:18 +0100)]
[Support] Reduce allocations in parallelForEach with move

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

2 years agoRevert "[llvm][clang][bolt][NFC] Use llvm::less_first() when applicable"
Balazs Benics [Fri, 27 May 2022 09:18:05 +0000 (11:18 +0200)]
Revert "[llvm][clang][bolt][NFC] Use llvm::less_first() when applicable"

This reverts commit 3988bd13988aad72ec979beb2361e8738584926b.

Did not build on this bot:
https://lab.llvm.org/buildbot#builders/215/builds/6372

/usr/include/c++/9/bits/predefined_ops.h:177:11: error: no match for call to
‘(llvm::less_first) (std::pair<long unsigned int, llvm::bolt::BinaryBasicBlock*>&, const std::pair<long unsigned int, std::nullptr_t>&)’
  177 |  { return bool(_M_comp(*__it, __val)); }

2 years ago[llvm][clang][bolt][NFC] Use llvm::less_first() when applicable
Balazs Benics [Fri, 27 May 2022 09:15:23 +0000 (11:15 +0200)]
[llvm][clang][bolt][NFC] Use llvm::less_first() when applicable

One could reuse this functor instead of rolling out your own version.
There were a couple other cases where the code was similar, but not
quite the same, such as it might have an assertion in the lambda or other
constructs. Thus, I've not touched any of those, as it might change the
behavior in some way.

As per https://discourse.llvm.org/t/submitting-simple-nfc-patches/62640/3?u=steakhal
Chris Lattner
> LLVM intentionally has a “yes, you can apply common sense judgement to
> things” policy when it comes to code review. If you are doing mechanical
> patches (e.g. adopting less_first) that apply to the entire monorepo,
> then you don’t need everyone in the monorepo to sign off on it. Having
> some +1 validation from someone is useful, but you don’t need everyone
> whose code you touch to weigh in.

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

2 years ago[analyzer][NFCi] Annotate major nonnull returning functions
Balazs Benics [Fri, 27 May 2022 09:05:50 +0000 (11:05 +0200)]
[analyzer][NFCi] Annotate major nonnull returning functions

This patch annotates the most important analyzer function APIs.
Also adds a couple of assertions for uncovering any potential issues
earlier in the constructor; in those cases, the member functions were
already dereferencing the members unconditionally anyway.

Measurements showed no performance impact, nor crashes.

Reviewed By: martong

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

2 years ago[analyzer][NFC] Rename GREngine->CoreEngine, GRExprEngine->ExprEngine in comments...
Gabor Marton [Fri, 27 May 2022 09:02:11 +0000 (11:02 +0200)]
[analyzer][NFC] Rename GREngine->CoreEngine, GRExprEngine->ExprEngine in comments and txt files

fixes #115

2 years ago[analyzer][NFC] Remove unused default SVal constructors
Balazs Benics [Fri, 27 May 2022 08:54:25 +0000 (10:54 +0200)]
[analyzer][NFC] Remove unused default SVal constructors

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] Remove unused friend SVal declarations
Balazs Benics [Fri, 27 May 2022 08:54:25 +0000 (10:54 +0200)]
[analyzer][NFC] Remove unused friend SVal declarations

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] Use idiomatic classof instead of isKind
Balazs Benics [Fri, 27 May 2022 08:54:25 +0000 (10:54 +0200)]
[analyzer][NFC] Use idiomatic classof instead of isKind

- Rename `isKind()` to `classof()` to follow the llvm style RTTI.
- Take SVal by-value instead of reference.
- Mark `classof` public.

Reviewed By: martong, xazax.hun

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

2 years ago[libc++] Enable ranges_robust_against* and niebloid tests for implemented ranges...
Nikolas Klauser [Thu, 26 May 2022 15:10:53 +0000 (17:10 +0200)]
[libc++] Enable ranges_robust_against* and niebloid tests for implemented ranges algorithms

Spies: libcxx-commits

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

2 years ago[X86][AMX] Replace LDTILECFG with PLDTILECFGV on auto-config.
Luo, Yuanke [Fri, 27 May 2022 02:54:37 +0000 (10:54 +0800)]
[X86][AMX] Replace LDTILECFG with PLDTILECFGV on auto-config.

There is intrinsic `@llvm.x86.ldtilecfg` which is lowered to LDTILECFG.
This intrinsic is open for user to configure tile registers by
themselves. There is a chance that `@llvm.x86.ldtilecfg` would be mixed
with the new AMX intrinsics which depend on compiler to configure tile
registers. Separate pusedo instruction PLDTILECFGV would avoid
unexpected behavious when `@llvm.x86.ldtilecfg` is mixed with new AMX
intrinsics. Though user should not mix the two programming model,
compiler should avoid crash or UB when they are mixed.

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

2 years ago[gn build] Port 11e3ad299fee
LLVM GN Syncbot [Fri, 27 May 2022 08:29:03 +0000 (08:29 +0000)]
[gn build] Port 11e3ad299fee

2 years ago[libc++] Implement ranges::is_sorted{, _until}
Nikolas Klauser [Thu, 26 May 2022 14:08:55 +0000 (16:08 +0200)]
[libc++] Implement ranges::is_sorted{, _until}

Reviewed By: Mordante, var-const, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[analyzer][docs] Fix typo in checker name
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][docs] Fix typo in checker name

Fixes #55720

2 years ago[analyzer][NFC] Use MemRegion::getRegion()'s return value unconditionally
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][NFC] Use MemRegion::getRegion()'s return value unconditionally

Reviewed By: martong

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

2 years ago[analyzer][NFC] Remove unused SVal::hasConjuredSymbol
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][NFC] Remove unused SVal::hasConjuredSymbol

Reviewed By: martong

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

2 years ago[analyzer][NFC] Remove unused nonloc::ConcreteInt::evalBinOp
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][NFC] Remove unused nonloc::ConcreteInt::evalBinOp

Reviewed By: martong

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

2 years ago[analyzer][NFC] Inline loc::ConcreteInt::evalBinOp
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][NFC] Inline loc::ConcreteInt::evalBinOp

This patch also refactored some of the enclosing parts.

Reviewed By: martong

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

2 years ago[analyzer][NFC] Inline ExprEngine::evalMinus
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][NFC] Inline ExprEngine::evalMinus

Reviewed By: martong

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

2 years ago[analyzer][NFC] Inline ExprEngine::evalComplement
Balazs Benics [Fri, 27 May 2022 08:07:06 +0000 (10:07 +0200)]
[analyzer][NFC] Inline ExprEngine::evalComplement

Reviewed By: martong

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

2 years ago[mlir-vscode] Add support for highlighting pdll and tablegen markdown code blocks
River Riddle [Mon, 16 May 2022 23:52:49 +0000 (16:52 -0700)]
[mlir-vscode] Add support for highlighting pdll and tablegen markdown code blocks

This essentially just piggy backs off of the existing mlir support.

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

2 years ago[GlobalISel] Add G_IS_FPCLASS
Serge Pavlov [Fri, 11 Mar 2022 07:40:44 +0000 (14:40 +0700)]
[GlobalISel] Add G_IS_FPCLASS

Add a generic opcode to represent `llvm.is_fpclass` intrinsic.

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

2 years ago[mlir][LLVM] Add support for Calling Convention in LLVMFuncOp
Alexander Batashev [Fri, 27 May 2022 06:23:27 +0000 (09:23 +0300)]
[mlir][LLVM] Add support for Calling Convention in LLVMFuncOp

This patch adds support for Calling Convention attribute in LLVM
dialect, including enums, custom syntax and import from LLVM IR.
Additionally fix import of dso_local attribute.

Reviewed By: ftynse

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

2 years ago[RISCV] Add test for experimental.vector.reverse
Liqin.Weng [Fri, 27 May 2022 06:27:26 +0000 (06:27 +0000)]
[RISCV] Add test for experimental.vector.reverse

```
void vector_reverse_i64(int *A, int *B, int n) {
  #pragma clang loop vectorize_width(4, scalable)
  for (int i = n-1; i >= 0; i--)
    A[i] = B[i] + 1;
}
```
When option: scalable-vectorization is on (or set #pragma clang loop vectorize_width(elements, scalable)), Reverse Iterators can't loop vectorization as <vscale x elements x elementType>

Reviewed By: craig.topper

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