platform/upstream/llvm.git
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

2 years ago[libunwind][CMake] Fix name of LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG
Pavel Samolysov [Thu, 26 May 2022 14:03:08 +0000 (17:03 +0300)]
[libunwind][CMake] Fix name of LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG

The CMake variable LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG has been renamed
into C_SUPPORTS_NODEFAULTLIBS_FLAG because the last one is used in the
confix-ix.cmake file while the variable with the original name is not used
at al.

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

2 years ago[demangler][RISCV] Fix for long double
Piggy NL [Thu, 26 May 2022 14:59:49 +0000 (22:59 +0800)]
[demangler][RISCV] Fix for long double

Summary:
The size of long double in RISCV (both RV32 and RV64) is 16 bytes, thus
the mangled_size shouble be 32.

This patch will fix test case
"_ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c"
in test_demangle.pass.cpp, which is expected to be invalid but demangler
returned "void test0::h<float>(char (&) [(unsigned int)((sizeof (float))
+ (0x0.000000004001ap-16382L))])" in RISCV environment without this patch.

Reviewed By: urnathan

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

2 years ago[SelectionDAG][NFC] Simplify integer promotion in setcc/vp.setcc
Ping Deng [Fri, 27 May 2022 05:45:17 +0000 (05:45 +0000)]
[SelectionDAG][NFC] Simplify integer promotion in setcc/vp.setcc

Reviewed By: craig.topper

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

2 years ago[libc] Add global stdout and stderr objects.
Siva Chandra Reddy [Tue, 24 May 2022 08:13:11 +0000 (08:13 +0000)]
[libc] Add global stdout and stderr objects.

They are added as entrypoint object targets. The header-gen
infrastructure has been extended to enable handling standard required
global objects. The libc-api-test has also been extended to verify the
global object declarations.

Reviewed By: lntue

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

2 years ago[gn build] Port 08cc05851872
LLVM GN Syncbot [Fri, 27 May 2022 02:54:55 +0000 (02:54 +0000)]
[gn build] Port 08cc05851872

2 years agoReland "[Propeller] Promote functions with propeller profiles to .text.hot."
Rahman Lavaee [Fri, 27 May 2022 02:27:05 +0000 (19:27 -0700)]
Reland "[Propeller] Promote functions with propeller profiles to .text.hot."

This relands commit 4d8d2580c53e130c3c3dd3877384301e3c495554.

The major change here is using 'addUsedIfAvailable<BasicBlockSectionsProfileReader>()` to make sure we don't change the pipeline tests.

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

2 years ago[InstCombine] [NFC] precommit tests for bitcast-extelt
Chenbing Zheng [Fri, 27 May 2022 02:50:30 +0000 (10:50 +0800)]
[InstCombine] [NFC] precommit tests for bitcast-extelt

2 years ago[X86][AMX] Update test case with automation tool.
Luo, Yuanke [Fri, 27 May 2022 02:35:05 +0000 (10:35 +0800)]
[X86][AMX] Update test case with automation tool.

2 years ago[mlir][Linalg] Relax vectorization condition to allow transposed output.
Hanhan Wang [Fri, 27 May 2022 02:20:36 +0000 (19:20 -0700)]
[mlir][Linalg] Relax vectorization condition to allow transposed output.

Reviewed By: ThomasRaoux, dcaballe

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

2 years agoAdd !nosanitize to FixedMetadataKinds
Enna1 [Fri, 27 May 2022 01:39:04 +0000 (09:39 +0800)]
Add !nosanitize to FixedMetadataKinds

This patch adds !nosanitize metadata to FixedMetadataKinds.def, !nosanitize indicates that LLVM should not insert any sanitizer instrumentation.

Reviewed By: vitalybuka

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

2 years agoRevert "[Propeller] Promote functions with propeller profiles to .text.hot."
Rahman Lavaee [Fri, 27 May 2022 01:43:58 +0000 (18:43 -0700)]
Revert "[Propeller] Promote functions with propeller profiles to .text.hot."

