platform/upstream/llvm.git
22 months ago[mlir][sparse] Introduce new sparse_tensor.storage_get/set to access memory that...
Peiming Liu [Wed, 31 Aug 2022 20:44:41 +0000 (20:44 +0000)]
[mlir][sparse] Introduce new sparse_tensor.storage_get/set to access memory that stores the handle of a sparse tensor

Introduce new sparse_tensor.storage_get/set to access memory that stores the handle of a sparse tensor. The sparse tensor storage are represented as a tuple, these operation will later be eliminated and the tuple will be flattened after sparse tensor codegen

Reviewed By: aartbik

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

22 months ago[mlir][sparse] sparse storage scheme type conversion
Aart Bik [Wed, 31 Aug 2022 20:46:24 +0000 (13:46 -0700)]
[mlir][sparse] sparse storage scheme type conversion

This builds a compound type for the buffers required for the sparse storage scheme defined by the MLIR sparse tensor types. The use of a tuple allows for a simple 1:1 type conversion. A subsequent pass can expand this tuple into its component with an isolated 1:N type conversion.

Reviewed By: Peiming

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

22 months ago[RISCV] Slightly simplify coode in combineVWADD_W_VL_VWSUB_W_VL and combineMUL_VLToVW...
Craig Topper [Wed, 31 Aug 2022 21:10:02 +0000 (14:10 -0700)]
[RISCV] Slightly simplify coode in combineVWADD_W_VL_VWSUB_W_VL and combineMUL_VLToVWMUL_VL. NFC

Use computeMaxSignificantBits instead of ComputeNumSignBits. Create
APInt as part of call to MaskedValueIsZero instead of creating
a named temporary.

22 months ago[mlir][tosa] Fix left shift that was implicitly converted to 64-bit
Rob Suderman [Wed, 31 Aug 2022 21:55:34 +0000 (14:55 -0700)]
[mlir][tosa] Fix left shift that was implicitly converted to 64-bit

Missing long specifier so that a shift would occur in 64-bits rather
than implicitly in 32-bits.

Reviewed By: NatashaKnk

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

22 months ago[WebAssembly][MC] Update tests after recent removal of .size directives for functions
Sam Clegg [Wed, 31 Aug 2022 21:53:02 +0000 (14:53 -0700)]
[WebAssembly][MC] Update tests after recent removal of .size directives for functions

These were missing from https://reviews.llvm.org/D132929

22 months ago[MLIR] Keep but deprecate old autogenerated pass base classes
Michele Scuttari [Wed, 31 Aug 2022 21:38:31 +0000 (23:38 +0200)]
[MLIR] Keep but deprecate old autogenerated pass base classes

Restore the generation of the old pass base classes for better transitioning of external projects relying on them. They were eliminated with 67d0d7ac0acb0665d6a09f61278fbcf51f0114c2.

Reviewed By: rsmith

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

22 months ago[lld][WebAssembly] Rename SymbolTable::getSymbols to match ELF backend. NFC
Sam Clegg [Fri, 5 Aug 2022 19:54:29 +0000 (12:54 -0700)]
[lld][WebAssembly] Rename SymbolTable::getSymbols to match ELF backend. NFC

The ELF backend originally used `getSymbols()` but went though a
sequence of changes that resulted in this method being called
`symbols()`.

d8f8abbd4a2823f223bd7bc56445541fb221b512 replaced `getSymbols()` with
`forEachSymbol`.

a2fc96441788fba1e4709d63677f34ed8e321dae replaced `forEachSymbol` with
`llvm::iterator_range`.

e9262edf0d11a907763098d8e101219ccd9c43e9 replaced `llvm::iterator_range`
with `symbols()`.

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

22 months ago[WebAssembly][MC] Avoid the need for .size directives for functions
Sam Clegg [Tue, 30 Aug 2022 11:09:44 +0000 (04:09 -0700)]
[WebAssembly][MC] Avoid the need for .size directives for functions

Warn if `.size` is specified for a function symbol.  The size of a
function symbol is determined solely by its content.

I noticed this simplification was possible while debugging #57427, but
this change doesn't fix that specific issue.

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

22 months ago[lldb] Make the rumtimes target a test dependency
Jonas Devlieghere [Wed, 31 Aug 2022 21:23:57 +0000 (14:23 -0700)]
[lldb] Make the rumtimes target a test dependency

Make the rumtimes target a test dependency. This is needed or the parts
of the test suite that rely on the libcxx and libcxxabi.

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

22 months ago[mlir][AMDGPU] Define amdgpu.mfma operator
Krzysztof Drewniak [Tue, 30 Aug 2022 17:12:10 +0000 (17:12 +0000)]
[mlir][AMDGPU] Define amdgpu.mfma operator

The amdgpu.mfma operator is a wrapper around the Matrix Fused Multiply
Add (MFMA) instructions on some AMD GPUs (the CDNA-based MI-* cards).

This interface allows for selecting the operation to be performed by
specifying the dimensions of the multiplication to be performed and
any additional attributes (such as whether to use reduced-precision
floating-point math) that are needed to select the relevant mfma
instruction and set its parameters.

Reviewed By: ThomasRaoux, nirvedhmeshram

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

22 months agoreland: [Local] Allow creating callbr with duplicate successors
Nikita Popov [Wed, 31 Aug 2022 20:08:20 +0000 (13:08 -0700)]
reland: [Local] Allow creating callbr with duplicate successors

Since D129288, callbr is allowed to have duplicate successors. This patch removes a limitation which prevents optimizations from actually producing such callbrs.

