platform/upstream/llvm.git
17 months ago[clang][ExtractAPI] Add multiple file support to --extract-api-ignores
Ankur [Mon, 13 Mar 2023 12:28:39 +0000 (17:58 +0530)]
[clang][ExtractAPI] Add multiple file support to --extract-api-ignores

- Modify -extract-api-ignores command line option to accept multiple
  arguments
- Update APIIgnoresList to operate on a file list instead of a single file
- Add new test verifying the functionality
- fix #61242 on GitHub issue tracker

Reviewed By: dang

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

17 months ago[bazel] fix for fdd710e69caebf680ed7d4360e04c99024d75094
Mikhail Goncharov [Mon, 13 Mar 2023 12:15:53 +0000 (13:15 +0100)]
[bazel] fix for fdd710e69caebf680ed7d4360e04c99024d75094

17 months ago[gn build] Port e26dad0a661e
LLVM GN Syncbot [Mon, 13 Mar 2023 12:13:23 +0000 (12:13 +0000)]
[gn build] Port e26dad0a661e

17 months ago[clangd] Add missing unittests to build graph
Kadir Cetinkaya [Mon, 13 Mar 2023 11:04:05 +0000 (12:04 +0100)]
[clangd] Add missing unittests to build graph

Also fix tests

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

17 months ago[lldb][docs] Remove mentions of MIPS64 Linux debug
David Spickett [Mon, 13 Mar 2023 12:01:31 +0000 (12:01 +0000)]
[lldb][docs] Remove mentions of MIPS64 Linux debug

This was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8.

17 months ago[lldb] Use static instead of anonymous namesapce in CrashReason
David Spickett [Thu, 9 Mar 2023 14:55:12 +0000 (14:55 +0000)]
[lldb] Use static instead of anonymous namesapce in CrashReason

As preferred by the llvm guidelines.

17 months ago[lldb] Remove MIPS64 specific signal handling for Linux
David Spickett [Thu, 9 Mar 2023 14:42:28 +0000 (14:42 +0000)]
[lldb] Remove MIPS64 specific signal handling for Linux

MIPS Linux support was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8
so this is no longer needed.

17 months ago[clangd] Remove the IncludeStructure::isSelfContained API.
Haojian Wu [Mon, 13 Mar 2023 09:51:38 +0000 (10:51 +0100)]
[clangd] Remove the IncludeStructure::isSelfContained API.

This API was merely used in the old unused-include implementation, with
the removal, this API is not used anymore.

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

17 months ago[clangd] Remove IWYU handling code that is used only for the old unused-include feature.
Haojian Wu [Fri, 10 Mar 2023 11:06:32 +0000 (12:06 +0100)]
[clangd] Remove IWYU handling code that is used only for the old unused-include feature.

The old implementation has been removed, this patch removes the clangd's IWYU
code that is only used for the old implmentation (include-cleaner library has
better support):

- IWYU export pragma
- IWYU keep pragma

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

17 months agoRevert "[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString"
Alex Bradbury [Mon, 13 Mar 2023 11:20:28 +0000 (11:20 +0000)]
Revert "[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString"

This reverts commit a7313f83b9ca904fade446e000550c69e0887cbf.

Causes a buildbot failure.

17 months ago[DWARFLinker][DWARFv5] Add support for DW_FORM_addrx*
Alexey Lapshin [Thu, 9 Mar 2023 14:42:01 +0000 (15:42 +0100)]
[DWARFLinker][DWARFv5] Add support for DW_FORM_addrx*

This patch add support of DWARFv5 attribute forms: DW_FORM_addrx1,
DW_FORM_addrx2, DW_FORM_addrx3, DW_FORM_addrx4.

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

17 months ago[RISCV][test] Fix typos in RISCVISAInfoTest
Alex Bradbury [Mon, 13 Mar 2023 11:00:46 +0000 (11:00 +0000)]
[RISCV][test] Fix typos in RISCVISAInfoTest