This reverts commit 4d8d2580c53e130c3c3dd3877384301e3c495554.

2 years ago[RISCV] Simplify code after D125905
Fangrui Song [Fri, 27 May 2022 01:13:38 +0000 (18:13 -0700)]
[RISCV] Simplify code after D125905

2 years ago[mlir][sparse] Moving some functions around
wren romano [Thu, 26 May 2022 19:38:58 +0000 (12:38 -0700)]
[mlir][sparse] Moving some functions around

This is a followup to D126105 to move functions in SparseTensorUtils.cpp to match their locations in SparseTensorUtils.h

Reviewed By: aartbik

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

2 years ago[mlir][sparse] Improving ExecutionEngine/SparseTensorUtils.h
wren romano [Thu, 26 May 2022 19:31:58 +0000 (12:31 -0700)]
[mlir][sparse] Improving ExecutionEngine/SparseTensorUtils.h

This change makes the public API of SparseTensorUtils.cpp explicit, whereas before the publicity of these functions was only implicit.  Implicit publicity is sufficient for mlir-opt to generate calls to these functions, but it's not enough to enable C/C++ code to call them directly in the usual way (i.e., without going through codegen).  Thus, leaving the publicity implicit prevents development of other tools (e.g., microbenchmarks).

In addition this change also marks the functions MLIR_CRUNNERUTILS_EXPORT, which is required by the JIT under certain configurations (albeit not for anything in our test suite).

Reviewed By: aartbik

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

2 years ago[test/ClangScanDeps] Add a target triple for `macro-expansions.cpp`
Argyrios Kyrtzidis [Fri, 27 May 2022 00:18:32 +0000 (17:18 -0700)]
[test/ClangScanDeps] Add a target triple for `macro-expansions.cpp`

This should fix the `clang-ppc64-aix` builder.

2 years ago[lldb/fuzzer] Moving target fuzzer into separate subdirectory
Chelsea Cassanova [Thu, 26 May 2022 23:57:57 +0000 (16:57 -0700)]
[lldb/fuzzer] Moving target fuzzer into separate subdirectory

Moving lldb-target-fuzzer into its own subdirectory for better
organization and modularity.

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

2 years ago[flang] expand the this_image test coverage
Damian Rouson [Thu, 31 Mar 2022 20:55:43 +0000 (13:55 -0700)]
[flang] expand the this_image test coverage

Add a test with a range of this_image() intrinsic function
invocations, including a comprehensive set of standard-conforming
keyword and non-keyword arguments with and without optional
arguments present and with argument positions covering all
possible orderings.  Also test that several non-conforming
this_image() invocations generate the correct error messages.

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

2 years ago[Propeller] Promote functions with propeller profiles to .text.hot.
Rahman Lavaee [Tue, 24 May 2022 17:54:36 +0000 (10:54 -0700)]
[Propeller] Promote functions with propeller profiles to .text.hot.

Today, text section prefixes (none, .unlikely, .hot, and .unkown) are determined based on PGO profile. However, Propeller may deem a function hot when PGO doesn't. Besides, when `-Wl,-keep-text-section-prefix=true` Propeller cannot enforce a global section ordering as the linker can only reorder sections within each output section (.text, .text.hot, .text.unlikely).

This patch promotes all functions with Propeller profiles (functions listed in the basic-block-sections profile) to .text.hot. The feature is hidden behind the flag `--bbsections-guided-section-prefix` which defaults to `true`.

The new implementation refactors the parsing of basic block sections profile into a new `BasicBlockSectionsProfileReader` analysis pass. This allows us to use the information earlier in `CodeGenPrepare` in order to set the functions text prefix. `BasicBlockSectionsProfileReader` will be used both by `BasicBlockSections` pass and `CodeGenPrepare`.

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

2 years ago[NFC][JumpThreading] Remove InsertFreezeWhenUnfoldingSelect pass parameter
Arthur Eubanks [Thu, 26 May 2022 21:18:58 +0000 (14:18 -0700)]
[NFC][JumpThreading] Remove InsertFreezeWhenUnfoldingSelect pass parameter