This is probably the riskiest of all the recent callbr changes, because code with incorrect assumptions might be lurking somewhere. I fixed the one case I encountered ahead of time in https://github.com/llvm/llvm-project/commit/8201e3ef5c84561260218bc041209611aac690e3.

Reviewed By: nickdesaulniers

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

Originally landed as
commit 08860f525a23 ("[Local] Allow creating callbr with duplicate successors")

Reverted in
commit 1cf6b93df168 ("Revert "[Local] Allow creating callbr with duplicate successors"")

22 months ago[NFC][libc++] char_traits code cleanups.
Mark de Wever [Thu, 4 Aug 2022 17:44:21 +0000 (19:44 +0200)]
[NFC][libc++] char_traits code cleanups.

These cleanups were identified while working on D130295.

Reviewed By: #libc, ldionne, philnik

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

22 months ago[Frontend] Restore Preprocessor::getPredefines()
Roy Jacobson [Wed, 31 Aug 2022 19:27:09 +0000 (22:27 +0300)]
[Frontend] Restore Preprocessor::getPredefines()

https://reviews.llvm.org/rG6bbf51f3ed59ae37f0fec729f25af002111c9e74 from May removed Preprocessor::getPredefines() from Clang's API, presumably as a cleanup because this method is unused in the LLVM codebase.

However, it was/is used by a small number of third-party tools and is pretty harmless, so this patch adds it back and documents why it's here.

The issue was raised in https://github.com/llvm/llvm-project/issues/57483, it would be nice to be able to land it into Clang 15 as it breaks those third-party tools and we can't easily add it back in bug fix releases.

Reviewed By: brad.king, thieta

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

22 months ago[msan] Use Debug Info to point to affected fields
Vitaly Buka [Tue, 30 Aug 2022 03:43:08 +0000 (20:43 -0700)]
[msan] Use Debug Info to point to affected fields

Reviewed By: kstoimenov

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

22 months ago[llvm][TailDuplicator] don't taildup isInlineAsmBrIndirectTargets
Nick Desaulniers [Wed, 31 Aug 2022 19:52:52 +0000 (12:52 -0700)]
[llvm][TailDuplicator] don't taildup isInlineAsmBrIndirectTargets

This fixes a crash observed after
https://reviews.llvm.org/D129997.

Similar to D88823.

Reviewed By: efriedma

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

22 months ago[SLP][NFC]Add a check for SelectInst to match description, NFC.
Alexey Bataev [Wed, 31 Aug 2022 20:03:33 +0000 (13:03 -0700)]
[SLP][NFC]Add a check for SelectInst to match description, NFC.

22 months ago[llvm][test] precommit test for D130127
Nick Desaulniers [Wed, 31 Aug 2022 19:40:46 +0000 (12:40 -0700)]
[llvm][test] precommit test for D130127

Add a FIXME that will be immediately removed in D130127.

Reviewed By: nikic

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

22 months ago[SLP][NFC]Fix comment and make function following naming standard, NFC.
Alexey Bataev [Wed, 31 Aug 2022 19:24:42 +0000 (12:24 -0700)]
[SLP][NFC]Fix comment and make function following naming standard, NFC.

22 months ago[mlir] Avoid nullptr as memcpy arguments after D132758
Vitaly Buka [Wed, 31 Aug 2022 19:29:04 +0000 (12:29 -0700)]
[mlir] Avoid nullptr as memcpy arguments after D132758

22 months ago[cmake] Disable the -Wmisleading-indentation warning with GCC
Martin Storsjö [Tue, 30 Aug 2022 07:42:31 +0000 (10:42 +0300)]
[cmake] Disable the -Wmisleading-indentation warning with GCC

We do keep using the flag with Clang, which should keep catching
such issues in buildbots.

With GCC, the warning can cause lots of loud notes about the
warning logic getting disabled in large source files.

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

22 months ago[SLP] Simplify getOperandInfo implementation and be consistent
Philip Reames [Wed, 31 Aug 2022 19:20:12 +0000 (12:20 -0700)]
[SLP] Simplify getOperandInfo implementation and be consistent

This is NOT nfc.  Specifically, the following behavior changes:
* Pointers are now allowed.  Both uniform, and constants.
* FP uniform non-constants can now be recognized.
* FP undefs are no longer considered constant.  This matches int behavior which we had tests for.  FP behavior was untested.  Its not clear to me int behavior is reasonable, but it's what tests seem to expect, so go with minimum impact for now.

22 months agoRe-add the REQUIRES line to fix a failed build on builder llvm-clang-win-x-aarch64.
Ying Yi [Wed, 31 Aug 2022 19:16:22 +0000 (20:16 +0100)]
Re-add the REQUIRES line to fix a failed build on builder llvm-clang-win-x-aarch64.

22 months ago[CodeGen] fix misnamed "not" operation; NFC
Sanjay Patel [Wed, 31 Aug 2022 18:20:54 +0000 (14:20 -0400)]
[CodeGen] fix misnamed "not" operation; NFC

Seeing the wrong instruction for this name in IR is confusing.
Most of the tests are not even checking a subsequent use of
the value, so I just deleted the over-specified CHECKs.

22 months ago[flang] Write semantics test for atomic_fetch_or
Katherine Rasmussen [Wed, 17 Aug 2022 16:53:40 +0000 (09:53 -0700)]
[flang] Write semantics test for atomic_fetch_or

Write a semantics test for the atomic intrinsic subroutine,
atomic_fetch_or.

Reviewed By: rouson

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

22 months ago[gn build] Port 74c8d9d5fc83
LLVM GN Syncbot [Wed, 31 Aug 2022 18:52:31 +0000 (18:52 +0000)]
[gn build] Port 74c8d9d5fc83