17 months ago[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString
Alex Bradbury [Mon, 13 Mar 2023 10:53:05 +0000 (10:53 +0000)]
[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString

Prior to this patch, unrecognised z/s/sx/x prefixed extensions were not
ignored when IgnoreUnknown=true.

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

17 months ago[RISCV][test] Expand test coverage of RISCVISAInfo
Alex Bradbury [Mon, 13 Mar 2023 10:51:15 +0000 (10:51 +0000)]
[RISCV][test] Expand test coverage of RISCVISAInfo

D144343 added C++ unit tests for the newly added
RISCVISAInfo::parseArchStringNormalized. This patch adds test coverage
for parseArchString and the toFeatureVector member method.

Posting for review as it would be useful if someone can take a quick
look to check they don't feel I've missed testing an important aspect of
the current behaviour.

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

17 months ago[IPSCCP] Don't add !range metadata for vector returns
Nikita Popov [Mon, 13 Mar 2023 10:11:55 +0000 (11:11 +0100)]
[IPSCCP] Don't add !range metadata for vector returns

!range metadata is currenlty not supported on vector types. This
fixes verifier failures exposed by D144467.

17 months ago[LLD] Increase thunk pass limit
Peter Smith [Fri, 10 Mar 2023 13:22:18 +0000 (13:22 +0000)]
[LLD] Increase thunk pass limit

In issue 61250 https://github.com/llvm/llvm-project/issues/61250 there is
an example of a program that takes 17 passes to converge, which is 2 more
than the current limit of 15. Analysis of the program shows a particular
section that is made up of many roughly thunk sized chunks of code ending
in a call to a symbol that needs a thunk. Due to the positioning of the
section, at each pass a subset of the calls go out of range of their
original thunk, needing a new one created, which then pushes more thunks
out of range. This process eventually stops after 17 passes.

This patch is the simplest fix for the problem, which is to increase
the pass limit. I've chosen to double it which should comfortably
account for future cases like this, while only taking a few more
seconds to reach the limit in case of non-convergence.

As discussed in the issue, there could be some additional work done
to limit thunk reuse, this would potentially increase the number of
thunks in the program but should speed up convergence.

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

17 months ago[BOLT] Pass instrumentation-file arg for X86 xmm test
Vladislav Khmelevsky [Mon, 13 Mar 2023 09:36:26 +0000 (13:36 +0400)]
[BOLT] Pass instrumentation-file arg for X86 xmm test

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

17 months ago[BOLT] Improve dynamic relocations support for CI
Vladislav Khmelevsky [Fri, 10 Feb 2023 13:09:03 +0000 (17:09 +0400)]
[BOLT] Improve dynamic relocations support for CI

This patch fixes few problems with supporting dynamic relocations in CI.
1. After dynamic relocations and functions were read search for dynamic
relocations located in functions. Currently we expected them only to be
relative and only to be in constant island. Mark islands of such
functions to have dynamic relocations and create CI access symbol on the
relocation offset, so the BD would be created for such place.
2. During function disassemble and handling address reference for
constant island check if the referred external CI has dynamic
relocation. And if it has one we would continue to refer original CI
rather then creating a local copy.
3. After function disassembly stage mark function that has dynamic reloc
in CI as non-simple. We don't want such functions to be optimized, since
such passes as split function would create 2 copies of CI which we
unable to support currently.
4. During updating output values for BF search for BD located in CI and
update their output locations.
5. On dynamic relocation patching stage search for binary data located
on relocation offset. If it was moved use new relocation offset value
rather then an old one.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

17 months ago[AMDGPU] Remove BoolToList class
Jay Foad [Mon, 13 Mar 2023 08:23:05 +0000 (08:23 +0000)]
[AMDGPU] Remove BoolToList class

Replace all:
  foreach _ = BoolToList<cond>.ret in
with:
  if cond then

Thanks to Philip Reames for D145711 which enabled this.

17 months ago[mlir][IR] Add ForwardDominanceIterator for IR walkers
Matthias Springer [Mon, 13 Mar 2023 08:14:54 +0000 (09:14 +0100)]
[mlir][IR] Add ForwardDominanceIterator for IR walkers

This iterator is similar to `ForwardIterator` but enumerates blocks according to their successor relationship. As a first use case, this new iterator is utilized in the dialect conversion framework.

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

17 months ago[doc] [Modules] Document how to implement ABI compatible code in module units
Chuanqi Xu [Mon, 13 Mar 2023 08:42:55 +0000 (16:42 +0800)]
[doc] [Modules] Document how to implement ABI compatible code in module units

17 months ago[X86] Pre-commit test for #61271
Phoebe Wang [Mon, 13 Mar 2023 08:39:08 +0000 (16:39 +0800)]
[X86] Pre-commit test for #61271

17 months ago[mlir][Bazel] Adjustments for fa51c1753a274fbb7a71d8fe91fd4e5caf2fa4d3
Adrian Kuegel [Mon, 13 Mar 2023 07:54:29 +0000 (08:54 +0100)]
[mlir][Bazel] Adjustments for fa51c1753a274fbb7a71d8fe91fd4e5caf2fa4d3

Fix bazel build.

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

17 months ago[LLDB][ObjectFileELF] Correct the return type of Reloc{Offset,Addend}32
Weining Lu [Mon, 13 Mar 2023 07:44:58 +0000 (15:44 +0800)]
[LLDB][ObjectFileELF] Correct the return type of Reloc{Offset,Addend}32

This is a follow up of D145550.

I think Reloc{Type,Symbol}{32,64} can keep unchanged as they are not
directly returning a field of the ELFRel[a] struct.

Reviewed By: DavidSpickett

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

17 months ago[LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64
Weining Lu [Mon, 13 Mar 2023 07:44:56 +0000 (15:44 +0800)]
[LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64

According to `/usr/include/elf.h` and `lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h`.
For ELF64 relocation, types of `offset` and `addend` should be `elf_addr` and `elf_sxword`.

Reviewed By: DavidSpickett

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

17 months ago[LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctions
Weining Lu [Mon, 13 Mar 2023 07:44:47 +0000 (15:44 +0800)]
[LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctions

Currently ApplyReloctions() deals with different archs' relocation types
together (in a single `switch() {..}`). I think it is incorrect because
different relocation types of different archs may have same enum values.

For example:
`R_LARCH_32` and `R_X86_64_64` are both `1`;
`R_LARCH_64` and `R_X86_64_PC32` are both `2`.

This patch handles each arch in seperate `switch()` to solve the enum
values conflict issue.

And a new test is added for LoongArch64.

Reviewed By: DavidSpickett

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

17 months ago[mlir][affine][analysis] Fix `closedUB` handling in `getSliceBounds`
Matthias Springer [Mon, 13 Mar 2023 07:56:08 +0000 (08:56 +0100)]
[mlir][affine][analysis] Fix `closedUB` handling in `getSliceBounds`

There were cases in which `ubAdjustment` was not applied to the resulting UB.

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

17 months ago[C++20] [Modules] Treat module linkage as formal linkage only
Chuanqi Xu [Mon, 13 Mar 2023 07:43:08 +0000 (15:43 +0800)]
[C++20] [Modules] Treat module linkage as formal linkage only

Close https://github.com/llvm/llvm-project/issues/61321

There are two linkage modes in clang now: one for internal linkage and
one for formal linkage. The internal linkage is for the implementation
details and the formal linkage is for the consistency with the C++
standard.

Since we previously implemented the strong ownership for modules, the
module linkage is not meaningful for linkers any more. So the module
linkage should only be used for formal linkage.

17 months ago[libc] Enable integration tests when built with gcc.
Siva Chandra Reddy [Mon, 13 Mar 2023 07:46:24 +0000 (07:46 +0000)]
[libc] Enable integration tests when built with gcc.

17 months ago[libc] Declare __dso_handle in the integration test instead of startup.
Siva Chandra Reddy [Sun, 12 Mar 2023 08:21:50 +0000 (08:21 +0000)]
[libc] Declare __dso_handle in the integration test instead of startup.

Fixes #61355. The __dso_handle decl was introduced incorrectly into the startup
objects during the integration test cleanup which moved the integration tests
away from using an artificial sysroot to using -nostdlib. Having it in the
startup creates the duplicate symbol error when one does not use -nostdlib.
Since this is an integration test only problem, it is meaningful to keep it in
the integration test anyway.

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

17 months agoasan: disable odd_stack_size test for powerpc
Dmitry Vyukov [Mon, 13 Mar 2023 07:43:03 +0000 (08:43 +0100)]
asan: disable odd_stack_size test for powerpc

Fail on powerpc64 bots with:
AddressSanitizer: CHECK failed: asan_thread.cpp:315 "((AddrIsInStack((uptr)&local))) != (0)"
https://lab.llvm.org/buildbot/#/builders/18/builds/8162
Disable to unbreak bots.

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

17 months ago[mlir] Use llvm::is_contained (NFC)
Kazu Hirata [Mon, 13 Mar 2023 07:43:27 +0000 (00:43 -0700)]
[mlir] Use llvm::is_contained (NFC)

17 months agoReturn "[LICM] Support logical AND/OR when hoisting min/max"
Max Kazantsev [Mon, 13 Mar 2023 07:13:33 +0000 (14:13 +0700)]
Return "[LICM] Support logical AND/OR when hoisting min/max"

Underlying bug (creation of umin for pointers) is now fixed.

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

17 months ago[StructurizeCFG] Use UniformityAnalysis instead of DivergenceAnalysis
pvanhout [Thu, 9 Mar 2023 14:01:56 +0000 (15:01 +0100)]
[StructurizeCFG] Use UniformityAnalysis instead of DivergenceAnalysis

Depends on D145572

Reviewed By: foad, sameerds

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

17 months ago[libc] Special case sniffing of thread start args for riscv.
Siva Chandra [Sun, 12 Mar 2023 08:31:03 +0000 (08:31 +0000)]
[libc] Special case sniffing of thread start args for riscv.

17 months ago[LICM] Do not hoist min/max for pointer types
Max Kazantsev [Mon, 13 Mar 2023 07:11:48 +0000 (14:11 +0700)]
[LICM] Do not hoist min/max for pointer types

umin and similar intrinsics are not defined for them.

17 months ago[RISCV] Return false for unsupported VTs in isFPImmLegal.
Craig Topper [Mon, 13 Mar 2023 06:29:25 +0000 (23:29 -0700)]
[RISCV] Return false for unsupported VTs in isFPImmLegal.

I don't have a test case that fails for this, but it seemed like
we should only handle legal types. The callers I looked at in
DAGCombine either check the type is legal or don't even call
isFPImmLegal unless LegalOperations is true.

Written in a slightly odd way because switches on EVT require
an additional isSimple check so an if/else chain is easier. Used a bool
to shorten the code instead of having multiple ifs and returns.
AArch64 uses a similarish structure.

17 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Mon, 13 Mar 2023 06:01:50 +0000 (23:01 -0700)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

17 months agoRecommit "[RISCV] Add separate lookup tables for fli.h and fli.d."
Craig Topper [Mon, 13 Mar 2023 05:15:33 +0000 (22:15 -0700)]
Recommit "[RISCV] Add separate lookup tables for fli.h and fli.d."

Fix mistake in f16 table in previous patch.

Original commit message:
Use separate lookup tables instead of trying to reuse the fli.s
table.

We were missing the 2 denormal cases for fli.h. We also had an issue
where fli.d was only checking 8 bits of the 11 bit exponent.

17 months agoRevert "[RISCV] Add separate lookup tables for fli.h and fli.d."
Craig Topper [Mon, 13 Mar 2023 05:02:23 +0000 (22:02 -0700)]
Revert "[RISCV] Add separate lookup tables for fli.h and fli.d."

This reverts commit ebc11b68412cdcf2a0e6e2c50df262cfd9b8f481.

I made a mistake in the f16 table. Will fix and recommit.

17 months agoRevert "[RISCV] Remove unused function declaration. NFC"
Craig Topper [Mon, 13 Mar 2023 05:01:41 +0000 (22:01 -0700)]
Revert "[RISCV] Remove unused function declaration. NFC"

This reverts commit 5589c3cf752383fa42eaacc13fb985653ae528b6.

I need to revert an earlier patch to fix a mistake.

17 months ago[RISCV] Remove unused function declaration. NFC
Craig Topper [Mon, 13 Mar 2023 04:23:39 +0000 (21:23 -0700)]
[RISCV] Remove unused function declaration. NFC

17 months ago[test][asan] Fix test on MacOS 12+
Vitaly Buka [Fri, 10 Mar 2023 17:45:37 +0000 (09:45 -0800)]
[test][asan] Fix test on MacOS 12+

Reviewed By: rsundahl

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

17 months agoReland rGf35a09daebd0a90daa536432e62a2476f708150d and rG63854f91d3ee1056796a5ef277536...
Chen Zheng [Fri, 9 Dec 2022 05:27:14 +0000 (00:27 -0500)]
Reland rGf35a09daebd0a90daa536432e62a2476f708150d and rG63854f91d3ee1056796a5ef27753648396cac6ec

[DAGCombiner] handle more store value forwarding

When lowering calls on target like PPC, some stack loads
will be generated for by value parameters. Node CALLSEQ_START
prevents such loads from being combined.

Suggested by @RolandF, this patch removes the unnecessary
loads for the byval parameter by extending ForwardStoreValueToDirectLoad

Reviewed By: nemanjai, RolandF

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

17 months ago[SPARC] Attempt to fix bug introduced by D142458
Vitaly Buka [Mon, 13 Mar 2023 01:22:41 +0000 (18:22 -0700)]
[SPARC]  Attempt to fix bug introduced by D142458

Reported https://lab.llvm.org/buildbot/#/builders/5/builds/32113

17 months ago[SelectionDAG] Deprecate isNullValue and isAllOnesValue
Kazu Hirata [Mon, 13 Mar 2023 01:25:07 +0000 (18:25 -0700)]
[SelectionDAG] Deprecate isNullValue and isAllOnesValue

This patch deprecates them as there are no known uses of these
functions in the project.

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

17 months ago[SelectionDAG] Fix mismatched truncate when combine BUILD_VECTOR with EXTRACT_SUBVECTOR
Jun Ma [Fri, 10 Mar 2023 01:00:15 +0000 (09:00 +0800)]
[SelectionDAG] Fix mismatched truncate when combine BUILD_VECTOR with EXTRACT_SUBVECTOR

Just use correct type for truncation. Fixes PR59625

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

17 months ago[clang-tidy] Support std::format and std::print in readability-redundant-string-cstr
Mike Crowe [Sun, 12 Mar 2023 21:42:52 +0000 (21:42 +0000)]
[clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

std::format (C++20) and std::print (C++23) are perfectly happy to accept
std::string arguments. Converting them to C-style strings by calling
c_str() is unnecessary and may cause extra walking of the string to
determine its length.

Depends on D144216

Reviewed By: carlosgalvezp, PiotrZSL

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

17 months ago[gn build] Port 43562287a816
LLVM GN Syncbot [Sun, 12 Mar 2023 21:25:33 +0000 (21:25 +0000)]
[gn build] Port 43562287a816

17 months agoIntroduce mlir::tracing::ExecutionContext
Mehdi Amini [Mon, 23 Jan 2023 01:14:10 +0000 (01:14 +0000)]
Introduce mlir::tracing::ExecutionContext

This component acts as an action handler that can be registered in the
MLIRContext. It is the main orchestration of the infrastructure, and implements
support for clients to hook there and snoop on or control the execution.
This is the basis to build tracing as well as a "gdb-like" control of the
compilation flow.

The ExecutionContext acts as a handler in the MLIRContext for executing an
Action. When an action is dispatched, it'll query its set of Breakpoints
managers for a breakpoint matching this action. If a breakpoint is hit, it
passes the action and the breakpoint information to a callback. The callback
is responsible for controlling the execution of the action through an enum
value it returns. Optionally, observers can be registered to be notified
before and after the callback is executed.

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

17 months ago[libc++] Granularize <exception>
Nikolas Klauser [Wed, 1 Mar 2023 19:13:55 +0000 (20:13 +0100)]
[libc++] Granularize <exception>

This patch also updates the moved code to the new style (i.e. formatted, replaced marcos and typedefs)

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits

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

17 months ago[clang-tidy][NFC] Update docs/clang-tidy/checks/list.rst
Piotr Zegar [Sun, 12 Mar 2023 20:01:36 +0000 (20:01 +0000)]
[clang-tidy][NFC] Update docs/clang-tidy/checks/list.rst
Mark fixes to Yes for cppcoreguidelines-avoid-capture-default-when-capturing-this
check, as it provides fixes

17 months ago[clang-tidy] Fix rename_check.py
Piotr Zegar [Sun, 12 Mar 2023 19:51:03 +0000 (19:51 +0000)]
[clang-tidy] Fix rename_check.py

Fix checks renaming after directory structure
of clang-tidy has changed.

17 months ago[SPIR-V] Fix llvm deprecated warnings
Michal Paszkowski [Sun, 12 Mar 2023 19:33:42 +0000 (20:33 +0100)]
[SPIR-V] Fix llvm deprecated warnings

Fixes warnings related to getAllOnesValue and isNullValue being
deprecated.

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

17 months ago[flang] Simpify parent component handling
Valentin Clement [Sun, 12 Mar 2023 19:23:58 +0000 (20:23 +0100)]
[flang] Simpify parent component handling

This patch simplify the parent component handling when it's the last ref.

The first field is not necessary when the target box type is set correctly.

Reviewed By: PeteSteinfeld

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

17 months ago[InstCombine] Precommit tests
Kazu Hirata [Sun, 12 Mar 2023 19:00:14 +0000 (12:00 -0700)]
[InstCombine] Precommit tests

This patch precommits tests for:

https://github.com/llvm/llvm-project/issues/60802
https://github.com/llvm/llvm-project/issues/61183

which are about std::bit_ceil and std::bit_floor, respectively.

17 months ago[RISCV] Add separate lookup tables for fli.h and fli.d.
Craig Topper [Sun, 12 Mar 2023 18:19:21 +0000 (11:19 -0700)]
[RISCV] Add separate lookup tables for fli.h and fli.d.

Use separate lookup tables instead of trying to reuse the fli.s
table.

We were missing the 2 denormal cases for fli.h. We also had an issue
where fli.d was only checking 8 bits of the 11 bit exponent.

17 months ago[RISCV] Add test cases for fli.h and fli.d CodeGen bugs. NFC
Craig Topper [Sun, 12 Mar 2023 18:14:20 +0000 (11:14 -0700)]
[RISCV] Add test cases for fli.h and fli.d CodeGen bugs. NFC

We fail to use fli.h for the 2 denormal values.
We use fli.d for some values where the value is larger than a float
can represent due to truncating the exponent to 8 bits without checking
if it fits in 8 bits.

17 months ago[clang][darwin] An OS version preprocessor define is added for any darwin OS
Alex Lorenz [Sun, 12 Mar 2023 17:52:12 +0000 (10:52 -0700)]
[clang][darwin] An OS version preprocessor define is added for any darwin OS

This change generalizes the OS version macro for all darwin OSes. The OS-specific OS version macros are still defined to preserve compatibility.

17 months ago[gn build] Port c491c9170239
LLVM GN Syncbot [Sun, 12 Mar 2023 17:27:38 +0000 (17:27 +0000)]
[gn build] Port c491c9170239

17 months ago[clang-tidy] Implement CppCoreGuideline F.18
Chris Cotter [Sun, 12 Mar 2023 16:55:47 +0000 (16:55 +0000)]
[clang-tidy] Implement CppCoreGuideline F.18

Warn when an rvalue reference function paramter is never moved
from within the function body.

Reviewed By: carlosgalvezp

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

17 months ago[RISCV] Add overrides of isLoadFromStackSlot/isStoreFromStackSlot signatures that...
Craig Topper [Sun, 12 Mar 2023 16:45:46 +0000 (09:45 -0700)]
[RISCV] Add overrides of isLoadFromStackSlot/isStoreFromStackSlot signatures that don't have MemBytes.

D145471 added overrides of the other signature to return MemBytes,
but shouldn't have removed these overrides.

These signatures will now call the MemBytes signature and ignore
the MemBytes. This matches X86.

17 months ago[RISCV][NFCI] Use common MCELFStreamer code for attribute emission
Alex Bradbury [Sun, 12 Mar 2023 16:11:12 +0000 (16:11 +0000)]
[RISCV][NFCI] Use common MCELFStreamer code for attribute emission

D102894 introduced common code for the emission of ELF attributes. Our
implementation in RISC-V predates this, and basically copies the Arm
logic at the time. This patch removes that duplication and uses the
shared logic instead.

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

17 months ago[DAG] Remove redundant isZExtFree(SDValue,VT) overrides. NFC.
Simon Pilgrim [Sun, 12 Mar 2023 15:55:58 +0000 (15:55 +0000)]
[DAG] Remove redundant isZExtFree(SDValue,VT) overrides. NFC.

These implementations both match the TargetLoweringBase.isZExtFree implementation

17 months ago[mlir] NFC - Add some more static value utils
Nicolas Vasilache [Fri, 10 Mar 2023 13:35:44 +0000 (05:35 -0800)]
[mlir] NFC - Add some more static value utils

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

17 months ago[DAG] visitZERO_EXTEND - pull out the repeated SDLoc(N) variables
Simon Pilgrim [Sun, 12 Mar 2023 15:18:46 +0000 (15:18 +0000)]
[DAG] visitZERO_EXTEND - pull out the repeated SDLoc(N) variables

17 months ago[DAG] Cleanup the (zext (shl (zext x), cst)) -> (shl (zext x), cst) fold. NFC.
Simon Pilgrim [Sun, 12 Mar 2023 15:00:11 +0000 (15:00 +0000)]
[DAG] Cleanup the (zext (shl (zext x), cst)) -> (shl (zext x), cst) fold. NFC.

Preliminary cleanup before adding some additional legality and value tracking handling.

17 months ago[AMDGPU] Regenerate sdwa-peephole.ll
Simon Pilgrim [Sun, 12 Mar 2023 13:50:20 +0000 (13:50 +0000)]
[AMDGPU] Regenerate sdwa-peephole.ll

17 months ago[amdgpu][nfc] Replace ad hoc LDS frame recalculation with absolute_symbol MD
Jon Chesterfield [Sun, 12 Mar 2023 13:47:40 +0000 (13:47 +0000)]
[amdgpu][nfc] Replace ad hoc LDS frame recalculation with absolute_symbol MD

Post ISel, LDS variables are absolute values. Representing them as
such is simpler than the frame recalculation currently used to build assembler
tables from their addresses.

This is a precursor to lowering dynamic/external LDS accesses from non-kernel
functions.

Reviewed By: arsenm

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

17 months ago[clang-tidy] Provide default template arguments in <string>
Mike Crowe [Sun, 12 Mar 2023 13:32:45 +0000 (13:32 +0000)]
[clang-tidy] Provide default template arguments in <string>

Simplify the use of the basic_string and basic_string_view types by
providing default template arguments.

Depends on D145311

Reviewed By: PiotrZSL

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

17 months ago[clang-tidy] Make readability-container-size-empty check using <string> header
Mike Crowe [Sun, 12 Mar 2023 13:32:29 +0000 (13:32 +0000)]
[clang-tidy] Make readability-container-size-empty check using <string> header

Improve the generic <string> header by adding the size() method so that
it can be used to replace the custom implementation in the
readability-container-size-empty check.

This requires fixing an incorrect comparison of a std::wstring with a
char string literal.

Unfortunately, removing the custom basic_string implementation means
fixing the line numbers for many of the checks.

Depends on D145312

Reviewed By: PiotrZSL

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

17 months ago[clang-tidy] Make readability-string-compare check use <string> header
Mike Crowe [Sun, 12 Mar 2023 13:28:33 +0000 (13:28 +0000)]
[clang-tidy] Make readability-string-compare check use <string> header

Improve the generic <string> header by adding another constructor,
std::basic_string::empty and operator!= overload set so that it can be
used to replace the custom implementation in the
readability-string-compare check.

Depends on D145311

Reviewed By: PiotrZSL

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

17 months ago[DAG] visitAND - fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profit...
Simon Pilgrim [Sun, 12 Mar 2023 13:25:23 +0000 (13:25 +0000)]
[DAG] visitAND - fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profitable.

Try to more aggressively narrow masks of extended values.

This is mainly for cases where the mask is trying to zero out any_extended upper bits, assuming we can zext/trunc the values for free.

This catches a few actual missed folds, as well as helps canonicalize a number of other cases which were being caught in isel etc.

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

17 months ago[X86] and-shift.ll - add gnux32 test coverage to ensure the X32 ABI correctly narrows...
Simon Pilgrim [Sun, 12 Mar 2023 13:11:21 +0000 (13:11 +0000)]
[X86] and-shift.ll - add gnux32 test coverage to ensure the X32 ABI correctly narrows the i64 shifts

17 months ago[SVE][Builtins] Lower X forms of fp binop/mla arithmetic builtins to dedicated intrinsics
Paul Walker [Fri, 10 Feb 2023 16:22:25 +0000 (16:22 +0000)]
[SVE][Builtins] Lower X forms of fp binop/mla arithmetic builtins to dedicated intrinsics

This patch changes the lowering for the following fp builtins to
emit calls to the new aarch64.sve.###.u intrinsics.
  svabd_x, svabd_n_x
  svadd_x, svadd_n_x
  svdiv_x, svdiv_n_x
  svdivr_x, svdivr_n_x
  svmad_x, svmad_n_x
  svmax_x, svmax_n_x
  svmaxnm_x, svmaxnm_n_x
  svmin_x, svmin_n_x
  svminnm_x, svminnm_n_x
  svmla_x, svmla_n_x
  svmls_x, svmls_n_x
  svmsb_x, svmsb_n_x
  svmul_x, svmul_n_x
  svmulx_x, svmulx_n_x
  svnmad_x, svnmad_n_x
  svnmla_x, svnmla_n_x
  svnmls_x, svnmls_n_x
  svnmsb_X, svnmsb_n_x
  svsub_x, svsub_n_x
  svsubr_x, svsubr_n_x

Depends on D143765.

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

17 months ago[InstCombine] Extend SVEVectorFuseMulAddSub to support newly added "undef" intrinsics.
Paul Walker [Mon, 20 Feb 2023 17:52:54 +0000 (17:52 +0000)]
[InstCombine] Extend SVEVectorFuseMulAddSub to support newly added "undef" intrinsics.

D143767 will change the intrinsics used to lower floating-point
svadd_x, svmul_x and svsub_x builtins. This will result in the
combines added as part of D140200 to no longer fire in all cases.
This patch extends the existing combines for contraction to cover
fadd_u, fmul_u and fsub_u intrinsics.

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

17 months agoasan: fix crash on odd stack size
Dmitry Vyukov [Fri, 10 Mar 2023 16:36:14 +0000 (17:36 +0100)]
asan: fix crash on odd stack size

The test currently crashes as:

AddressSanitizer: CHECK failed: asan_poisoning.cpp:38 "((AddrIsAlignedByGranularity(addr))) != (0)"

Main stack address/size don't have to be aligned on asan shadow granularity.
Align stack bottom.

Reviewed By: melver, vitalybuka

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

17 months ago[X86] matchAddressRecursively - support zext(and(shl(x,c1)),c2) -> shl(zext(and(x...
Simon Pilgrim [Sun, 12 Mar 2023 09:48:40 +0000 (09:48 +0000)]
[X86] matchAddressRecursively - support zext(and(shl(x,c1)),c2) -> shl(zext(and(x, c2 >> c1),c1)

This came about while investigating ways to handle D145468 in a more generic manner, which involves trying harder to fold and(zext(x),c) -> zext(and(x,c))

Alive2: https://alive2.llvm.org/ce/z/7fXtDt (generic fold)

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

17 months ago[mlir][llvm] Add visibility attribute
Christian Ulmann [Fri, 10 Mar 2023 15:35:04 +0000 (16:35 +0100)]
[mlir][llvm] Add visibility attribute

This commit introduces the LLVM's visibility attribute and adds it to
both globals and functions.

Furthermore, this commit ensures that "thread_local" is printed in the
correct place and adds a test for that.

Reviewed By: gysit

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

17 months agoRevert "[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible"
Brad Smith [Sun, 12 Mar 2023 07:58:21 +0000 (03:58 -0400)]
Revert "[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible"

This reverts commit 6590a372fa3f4582c04b4b179f90a3c728e75025.

17 months agoRevert "[Clang][AIX][p] Manually Claim -p in front end"
Michael Francis [Sun, 12 Mar 2023 08:11:44 +0000 (08:11 +0000)]
Revert "[Clang][AIX][p] Manually Claim -p in front end"

This reverts commit 59848b9ebae6a92a4342b1e8aa32feaf5c9c4b51, as it
causes some failures in AIX-related Lit tests.

17 months ago[Clang][AIX][p] Manually Claim -p in front end
Michael Francis [Wed, 1 Mar 2023 00:56:06 +0000 (00:56 +0000)]
[Clang][AIX][p] Manually Claim -p in front end

The current implementation of `-p` does not claim the argument once it
is passed. Since it pushes `-pg` directly, it is only ever referred to
again when linking. As a result, when compiling with `-S`, the compiler
warns that `-p` goes unused even though that is not the case.

With this patch, if both `-p` and `-pg` are passed, the argument that is
passed second will take precedence. `-p` will still throw an error on
unsupported platforms, regardless of precedence.

This revision includes a test case, which has been placed in
`clang/test/Driver/zos-profiling-error.c`. As a result,
`zos-profiling-error.c` has been renamed to `ibm-profiling.c`. This
revision also passes `clang/test/Driver/aix-ld.c`.

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

17 months ago[libc][NFC] Reduce the number of threads created in cnd_test to 1000 form 10000.
Siva Chandra Reddy [Sun, 12 Mar 2023 06:37:37 +0000 (06:37 +0000)]
[libc][NFC] Reduce the number of threads created in cnd_test to 1000 form 10000.

The high number of 10000 threads was choking bot builders running on boards with
very small memory.

17 months agoRevert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
Igor Zhukov [Sun, 12 Mar 2023 06:27:23 +0000 (13:27 +0700)]
Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"

libc++ clang-cl tests failed after that commit

Look at https://buildkite.com/llvm-project/libcxx-ci/builds/20490

Reviewed By: #libc

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

This reverts commit b00aaab730ae8bd7f8a44e1808e668e20c2c9282.

17 months ago[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible
Koakuma [Sat, 11 Mar 2023 22:47:53 +0000 (17:47 -0500)]
[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible

On 64-bit target, when doing i64 BR_CC where one of the comparison operands is a
constant zero, try to fold the compare and BPcc into a BPr instruction.

For all integers, EQ and NE comparison are available, additionally for signed
integers, GT, GE, LT, and LE is also available.

Reviewed By: arsenm

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

17 months ago[SPARC] Implement hooks for conditional branch relaxation
Koakuma [Sat, 11 Mar 2023 22:39:25 +0000 (17:39 -0500)]
[SPARC] Implement hooks for conditional branch relaxation

Integrate the BranchRelaxation pass to help with relaxing out-of-range
conditional branches.

This is mostly of concern for SPARCv9, which uses conditional branches with
much smaller range than its v8 counterparts.
(Some large autogenerated code, such as the ones generated by TableGen, already
hits this limitation when building in Release)

Reviewed By: arsenm

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

17 months agoRevert "[InstCombine] use loop info when running the pass after loop vectorization"
Sanjay Patel [Sat, 11 Mar 2023 22:25:12 +0000 (17:25 -0500)]
Revert "[InstCombine] use loop info when running the pass after loop vectorization"

This reverts commit 43ae4b62b2671cf73e691c0b53324cd39405cd51.

This was intended to be practically NFC in terms of the overall
opt pipeline, but there is experimental data showing that code
changes occurred here:
https://llvm-compile-time-tracker.com/compare.php?from=772aa05452f8ff90a47168e6801cda2acb5a1873&to=43ae4b62b2671cf73e691c0b53324cd39405cd51&stat=size-text

17 months ago[sanitizer] Fix text in error message
Vitaly Buka [Sat, 11 Mar 2023 21:40:42 +0000 (13:40 -0800)]
[sanitizer] Fix text in error message

17 months ago[InstCombine] use loop info when running the pass after loop vectorization
Sanjay Patel [Sat, 11 Mar 2023 19:17:50 +0000 (14:17 -0500)]
[InstCombine] use loop info when running the pass after loop vectorization

This is the follow-up to D144199 and suggestion from D144045.
We make use of loop info explicit via InstCombine pass parameter
rather than semi-arbitrary via caching.

The only InstCombine transform that uses LoopInfo currently is a
GEP fold in visitGEPOfGEP(), so that shows up as a failure in the
dedicated test for the fold as well as several LoopVectorizer tests
that run extra passes.

I don't see any pass manager regression tests that actually check
for pass options, but this is intended to be NFC for the pass
pipeline behavior - we only try to use loop info where it would
have been used before via caching .

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

17 months ago[X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA
Simon Pilgrim [Sat, 11 Mar 2023 18:43:44 +0000 (18:43 +0000)]
[X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA

17 months ago[HIP] Make `--offload-add-rpath` alias of `-frtlib-add-rpath`
Yaxun (Sam) Liu [Mon, 6 Mar 2023 16:45:11 +0000 (11:45 -0500)]
[HIP] Make `--offload-add-rpath` alias of `-frtlib-add-rpath`

HIP runtime is the language runtime of HIP. When users need
to specify rpath, they usually need to specify rpath for
both compiler-rt and HIP runtime. It seems redundant
to have separate options. Therefore make --offload-add-rpath
an alias to -frtlib-add-rpath.

Reviewed by: Fangrui Song, Artem Belevich

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

17 months ago[clang-tidy][NFC] Make abseil-redundant-strcat-calls checker use <string> header
Mike Crowe [Sat, 11 Mar 2023 17:46:56 +0000 (17:46 +0000)]
[clang-tidy][NFC] Make abseil-redundant-strcat-calls checker use <string> header

Remove duplication in abseil-redundant-strcat-calls check tests,
by using dummy <string> header file string.

Depends on D145310

Reviewed By: PiotrZSL

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

17 months ago[clang-tidy] Fix false-positive in cppcoreguidelines-slicing
Piotr Zegar [Sat, 11 Mar 2023 17:36:20 +0000 (17:36 +0000)]
[clang-tidy] Fix false-positive in cppcoreguidelines-slicing

When warning would be emitted in constructor for virtual base class
initialization.

Fixes: https://github.com/llvm/llvm-project/issues/31187

Reviewed By: carlosgalvezp

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

17 months ago[mlir][core] Fix inline pass default pipeline dump
Ahmed Harmouche [Sat, 11 Mar 2023 17:07:42 +0000 (09:07 -0800)]
[mlir][core] Fix inline pass default pipeline dump

The inliner pass performs canonicalization when created programtically, run with `mlir-opt` with default options, or when explicitly specified. However, when running the pipeline resulting from a `-dump-pass-pipeline` on a default inline pass, the canonicalization is not performed as part of the inlining. This is because the default value for the `default-pipeline` option of the inline pass is an empty string, and this is selected during the dumping. When `InlinerPass::initializeOptions` detects the empty string, it sets the `defaultPipeline` to `nullptr`, which was previously set to canonicalize in the `InlinerPass` constructor, thus the canonicalization is not performed.

The added test checks if the inline pass performs canonicalization by default, and that the dumped `default-pipeline` is set to `canonicalize`.

Fixes: https://github.com/llvm/llvm-project/issues/60960

Reviewed By: rriddle

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

17 months ago[libc] update LibcTableGenUtil for LLVM_LINK_LLVM_DYLIB
Stephen Neuendorffer [Sat, 11 Mar 2023 05:52:26 +0000 (21:52 -0800)]
[libc] update LibcTableGenUtil for LLVM_LINK_LLVM_DYLIB

This library is linked into libc-hdrgen, which is compiled with
DISABLE_LLVM_LINK_LLVM_DYLIB.  This option avoids linking with
libLLVM.so when LLVM_LINK_LLVM_DYLIB is specified.  Unfortunately,
this can cause wierd linkage errors where symbols are defined
multiple times, with one definition coming from static linkage
and another definition coming from libLLVM.so.  This is usually
apparent as a link error with options defined multiple times.

This patch adds DISABLE_LLVM_LINK_LLVM_DYLIB to this library, to
get consistent linkage of libc-hdrgen.

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

17 months ago[Flang] Allow compile *.f03, *.f08 file
Shao-Ce SUN [Sat, 11 Mar 2023 16:17:30 +0000 (00:17 +0800)]
[Flang] Allow compile *.f03, *.f08 file

Fix issue [#61260](https://github.com/llvm/llvm-project/issues/61260)

Reviewed By: awarzynski

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

17 months ago[Clang][Doc] Fix inconsistent links in release notes
Roy Jacobson [Sat, 11 Mar 2023 16:39:33 +0000 (18:39 +0200)]
[Clang][Doc] Fix inconsistent links in release notes

17 months ago[DAG] combineShiftAnd1ToBitTest - improve support for peeking through truncations
Simon Pilgrim [Sat, 11 Mar 2023 16:37:41 +0000 (16:37 +0000)]
[DAG] combineShiftAnd1ToBitTest - improve support for peeking through truncations

Allows us to handle shift amounts that exceed the original bitwidth

17 months agoRevert "[Flang] Allow compile *.f03, *.f08 file"
Shao-Ce SUN [Sat, 11 Mar 2023 16:06:09 +0000 (00:06 +0800)]
Revert "[Flang] Allow compile *.f03, *.f08 file"

The test will fail in the MSVC environment.

This reverts commit 171794de533b400edb47f0e6df4375a7ae052fc8.

17 months ago[libc++] Optimize std::ranges::{min, max} for types that are cheap to copy
Nikolas Klauser [Wed, 8 Feb 2023 19:09:12 +0000 (20:09 +0100)]
[libc++] Optimize std::ranges::{min, max} for types that are cheap to copy

Don't forward to `min_element` for small types that are trivially copyable, and instead use a naive loop that keeps track of the smallest element (as opposed to an iterator to the smallest element). This allows the compiler to vectorize the loop in some cases.

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

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