All callers pass true.

select-unfold-freeze.ll is now a subset of select.ll so delete it.

Reviewed By: nikic

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

2 years ago[RISCV] Add a subtarget feature to enable unaligned scalar loads and stores
Philip Reames [Thu, 26 May 2022 22:24:41 +0000 (15:24 -0700)]
[RISCV] Add a subtarget feature to enable unaligned scalar loads and stores

A RISCV implementation can choose to implement unaligned load/store support. We currently don't have a way for such a processor to indicate a preference for unaligned load/stores, so add a subtarget feature.

There doesn't appear to be a formal extension for unaligned support. The RISCV Profiles (https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc#rva20u64-profile) docs use the name Zicclsm, but a) that doesn't appear to actually been standardized, and b) isn't quite what we want here anyway due to the perf comment.

Instead, we can follow precedent from other backends and have a feature flag for the existence of misaligned load/stores with sufficient performance that user code should actually use them.

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

2 years ago[BOLT] Fix AND evaluation bug in shrink wrapping
Rafael Auler [Sat, 21 May 2022 00:42:58 +0000 (17:42 -0700)]
[BOLT] Fix AND evaluation bug in shrink wrapping

Fix a bug where shrink-wrapping would use wrong stack offsets
because the stack was being aligned with an AND instruction, hence,
making its true offsets only available during runtime (we can't
statically determine where are the stack elements and we must give up
on this case).

Reviewed By: Amir

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

2 years ago[lld][WebAssembly] Update test after 87628f5804e2
Sam Clegg [Thu, 26 May 2022 21:56:36 +0000 (14:56 -0700)]
[lld][WebAssembly] Update test after 87628f5804e2

2 years agoStore a by name list of signals with their actions in the Target
Jim Ingham [Wed, 18 May 2022 21:39:03 +0000 (14:39 -0700)]
Store a by name list of signals with their actions in the Target
so that they can be used to prime new Process runs.  "process handle"
was also changed to populate the dummy target if there's no selected
target, so that the settings will get copied into new targets.

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

2 years agoUse cmake Python3_EXECUTABLE variable instead of hardcoding
Matthias Braun [Thu, 26 May 2022 21:47:49 +0000 (14:47 -0700)]
Use cmake Python3_EXECUTABLE variable instead of hardcoding

2 years ago[lld][WebAssembly] Require double dash for modern linker flags
Sam Clegg [Thu, 26 May 2022 21:05:05 +0000 (14:05 -0700)]
[lld][WebAssembly] Require double dash for modern linker flags

This matches the behaviour of the ELF backend (in fact this change
is mostly just copying directly from ELF/Options.td).

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

2 years ago[Driver][test] Change -target i386-unknown-linux-gnu to --target=i386 and remove...
Fangrui Song [Thu, 26 May 2022 21:41:03 +0000 (14:41 -0700)]
[Driver][test] Change -target i386-unknown-linux-gnu to --target=i386 and remove unused -o %t.o

Use a generic ELF triple to demonstrate that these apply to all ELF OSes.
Also migrate away from the legacy `-target ` spelling.

2 years ago[DOC] Improve LangRef description of declare
Sebastian Peryt [Thu, 26 May 2022 21:27:25 +0000 (14:27 -0700)]
[DOC] Improve LangRef description of declare

This patch fixes formatting inside Functions section of declare
by making it consistent with the way how define is written.

Fixes #39844

Reviewed By: RKSimon

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

2 years ago[DOC] Refactor Functions section in LangRef
Sebastian Peryt [Thu, 26 May 2022 21:19:13 +0000 (14:19 -0700)]
[DOC] Refactor Functions section in LangRef

This change is a small refactor of Functions section
to update placement of define syntax.

Reviewed By: RKSimon

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