22 months agoRevert "[clang][dataflow] Generalise match switch utility to other AST types and...
Wei Yi Tee [Wed, 31 Aug 2022 18:49:56 +0000 (18:49 +0000)]
Revert "[clang][dataflow] Generalise match switch utility to other AST types and add a `CFGMatchSwitch` which currently handles `CFGStmt` and `CFGInitializer`."

This reverts commit c9033eeb2e59c0157b84adfc6b0fe345f6f03113.
https://lab.llvm.org/buildbot#builders/57/builds/21618
Build failure due to comparison between unsigned int and const int
originating from EXPECT_EQ.

22 months ago[test][InstCombine] Precommit some undef/noundef tests
Arthur Eubanks [Wed, 31 Aug 2022 18:19:07 +0000 (11:19 -0700)]
[test][InstCombine] Precommit some undef/noundef tests

22 months ago[RISCV][CodeGen] add assertion to RISCVTargetStreamer getTargetStreamer()
Michael Maitland [Wed, 31 Aug 2022 18:03:55 +0000 (11:03 -0700)]
[RISCV][CodeGen] add assertion to RISCVTargetStreamer getTargetStreamer()

X86 and ARM AsmParsers have this same assertion. This assertion provides better reporting when the RISCVTargetStreamer is null and helps to prevent null pointer access.

Reviewed By: bkramer

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

22 months ago[VP] Correct the LEGALPOS for VP_STORE.
Craig Topper [Wed, 31 Aug 2022 18:03:39 +0000 (11:03 -0700)]
[VP] Correct the LEGALPOS for VP_STORE.

VP_STORE has a Chain for operand 0, so the LEGALPOS should be 1.

VP_STORE is always considered Legal for MVT::Other. So I suspect this
was causing vp_store to be ignored by LegalizeVectorOps and instead
handled in LegalizeDAG.

VP_LOAD is Custom expanded in LegalizeVectorOps for RISC-V.

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

22 months ago[gn build] port d45c04da7cc5f (TestingADTTests)
Nico Weber [Wed, 31 Aug 2022 18:15:17 +0000 (14:15 -0400)]
[gn build] port d45c04da7cc5f (TestingADTTests)

22 months ago[libc++][format] Fixes broken CI.
Mark de Wever [Wed, 31 Aug 2022 18:14:10 +0000 (20:14 +0200)]
[libc++][format] Fixes broken CI.

Some of the merged patches didn't have conflicts but were not
compatible. This should fix it.

22 months ago[libc] Add arm-32 syscall implementation.
Siva Chandra Reddy [Fri, 26 Aug 2022 21:17:34 +0000 (21:17 +0000)]
[libc] Add arm-32 syscall implementation.

The implementation currently supports only non-thumb mode. As a test for
the implementation, mmap and munmap functions have been enabled.

Reviewed By: michaelrj

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

22 months ago[libc] Fix typo in lseek syscall number macro.
Dong-hee Na [Wed, 31 Aug 2022 17:29:55 +0000 (17:29 +0000)]
[libc] Fix typo in lseek syscall number macro.

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

22 months ago[libc++] Reduces the number of transitive includes.
Mark de Wever [Sat, 20 Aug 2022 08:34:26 +0000 (10:34 +0200)]
[libc++] Reduces the number of transitive includes.

This defines a new policy for removal of transitive includes.
The goal of the policy it to make it relatively easy to remove
headers when needed, but avoid breaking developers using and
vendors shipping libc++.

The method used is to guard transitive includes based on the
C++ language version. For the upcoming C++23 we can remove
headers when we want, but for other language versions we try
to keep it to a minimum.

In this code the transitive include of `<chrono>` is removed
since D128577 introduces a header cycle between `<format>`
and `<chrono>`. This cycle is indirectly required by the
Standard. Our cycle dependency tool basically is a grep based
tool, so it needs some hints to ignore cycles. With the input
of our transitive include tests we can create a better tool.
However that's out of the scope of this patch.

Note the flag `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` remains
unchanged. So users can still opt-out of transitives includes
entirely.

Reviewed By: #libc, ldionne, philnik

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

22 months ago[libc][cmake] split fputil into individual targets
Michael Jones [Tue, 30 Aug 2022 22:06:52 +0000 (15:06 -0700)]
[libc][cmake] split fputil into individual targets

The libc.src.__support.FPUtil.fputil target encompassed many unrelated
files, and provided a lot of hidden dependencies. This patch splits out
all of these files into component parts and cleans up the cmake files
that used them. It does not touch any source files for simplicity, but
there may be changes made to them in future patches.

Reviewed By: lntue

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

22 months ago[llvm][ADT] Overload output stream operator `<<` for `StringMapEntry` and `StringMap`.
Wei Yi Tee [Wed, 31 Aug 2022 17:21:33 +0000 (17:21 +0000)]
[llvm][ADT] Overload output stream operator `<<` for `StringMapEntry` and `StringMap`.

Printing support enables the production of more useful error messages in unit testing e.g. when using matchers such as `UnorderedElementsAre()` to inspect the contents of a `StringMap`.

Reviewed By: gribozavr2, sgatev, ymandel

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

22 months ago[Driver][test] Test -dumpmachine
Fangrui Song [Wed, 31 Aug 2022 17:31:45 +0000 (10:31 -0700)]
[Driver][test] Test -dumpmachine

22 months ago[libc++][format] Fixes floating-point formatting.
Mark de Wever [Sat, 6 Aug 2022 19:30:22 +0000 (21:30 +0200)]
[libc++][format] Fixes floating-point formatting.

Formatting the alternate form for the general categories should keep the
trailing zeros. This was reported by @fsb4000 in D131336.

The default format uses general formatting but this should not keep the
trailing zeros so the default format is not passed to the formatter.