2 years agoApply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC)
Mehdi Amini [Tue, 24 May 2022 00:20:55 +0000 (00:20 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param in Bufferize.cpp ...
Mehdi Amini [Tue, 24 May 2022 00:02:05 +0000 (00:02 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in Bufferize.cpp (NFC)

2 years ago[Polly][Test] Fix race condition while printing dot files.
Michael Kruse [Thu, 26 May 2022 20:38:04 +0000 (15:38 -0500)]
[Polly][Test] Fix race condition while printing dot files.

The tests dot-scops.ll and dot-scops-npm.ll both wrote to the same file
scops.func.dot. If they are executed in parallel they will race for
the file. Fix by renaming func to func_npm in dot-scops-npm.ll so this
test writes dot scops.func_npm.dot.

Long-term, we will probably pass a file name (prefix) to the
printer pass such that we can use the guaranteed-unique LIT %t
placeholder in tests.

2 years ago[clang-format][NFC] Refactor UnwrappedLineParser::parseBlock()
owenca [Wed, 25 May 2022 07:55:03 +0000 (00:55 -0700)]
[clang-format][NFC] Refactor UnwrappedLineParser::parseBlock()

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

2 years ago[libc++][NFC] Fix whitespace
Louis Dionne [Thu, 26 May 2022 20:52:16 +0000 (16:52 -0400)]
[libc++][NFC] Fix whitespace

2 years ago[lld][WebAssembly] Avoid importing/exporting hidden symbols in shared libraries
Sam Clegg [Thu, 26 May 2022 17:32:04 +0000 (10:32 -0700)]
[lld][WebAssembly] Avoid importing/exporting hidden symbols in shared libraries

We have some special handling for weakly defined symbols where we both
import and export them, but this is not needed for hidden symbols which
should never be imported or exported.

See https://github.com/emscripten-core/emscripten/pull/16972

This should also help with:
https://github.com/emscripten-core/emscripten/issues/15487

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

2 years ago[clang-format] Fix an invalid code generation in RemoveBracesLLVM
owenca [Thu, 26 May 2022 02:27:54 +0000 (19:27 -0700)]
[clang-format] Fix an invalid code generation in RemoveBracesLLVM

Fixes #55706.

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

2 years ago[lld][WebAssemlby] Check for command line flags with missing arguments
Sam Clegg [Thu, 26 May 2022 20:11:20 +0000 (13:11 -0700)]
[lld][WebAssemlby] Check for command line flags with missing arguments

I'm really not sure how this was overlooked when we first ported lld
to Wasm.  The upstream code in the ELF backend has these two lines but
for some reason they never make it into the Wasm version.

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

2 years ago[ValueTracking] Added support to deduce PHI Nodes values being a power of 2
William Huang [Thu, 26 May 2022 20:15:00 +0000 (20:15 +0000)]
[ValueTracking] Added support to deduce PHI Nodes values being a power of 2

Add Value Tracking support to deduce induction variable being a power of 2, allowing urem optimizations

Reviewed By: davidxl

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

2 years ago[InstCombine] fold mul of signbit directly to X < 0 ? Y : 0
Sanjay Patel [Thu, 26 May 2022 18:28:05 +0000 (14:28 -0400)]
[InstCombine] fold mul of signbit directly to X < 0 ? Y : 0

This is effectively NFC (intentionally no test diffs)
because we already have the related fold that converts
the 'and' pattern to select. So this is just an efficiency
improvement.

2 years ago[InstCombine] add tests for mul with sign-splat operand; NFC
Sanjay Patel [Thu, 26 May 2022 18:03:51 +0000 (14:03 -0400)]
[InstCombine] add tests for mul with sign-splat operand; NFC

2 years ago[InstCombine] fold icmp equality with sdiv and SMIN
Sanjay Patel [Thu, 26 May 2022 16:21:48 +0000 (12:21 -0400)]
[InstCombine] fold icmp equality with sdiv and SMIN

This extends the fold from D126410 / 3952c905ef08
to allow for the only case where it works with signed
division:
https://alive2.llvm.org/ce/z/k7_ypu

(X s/ Y) == SMIN --> (X == SMIN) && (Y == 1)
(X s/ Y) != SMIN --> (X != SMIN) || (Y != 1)

This is another improvement based on #55695.

2 years ago[InstCombine] reduce code duplication in icmp+div folds; NFC
Sanjay Patel [Thu, 26 May 2022 16:02:30 +0000 (12:02 -0400)]
[InstCombine] reduce code duplication in icmp+div folds; NFC

2 years ago[InstCombine] add tests for icmp with sdiv operand; NFC
Sanjay Patel [Thu, 26 May 2022 15:29:59 +0000 (11:29 -0400)]
[InstCombine] add tests for icmp with sdiv operand; NFC

Adapted from unsigned division tests from:
ea6171c108c47c1ee4863

2 years ago[LegalizeTypes] Fix bug in expensive checks verification
Craig Topper [Thu, 26 May 2022 19:15:04 +0000 (12:15 -0700)]
[LegalizeTypes] Fix bug in expensive checks verification

With a fix for an expensive checks build failure exposed by new RISC-V tests.
Something about expanding two rotates in type legalization caused a change
in the remapping tables that the expensive checks verifying wasn't expecting.
See comment in the code for how it was fixed.

Tests came from this commit that exposed the bug
[RISCV] Add test cases showing failure to remove mask on rotate amounts.

If the masking AND has multiple users we fail to remove it.

Reviewed By: RKSimon

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

2 years ago[RISCV] Simplfy creation of IndexVT in lowerMaskedGather/lowerMaskedScatter. NFC
Craig Topper [Thu, 26 May 2022 19:13:37 +0000 (12:13 -0700)]
[RISCV] Simplfy creation of IndexVT in lowerMaskedGather/lowerMaskedScatter. NFC

The scalar element width is not a factor in how ContainerVT is
determined. We don't need to check the relative size of VT and
IndexVT.

2 years ago[gn build] Port b58a420ff4f9
LLVM GN Syncbot [Thu, 26 May 2022 20:01:22 +0000 (20:01 +0000)]
[gn build] Port b58a420ff4f9

2 years ago[Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce...
Argyrios Kyrtzidis [Thu, 12 May 2022 04:56:29 +0000 (21:56 -0700)]
[Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources

This is a commit with the following changes:

* Remove `ExcludedPreprocessorDirectiveSkipMapping` and related functionality

Removes `ExcludedPreprocessorDirectiveSkipMapping`; its intended benefit for fast skipping of excluded directived blocks
will be superseded by a follow-up patch in the series that will use dependency scanning lexing for the same purpose.

* Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources

Replaces the "source minimization" mechanism with a mechanism that produces lexed dependency directives tokens.

* Make the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`

This is bringing the following benefits:

    * Full access to the preprocessor state during dependency scanning. E.g. a component can see what includes were taken and where they were located in the actual sources.
    * Improved performance for dependency scanning. Measurements with a release+thin-LTO build shows ~ -11% reduction in wall time.
    * Opportunity to use dependency scanning lexing to speed-up skipping of excluded conditional blocks during normal preprocessing (as follow-up, not part of this patch).

For normal preprocessing measurements show differences are below the noise level.

Since, after this change, we don't minimize sources and pass them in place of the real sources, `DependencyScanningFilesystem` is not technically necessary, but it has valuable performance benefits for caching file `stat`s along with the results of scanning the sources. So the setup of using the `DependencyScanningFilesystem` during a dependency scan remains.

Differential Revision: https://reviews.llvm.org/D125486
Differential Revision: https://reviews.llvm.org/D125487
Differential Revision: https://reviews.llvm.org/D125488

2 years ago[Tooling/DependencyScanning] Rename refactorings towards transitioning dependency...
Argyrios Kyrtzidis [Thu, 12 May 2022 04:21:17 +0000 (21:21 -0700)]
[Tooling/DependencyScanning] Rename refactorings towards transitioning dependency scanning to use pre-lexed preprocessor directive tokens

This is first of a series of patches for making the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`.
This patch only includes NFC renaming changes to make reviewing of the functionality changing parts easier.

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