While testing I found an off by one error; finding the exponent character
`e` in 1e+03 will start at after the `1` so a size of `4` can contain an
exponent.

Reviewed By: fsb4000, ldionne, #libc

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

22 months ago[NFC] clang-format Any.h
Arthur Eubanks [Wed, 31 Aug 2022 16:59:21 +0000 (09:59 -0700)]
[NFC] clang-format Any.h

To trigger some bots.

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

22 months ago[NFC][libc++][format] Renames __char_type concept.
Mark de Wever [Thu, 4 Aug 2022 15:54:20 +0000 (17:54 +0200)]
[NFC][libc++][format] Renames __char_type concept.

Move the concept to the concepts header and uses a name in the style of
P2286.

Reviewed By: #libc, ldionne

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

22 months ago[libc++][format] Allows width arg-id with value 0.
Mark de Wever [Wed, 27 Jul 2022 17:17:08 +0000 (19:17 +0200)]
[libc++][format] Allows width arg-id with value 0.

Implements:
- LWG3721 Allow an arg-id with a value of zero for width in std-format-spec

Reviewed By: ldionne, #libc

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

22 months ago[libc++][CI] increases constexpr evaluation limit.
Mark de Wever [Sat, 13 Aug 2022 13:05:10 +0000 (15:05 +0200)]
[libc++][CI] increases constexpr evaluation limit.

This was discovered as an issue in D131317.

Depends on D131835

Reviewed By: #libc, var-const, ldionne, philnik

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

22 months ago[libc++] Tests transitive includes for all C++03.
Mark de Wever [Wed, 24 Aug 2022 18:39:41 +0000 (20:39 +0200)]
[libc++] Tests transitive includes for all C++03.

A followup of D132534 with C++03 enabled after fixing the experimental
PMR issues.

Depends on D132582

Reviewed By: ldionne, #libc

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

22 months ago[libc++][experimental] Disables PMR in C++03.
Mark de Wever [Wed, 24 Aug 2022 18:22:22 +0000 (20:22 +0200)]
[libc++][experimental] Disables PMR in C++03.

While working on D132534 it appeared the experimental PMR code doesn't
have version guards and fails to compile on C++03. This adds the guards
for that version. It seems the tests already were only disabled for
C++03.

Reviewed By: ldionne, #libc

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

22 months ago[libc++] Inlines format_error for clang-cl DLL.
Mark de Wever [Thu, 25 Aug 2022 15:37:02 +0000 (17:37 +0200)]
[libc++] Inlines format_error for clang-cl DLL.

This version is build without support for the experimental library but
the code still wants to link this function. Inlining the function solves
the issue.

Reviewed By: ldionne, #libc

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

22 months ago[gn build] Port c9033eeb2e59
LLVM GN Syncbot [Wed, 31 Aug 2022 17:02:52 +0000 (17:02 +0000)]
[gn build] Port c9033eeb2e59

22 months ago[clang][dataflow] Generalise match switch utility to other AST types and add a `CFGMa...
Wei Yi Tee [Wed, 31 Aug 2022 16:27:37 +0000 (16:27 +0000)]
[clang][dataflow] Generalise match switch utility to other AST types and add a `CFGMatchSwitch` which currently handles `CFGStmt` and `CFGInitializer`.

`MatchSwitch` currently takes in matchers and functions for the `Stmt` class.

This patch generalises the match switch utility (renamed to `ASTMatchSwitch`) to work for different AST node types by introducing a template argument which is the base type for the AST nodes that the match switch will handle.

A `CFGMatchSwitch` is introduced as a wrapper around multiple `ASTMatchSwitch`s for different base types. It works by unwrapping `CFGElement`s into their contained AST nodes and passing the nodes to the relevant `ASTMatchSwitch`. The `CFGMatchSwitch` currently only handles `CFGStmt` and `CFGInitializer`.

Reviewed By: gribozavr2, sgatev

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

22 months ago[AArch64][CostModel][NFC] Specify target datalayout explicitly for cost analysis...
Mingming Liu [Mon, 29 Aug 2022 21:30:52 +0000 (14:30 -0700)]
[AArch64][CostModel][NFC] Specify target datalayout explicitly for cost analysis test.

- Use linux little endian data layout string.

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

22 months ago[Symbolizer] Handle {{{bt}}} symbolizer markup element.
Daniel Thornburgh [Fri, 5 Aug 2022 21:58:44 +0000 (14:58 -0700)]
[Symbolizer] Handle {{{bt}}} symbolizer markup element.

This adds support for backtrace generation to the llvm-symbolizer markup
filter, which is likely the largest use case.

Reviewed By: peter.smith

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

22 months agoReapply "[clang][deps] Split translation units into individual -cc1 or other commands"
Ben Langmuir [Thu, 25 Aug 2022 16:22:31 +0000 (09:22 -0700)]
Reapply "[clang][deps] Split translation units into individual -cc1 or other commands"

Attempt to fix the test failures observed in CI:
* Add Option dependency, which caused BUILD_SHARED_LIBS builds to fail
* Adapt tests that accidentally depended on the host platform: platforms
  that don't use an integrated assembler (e.g. AIX) get a different set
  of commands from the driver. Most dependency scanner tests can use
  -fsyntax-only or -E instead of -c to avoid this, and in the rare case
  we want to check -c specifically, set an explicit target so the
  behaviour is independent of the host.

Original commit message follows.

---

Instead of trying to "fix" the original driver invocation by appending
arguments to it, split it into multiple commands, and for each -cc1
command use a CompilerInvocation to give precise control over the
invocation.

This change should make it easier to (in the future) canonicalize the
command-line (e.g. to improve hits in something like ccache), apply
optimizations, or start supporting multi-arch builds, which would
require different modules for each arch.

In the long run it may make sense to treat the TU commands as a
dependency graph, each with their own dependencies on modules or earlier
TU commands, but for now they are simply a list that is executed in
order, and the dependencies are simply duplicated. Since we currently
only support single-arch builds, there is no parallelism available in
the execution.

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

22 months ago[libclang] Fix conversion from `StringRef` to `CXString`
Egor Zhdan [Tue, 30 Aug 2022 17:43:17 +0000 (18:43 +0100)]
[libclang] Fix conversion from `StringRef` to `CXString`

`CXString createRef(StringRef String)` used to return an invalid string when invoked with some empty strings:

If a `StringRef` holds a non-nullptr pointer, for instance, pointing into contents of a larger string, and has a zero length, `createRef` previously returned the entire larger string, ignoring the fact that the actual string passed to it as a param is empty.

This was discovered when invoking `c-index-test` to dump the contents of documentation comments, in case the comment contains an empty HTML attribute, such as `src=""`.

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

22 months ago[CostModel][X86] Add and/or/xor general cost kinds support
Simon Pilgrim [Wed, 31 Aug 2022 16:26:05 +0000 (17:26 +0100)]
[CostModel][X86] Add and/or/xor general cost kinds support

Account for double-pumping on early AVX1/AVX2 targets

22 months ago[flang] Support lowering of intrinsic module procedure C_FUNLOC
Peixin Qiao [Wed, 31 Aug 2022 15:35:42 +0000 (23:35 +0800)]
[flang] Support lowering of intrinsic module procedure C_FUNLOC

As Fortran 2018 18.2.3.5, the intrinsic c_funloc(x) gets the C address
of argument x. It returns the scalar of type C_FUNPTR. As defined in
iso_c_binding in flang/module/__fortran_builtins.f90, C_FUNPTR is the
derived type with only one component of integer 64.

This follows the implementation of https://reviews.llvm.org/D129659. The
argument is lowered as ProcBox and the address is generated using
fir.box_addr.

Reviewed By: jeanPerier, clementval

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

22 months ago[SLP] Add FMA test case with missing or partial fast-math flags.
Florian Hahn [Wed, 31 Aug 2022 15:25:17 +0000 (16:25 +0100)]
[SLP] Add FMA test case with missing or partial fast-math flags.

Add extra FMA tests with missing or partial fast-math flags.

22 months ago[lld-macho] Set the SG_READ_ONLY flag on __DATA_CONST
Daniel Bertalan [Wed, 31 Aug 2022 10:32:21 +0000 (12:32 +0200)]
[lld-macho] Set the SG_READ_ONLY flag on __DATA_CONST

This flag instructs dyld to make the segment read-only after fixups have
been performed.

I'm not sure why this flag is needed, as on macOS 13 beta at least,
__DATA_CONST is read-only even without this flag; but ld64 sets it as
well.

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

22 months ago[DAG] extractShiftForRotate - replace assertion for shift opcode with an early-out
Simon Pilgrim [Wed, 31 Aug 2022 13:39:32 +0000 (14:39 +0100)]
[DAG] extractShiftForRotate - replace assertion for shift opcode with an early-out

We feed the result from the first extractShiftForRotate call into the second, and that result might no longer be a shift op (usually due to constant folding).

NOTE: We REALLY need to stop creating nodes on the fly inside extractShiftForRotate!

Fixes Issue #57474

22 months ago[amdgpu][nfc] Factor predicate out of findLDSVariablesToLower
Jon Chesterfield [Wed, 31 Aug 2022 14:11:32 +0000 (15:11 +0100)]
[amdgpu][nfc] Factor predicate out of findLDSVariablesToLower

22 months ago[lld-macho][nfc] Simplify MarkLive.cpp using `if constexpr`
Jez Ng [Wed, 31 Aug 2022 14:21:25 +0000 (10:21 -0400)]
[lld-macho][nfc] Simplify MarkLive.cpp using `if constexpr`

No significant perf diff, as expected.

             base           diff           difference (95% CI)
  sys_time   1.722 ± 0.030  1.727 ± 0.027  [  -0.6% ..   +1.2%]
  user_time  5.081 ± 0.032  5.087 ± 0.030  [  -0.2% ..   +0.4%]
  wall_time  6.008 ± 0.056  6.029 ± 0.053  [  -0.1% ..   +0.8%]
  samples    25             37

Reviewed By: #lld-macho, oontvoo, thakis, BertalanD

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

22 months ago[bazel overlay][libc] Add unistd targets.
Siva Chandra Reddy [Wed, 31 Aug 2022 09:08:44 +0000 (09:08 +0000)]
[bazel overlay][libc] Add unistd targets.

Reviewed By: gchatelet

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

22 months agoFurther update -Wbitfield-constant-conversion for 1-bit bitfield
Aaron Ballman [Wed, 31 Aug 2022 13:23:45 +0000 (09:23 -0400)]
Further update -Wbitfield-constant-conversion for 1-bit bitfield

https://reviews.llvm.org/D131255 (82afc9b169a67e8b8a1862fb9c41a2cd974d6691)
began warning about conversion causing data loss for a single-bit
bit-field. However, after landing the changes, there were reports about
significant false positives from some code bases.

This alters the approach taken in that patch by introducing a new
warning group (-Wsingle-bit-bitfield-constant-conversion) which is
grouped under -Wbitfield-constant-conversion to allow users to
selectively disable the single-bit warning without losing the other
constant conversion warnings.

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

22 months ago[LV] Add test case where SCEV is needed to remove vector backedge.
Florian Hahn [Wed, 31 Aug 2022 13:01:41 +0000 (14:01 +0100)]
[LV] Add test case where SCEV is needed to remove vector backedge.

Test case mentioned in the discussion for D115261.

22 months agoClarifying the documentation for diagnostic formats; NFC
Aaron Ballman [Wed, 31 Aug 2022 12:29:19 +0000 (08:29 -0400)]
Clarifying the documentation for diagnostic formats; NFC

While discussing diagnostic format strings with a GSoC mentee, it
became clear there was some confusion regarding how to use them.
Specifically, the documentation for %select caused confunsion because
it was using %select{}2 and talking about how the integer value must
be in the range [0..2], which made it seem like the positional argument
was actually specifying the range of acceptable values.

I clarified several of the examples similarly, moved some documentation
to a more appropriate place, and added some additional information to
the %s modifier to point out that %plural exists.

22 months ago[AArch64 - SVE]: Use SVE to lower reduce.fadd.
Hassnaa Hamdi [Wed, 24 Aug 2022 15:53:40 +0000 (15:53 +0000)]
[AArch64 - SVE]: Use SVE to lower reduce.fadd.

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

skip custom-lowering for v1f64 to be expanded instead, because it has only one lane

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

22 months ago[LV] Fix test cases where vector loop never executed.
Florian Hahn [Wed, 31 Aug 2022 12:24:49 +0000 (13:24 +0100)]
[LV] Fix test cases where vector loop never executed.

It looks like the vector loops in the modified test cases
unintentionally never get executed. Update the exit condition to ensure
it does to avoid them getting optimized away in upcoming changes.

22 months ago[LLParser] Add test for phi first class type error (NFC)
Nikita Popov [Wed, 31 Aug 2022 12:23:43 +0000 (14:23 +0200)]
[LLParser] Add test for phi first class type error (NFC)

22 months ago[LLParser] Allow zero-input phi nodes
Nikita Popov [Wed, 31 Aug 2022 07:40:50 +0000 (09:40 +0200)]
[LLParser] Allow zero-input phi nodes

Zero-input phi nodes are accepted by the verifier and bitcode reader,
but currently rejected by the IR parser. Allow them there as well.

Because phi nodes must have one entry for each predecessor, such
phis can only occur in blocks without predecessors, aka unreachable
code.

Usually, when removing the last predecessor from a block, we also
remove phi nodes in it. However, this is not possible for
invalidation reasons sometimes, which is why we ended up allowing
zero-entry phis at some point in the past. See 9eb2c0113dfe,
D92247 and PR48296 for context.

I've dropped the verifier unit test, because this is now covered
by the regular IR test.

This fixes at least part of https://github.com/llvm/llvm-project/issues/57446.

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

22 months ago[COFF] Use the more accurate GuardFlags definition everywhere
Alvin Wong [Wed, 31 Aug 2022 12:10:45 +0000 (15:10 +0300)]
[COFF] Use the more accurate GuardFlags definition everywhere

This also modifies llvm-readobj to be more future-proof when printing
the guard FIDs table by calculating the entry size correctly according
to MS docs.

Reviewed By: rnk

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

22 months ago[llvm-readobj][COFF] Print load config GuardFlags as enum flags
Alvin Wong [Wed, 31 Aug 2022 12:01:57 +0000 (15:01 +0300)]
[llvm-readobj][COFF] Print load config GuardFlags as enum flags

Print flags as documented in MS docs.
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#load-configuration-layout
https://docs.microsoft.com/en-us/windows/win32/secbp/pe-metadata

EH_CONTINUATION_TABLE_PRESENT is not mentioned in the docs but is
instead taken from Windows SDK headers.

Reviewed By: rnk

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

22 months ago[clang] Silence a false positive GCC -Wunused-but-set-parameter warning with constexpr
Martin Storsjö [Mon, 29 Aug 2022 09:10:52 +0000 (12:10 +0300)]
[clang] Silence a false positive GCC -Wunused-but-set-parameter warning with constexpr

This fixes the following warning:

    In file included from ../tools/clang/lib/Tooling/Transformer/Transformer.cpp:9:
    ../tools/clang/include/clang/Tooling/Transformer/Transformer.h: In instantiation of ‘llvm::Error clang::tooling::detail::populateMetadata(const clang::transformer::RewriteRuleWith<MetadataT>&, size_t, const clang::ast_matchers::MatchFinder::MatchResult&, clang::tooling::TransformerResult<T>&) [with T = void; size_t = long unsigned int]’:
    ../tools/clang/include/clang/Tooling/Transformer/Transformer.h:179:34:   required from ‘void clang::tooling::detail::WithMetadataImpl<T>::onMatchImpl(const clang::ast_matchers::MatchFinder::MatchResult&) [with T = void]’
    ../tools/clang/include/clang/Tooling/Transformer/Transformer.h:156:8:   required from here
    ../tools/clang/include/clang/Tooling/Transformer/Transformer.h:120:25: warning: parameter ‘SelectedCase’ set but not used [-Wunused-but-set-parameter]
      120 |                  size_t SelectedCase,
          |                  ~~~~~~~^~~~~~~~~~~~

The issue is fixed in GCC 10 and later, but this silences the noisy
warning in older versions. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827
for more details about the bug.

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

22 months ago[AArch64-SVE-fixed]:
Hassnaa Hamdi [Wed, 31 Aug 2022 11:39:20 +0000 (11:39 +0000)]
[AArch64-SVE-fixed]:
change vscale_range<2,0> to vscale_range<1,0> for 64/128-bit vectors of fadda tests

22 months ago[bazel] Drop ConversionPassDetail, it shouldn't be needed after 67d0d7ac0acb0665d6a09...
Benjamin Kramer [Wed, 31 Aug 2022 11:31:11 +0000 (13:31 +0200)]
[bazel] Drop ConversionPassDetail, it shouldn't be needed after 67d0d7ac0acb0665d6a09f61278fbcf51f0114c2

22 months ago[flang] Apply lower bounds correctly before runtime call to ubound
Valentin Clement [Wed, 31 Aug 2022 11:24:57 +0000 (13:24 +0200)]
[flang] Apply lower bounds correctly before runtime call to ubound

Apply lower bounds before call to the ubound runtime function.
This is similary done in genLBound.

Reviewed By: jeanPerier

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

22 months ago[DAG] visitFreeze - account for operand depth when calling isGuaranteedNotToBeUndefOr...
Simon Pilgrim [Wed, 31 Aug 2022 11:20:20 +0000 (12:20 +0100)]
[DAG] visitFreeze - account for operand depth when calling isGuaranteedNotToBeUndefOrPoison (PR57402)

We were calling isGuaranteedNotToBeUndefOrPoison on operands (with Depth = 0), but wasn't accounting for the fact that a later isGuaranteedNotToBeUndefOrPoison assertion will call from the new node (with Depth = 0 as well) - which will then recursively call isGuaranteedNotToBeUndefOrPoison for its operands with Depth = 1

Fixes #57402

22 months ago[clang] update pr27699 test to make headers different (NFC)
Mikhail Goncharov [Wed, 31 Aug 2022 11:10:12 +0000 (13:10 +0200)]
[clang] update pr27699 test to make headers different (NFC)

some build systems treat those headers as identical, causing a warning

22 months ago[ARM] Add a phase ordering test for MVE intrinsic remainder vectorization/unrolling...
David Green [Wed, 31 Aug 2022 11:08:38 +0000 (12:08 +0100)]
[ARM] Add a phase ordering test for MVE intrinsic remainder vectorization/unrolling. NFC

22 months ago[MLIR] Update pass declarations to new autogenerated files
Michele Scuttari [Wed, 31 Aug 2022 08:16:29 +0000 (10:16 +0200)]
[MLIR] Update pass declarations to new autogenerated files

The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.

Reviewed By: mehdi_amini, rriddle

Differential Review: https://reviews.llvm.org/D132838

22 months ago[clang][dataflow] Extend transfer functions for other `CFGElement`s
Wei Yi Tee [Wed, 31 Aug 2022 08:41:32 +0000 (08:41 +0000)]
[clang][dataflow] Extend transfer functions for other `CFGElement`s

Previously, the transfer function `void transfer(const Stmt *, ...)` overriden by users is restricted to apply only on `CFGStmt`s and its contained `Stmt`.

By using a transfer function (`void transfer(const CFGElement *, ...)`) that takes a `CFGElement` as input, this patch extends user-defined analysis to all kinds of `CFGElement`. For example, users can now handle `CFGInitializer`s where `CXXCtorInitializer` AST nodes are contained.

Reviewed By: gribozavr2, sgatev

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

22 months ago[CostModel][X86] Replace CostKindCosts constructor with default values.
Simon Pilgrim [Wed, 31 Aug 2022 09:02:38 +0000 (10:02 +0100)]
[CostModel][X86] Replace CostKindCosts constructor with default values.

This improves static initialization of the cost tables and significantly speeds up MSVC compile time.

22 months ago[InstCombine] Use getInsertionPointAfterDef() in freeze fold
Nikita Popov [Wed, 13 Jul 2022 14:53:11 +0000 (16:53 +0200)]
[InstCombine] Use getInsertionPointAfterDef() in freeze fold

This simplifies the code and fixes handling of catchswitch, in
which case we have no insertion point for the freeze.

Originally part of D129660.

22 months ago[clang-tidy] Fix modernize-use-emplace to support alias cases
corona10 [Wed, 31 Aug 2022 09:19:38 +0000 (10:19 +0100)]
[clang-tidy] Fix modernize-use-emplace to support alias cases

Fix modernize-use-emplace to support alias cases

Reviewed By: njames93

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

22 months ago[libclc] Quote addition of CLC/LLAsm flags
Nikita Popov [Tue, 9 Aug 2022 12:43:25 +0000 (14:43 +0200)]
[libclc] Quote addition of CLC/LLAsm flags

Otherwise cmake will insert a semicolon if flags are already set.

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

22 months ago[Reassociate] Use getInsertionPointerAfterDef()
Nikita Popov [Wed, 13 Jul 2022 14:53:11 +0000 (16:53 +0200)]
[Reassociate] Use getInsertionPointerAfterDef()

This simplifies the code and fixes handling for the callbr case,
where the instruction needs to be inserted in the normal
destination, rather than after the terminator.

Originally part of D129660.

22 months agoRemove `REQUIRES: x86-registered-target` from ps4/ps5 driver tests
Ying Yi [Mon, 22 Aug 2022 15:42:32 +0000 (16:42 +0100)]
Remove `REQUIRES: x86-registered-target` from ps4/ps5 driver tests

Reviewed By: probinson

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

22 months ago[IR] Add Instruction::getInsertionPointAfterDef()
Nikita Popov [Wed, 13 Jul 2022 14:53:11 +0000 (16:53 +0200)]
[IR] Add Instruction::getInsertionPointAfterDef()

Transforms occasionally want to insert an instruction directly
after the definition point of a value. This involves quite a few
different edge cases, e.g. for phi nodes the next insertion point
is not the next instruction, and for invokes and callbrs its not
even in the same block. Additionally, the insertion point may not
exist at all if catchswitch is involved.

This adds a general Instruction::getInsertionPointAfterDef() API to
implement the necessary logic. For now it is used in two places
where this should be mostly NFC. I will follow up with additional
uses where this fixes specific bugs in the existing implementations.

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

22 months ago[mlir][OpenMP] Apply ClangTidy readability finding.
Adrian Kuegel [Wed, 31 Aug 2022 08:38:19 +0000 (10:38 +0200)]
[mlir][OpenMP] Apply ClangTidy readability finding.

Use .empty() check instead of size() check.

22 months ago[lld-macho] Support synthesizing __TEXT,__init_offsets
Daniel Bertalan [Tue, 30 Aug 2022 14:54:04 +0000 (16:54 +0200)]
[lld-macho] Support synthesizing __TEXT,__init_offsets

This section stores 32-bit `__TEXT` segment offsets of initializer
functions, and is used instead of `__mod_init_func` when chained fixups
are enabled.

Storing the offsets lets us avoid emitting fixups for the initializers.

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

22 months agoRevert "[clang] Fix a crash in constant evaluation"
Kadir Cetinkaya [Wed, 31 Aug 2022 08:12:52 +0000 (10:12 +0200)]
Revert "[clang] Fix a crash in constant evaluation"

This reverts commit a5ab650714d05c2e49ec158dc99156118a893027.

22 months ago[clang] Fix a crash in constant evaluation
Kadir Cetinkaya [Tue, 30 Aug 2022 09:00:16 +0000 (11:00 +0200)]
[clang] Fix a crash in constant evaluation

This was showing up in our internal crash collector. I have no idea how
to test it out though, open for suggestions if there are easy paths but
otherwise I'd move forward with the patch.

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

22 months ago[GVN] Add another test for phi translation miscompile (NFC)
Nikita Popov [Wed, 31 Aug 2022 07:14:53 +0000 (09:14 +0200)]
[GVN] Add another test for phi translation miscompile (NFC)

22 months ago[SPIR-V] Use llvm::Optional for builtin lowering result.
Aleksandr Bezzubikov [Tue, 30 Aug 2022 23:34:50 +0000 (16:34 -0700)]
[SPIR-V] Use llvm::Optional for builtin lowering result.

Replace result type std::pair<bool, bool> of lowerBuiltin with
a nice and convenient Optional<bool>.

Reviewed By: iliya-diyachkov, MaskRay

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

22 months ago[LoongArch] Support floating-point number reciprocal
gonglingqin [Wed, 31 Aug 2022 06:13:08 +0000 (14:13 +0800)]
[LoongArch] Support floating-point number reciprocal

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

22 months ago[DirectX backend] change MinVectorRegisterBitWidth to 32.
Xiang Li [Mon, 29 Aug 2022 06:50:12 +0000 (23:50 -0700)]
[DirectX backend] change MinVectorRegisterBitWidth to 32.

This is to avoid vector-combine generate vector4 on float.

Reviewed By: beanz

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

22 months ago[SLPVectorizer] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off build
Fangrui Song [Wed, 31 Aug 2022 06:01:22 +0000 (23:01 -0700)]
[SLPVectorizer] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off build

22 months ago[clang-format] Fix a bug in inserting braces at trailing comments
owenca [Tue, 30 Aug 2022 01:28:18 +0000 (18:28 -0700)]
[clang-format] Fix a bug in inserting braces at trailing comments

If the style wraps control statement braces, the opening braces
should be inserted after the trailing comments if present.

Fixes #57419.

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

22 months ago[libc][doc] Update implementation status of atanf and atanhf.
Tue Ly [Wed, 31 Aug 2022 05:26:01 +0000 (01:26 -0400)]
[libc][doc] Update implementation status of atanf and atanhf.

22 months ago[NFC] Add an invalid test case for clang/test/CXX/module/module.reach/ex1.cpp
Chuanqi Xu [Wed, 31 Aug 2022 05:01:48 +0000 (13:01 +0800)]
[NFC] Add an invalid test case for clang/test/CXX/module/module.reach/ex1.cpp

22 months ago[mlir][OpenMP] Translation to LLVM IR for omp.taskgroup
Shraiysh Vaishay [Wed, 31 Aug 2022 04:34:24 +0000 (04:34 +0000)]
[mlir][OpenMP] Translation to LLVM IR for omp.taskgroup

This patch adds translation from OpenMP Dialect to LLVM IR for
omp.taskgroup. This patch also adds missing tests for the clauses in
omp.taskgroup operation.

Reviewed By: peixin

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

22 months ago[RISCV] Add cost model for select and integer compare instructions.
jacquesguan [Sat, 20 Aug 2022 13:33:00 +0000 (21:33 +0800)]
[RISCV] Add cost model for select and integer compare instructions.

This patch adds cost model for vector select and integer compare instructions.

22 months ago[docs] Add "Standard C++ Modules"
Chuanqi Xu [Wed, 31 Aug 2022 03:09:46 +0000 (11:09 +0800)]
[docs] Add "Standard C++ Modules"

We get some standard C++ module things done in clang15.x. But we lack a
user documentation for it. The implementation of standard C++ modules
share a big part of codes with clang modules. But they have very
different semantics and user interfaces, so I think it is necessary to
add a document for Standard C++ modules. Previously, there were also
some people ask the document for standard C++ Modules and I couldn't
offer that time.

Reviewed By: iains, Mordante, h-vetinari, ruoso, dblaikie, JohelEGP,
aaronmondal

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

22 months ago[RISCV][test] Add cost model coverage for compare instructions.
jacquesguan [Mon, 29 Aug 2022 07:24:55 +0000 (15:24 +0800)]
[RISCV][test] Add cost model coverage for compare instructions.

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