platform/upstream/llvm.git
16 months ago[clang][pp] Handle attributes defined by plugin in __has_attribute
Anders Waldenborg [Sun, 12 Feb 2023 21:12:08 +0000 (22:12 +0100)]
[clang][pp] Handle attributes defined by plugin in __has_attribute

When using attributes by plugins (both in clang and clang-tidy) the
preprocessor functions `__has_attribute`, `__has_c_attribute`,
`__has_cpp_attribute` still returned 0.

That problem is fixed by having the "hasAttribute" function also check
if any of the plugins provide that attribute.

This also adds C2x spelling to the example plugin for attributes so that
`__has_c_attribute` can be tested.

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

16 months ago[clang] Extract function for generated part of clang::hasAttribute (NFC)
Anders Waldenborg [Thu, 2 Feb 2023 21:10:20 +0000 (22:10 +0100)]
[clang] Extract function for generated part of clang::hasAttribute (NFC)

This makes it easier to add additional handling when the
tablegen-generated code does not find a match.

No functional change intended.

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

16 months ago[clang] Extract ParsedAttrInfo::hasSpelling method (NFC)
Anders Waldenborg [Thu, 9 Mar 2023 21:55:38 +0000 (22:55 +0100)]
[clang] Extract ParsedAttrInfo::hasSpelling method (NFC)

This intends to simplify this checking when it is done in more places.

No functional change intended.

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

16 months ago[clang] Extract attribute plugin instantiation to function (NFC)
Anders Waldenborg [Sun, 12 Feb 2023 19:44:30 +0000 (20:44 +0100)]
[clang] Extract attribute plugin instantiation to function (NFC)

This moves the code to instantiate the attribute plugins to the same
place where the plugin registry is defined so they live together and the
user of the plugins doesn't have the burden of instantiating the
plugins.

No functional change intended.

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

16 months ago[clang] Move ParsedAttrInfo from Sema to Basic (NFC)
Anders Waldenborg [Sun, 12 Feb 2023 18:33:22 +0000 (19:33 +0100)]
[clang] Move ParsedAttrInfo from Sema to Basic (NFC)

This moves the ParsedAttrInfo class and the registry for attribute
plugin to be part of Basic module instead of Sema module.

This will allow it to be accessed from preprocessor later on.

No functional change intended.

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

16 months ago[RISCV] Use switch in RISCVTargetTransformInfo::getShuffleCost [nfc]
Philip Reames [Mon, 13 Mar 2023 15:32:16 +0000 (08:32 -0700)]
[RISCV] Use switch in RISCVTargetTransformInfo::getShuffleCost [nfc]

Refactoring in advance of a semantic change.

16 months ago[libc][NFC] Add string.h header to various platform headers.txt.
Siva Chandra Reddy [Mon, 13 Mar 2023 15:34:58 +0000 (15:34 +0000)]
[libc][NFC] Add string.h header to various platform headers.txt.

16 months agoReland [RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString
Alex Bradbury [Mon, 13 Mar 2023 15:14:43 +0000 (15:14 +0000)]
Reland [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.

The first version of this patch, a7313f83b9ca9, incorrectly used
`!isSupportedExtension(Ext)` rather than `!isSupportedExtension(Name)`.
i.e. checked the full substring rather than the split out name, causing
incorrect behaviour when a version is specified. This was fixed and a
new test case addded.

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

16 months ago[AArch64] Cost-model vector splat LD1Rs to avoid unprofitable SLP vectorisation
Sjoerd Meijer [Mon, 13 Mar 2023 13:05:34 +0000 (13:05 +0000)]
[AArch64] Cost-model vector splat LD1Rs to avoid unprofitable SLP vectorisation

This slightly increases the costs of InsertElement instructions that are part
of a vector splat sequence, i.e. a load, InsertElement and a shuffle (load +
dup). The resulting LD1R is a high latency instruction, and this slight
increase in costs avoids SLP vectorisation for a couple of cases where this
isn't profitable.

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

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

16 months ago[flang] Handle parent component in intrinsic function arguments
Valentin Clement [Mon, 13 Mar 2023 14:27:02 +0000 (15:27 +0100)]
[flang] Handle parent component in intrinsic function arguments

When the argument is a parent component the box needs to
be updated to reflect the correct type. Use `updateBoxForParentComponent`
to update the argument accordingly.

Reviewed By: PeteSteinfeld

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

16 months ago[flang] Only check for embox/rebox if defining op is present
Valentin Clement [Mon, 13 Mar 2023 14:25:30 +0000 (15:25 +0100)]
[flang] Only check for embox/rebox if defining op is present

When the base box is a block argument, the defining op is null.
Only try to recover embox/rebox if there is a defining op.

Reviewed By: PeteSteinfeld

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

16 months ago[libc++] Add missing include in exception_ptr.h
Hans Wennborg [Mon, 13 Mar 2023 10:24:29 +0000 (11:24 +0100)]
[libc++] Add missing include in exception_ptr.h

Windows builds were failing due to missing include for std::addressof
after D145095.

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

16 months ago[clang] Replace Member Expressions During Instantiation If Necessary
Liming Liu [Tue, 7 Mar 2023 13:08:57 +0000 (21:08 +0800)]
[clang] Replace Member Expressions During Instantiation If Necessary

This patch replaces member accesses to declaration references during template
instantiation if the context is the unevaluated context and the class does not
contain the declaration.

The replacement fixes the issue #58674. Unlike previous fixes such as D143840,
it checks the membership during instantiation rather than right after parsing,
so the check is more accurate and efficient.

This patch also includes cases that previous fixes had once failed on.

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

16 months agoFix include order in CXType.cpp
Collin Baker [Mon, 13 Mar 2023 14:11:05 +0000 (10:11 -0400)]
Fix include order in CXType.cpp

Handle template parameter-dependent bit field widths in libclang

In a class template, a bit field's width may depend on a template
parameter. In this case the width expression cannot be evaluated.

Previously clang_getFieldDeclBitWidth() would assert, or cause memory
unsafety and return an invalid result if assertions are disabled.

This adds a check for this case which returns an error code. An
additional function clang_isBitFieldDecl() is added to disambiguate
between error code meanings.

Fixes: https://github.com/llvm/llvm-project/issues/56644
Differential Revision: https://reviews.llvm.org/D130303

16 months agoRevert "[clangd] Move standard options adaptor to CommandMangler"
Dmitry Polukhin [Mon, 13 Mar 2023 14:00:56 +0000 (07:00 -0700)]
Revert "[clangd] Move standard options adaptor to CommandMangler"

This reverts commit 34de7da6246cdfa6ff6f3d3c514583cddc0a10ec.

16 months ago[DAG] Use ISD::isBitwiseLogicOp in AND/OR/XOR checks. NFCI.
Simon Pilgrim [Mon, 13 Mar 2023 13:38:55 +0000 (13:38 +0000)]
[DAG] Use ISD::isBitwiseLogicOp in AND/OR/XOR checks. NFCI.

There's additional cases we can cleanup (mainly in target code), but this tries to cleanup generic code and PPC which had an equivalent helper.

16 months ago[MachineCombiner] Preserve debug instruction number
Felipe de Azevedo Piovezan [Fri, 10 Mar 2023 03:22:50 +0000 (22:22 -0500)]
[MachineCombiner] Preserve debug instruction number

Each target's `TargetInstrInfo` is responsible for announcing which code
patterns it is able to transform during the MachineCombiner pass.
Currently, these patterns are applied without preserving the debug
instruction number required by the InstrRef implementation of
LiveDebugValues. As such, we've seen a number of examples where debug
information is dropped for variables in InstrRef mode that were
otherwise available in VarLoc mode. This has been observed both in X86
and AArch examples.

This commit is an initial attempt at preserving said numbers by changing
the general (target agnostic) implementation of TargetInstrInfo: the
reassociation pattern must keep the debug number of the "top level"
instruction, i.e., the instruction whose value represents the final
value of the arithmetic expression. Intermediate values must have their
debug number dropped, as they have no equivalent value in the
unoptimized code.

Future work is required to update each target's
`TargetInstrInfo::genAlternativeCodeSequence` method.

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

16 months agoAdd a message to mlir-opt when reading from stdin to avoid being waiting for nothing
Mehdi Amini [Mon, 13 Mar 2023 12:56:15 +0000 (13:56 +0100)]
Add a message to mlir-opt when reading from stdin to avoid being waiting for nothing

It happens from time to time that one may run mlir-opt expecting something to
happen, but the process is waiting on stdin. Print a message when reading from
stdin to warn developers.

Reviewed By: rriddle

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

16 months ago[SLP][NFC]Initial merge of gather/buildvector code in the createBuildVector function.
Alexey Bataev [Thu, 9 Mar 2023 21:36:43 +0000 (13:36 -0800)]
[SLP][NFC]Initial merge of gather/buildvector code in the createBuildVector function.

Required for future changes with combining shuffled nodes and
buildvector sequences to improve cost/emission of the gather nodes.

Part of D110978

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

16 months ago[clangd] Move standard options adaptor to CommandMangler
Dmitry Polukhin [Thu, 16 Feb 2023 13:06:53 +0000 (05:06 -0800)]
[clangd] Move standard options adaptor to CommandMangler

There is a discrepancy between how clangd processes CDB loaded from
JSON file on disk and pushed via LSP. Thus the same CDB pushed via
LSP protocol may not work as expected. Some difference between these two
paths is expected but we still need to insert driver mode and target from
binary name and expand response files.

Test Plan: check-clang-tools

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

16 months ago[SVE] Restrict cmp+and->pred_cmp isel to instances where the and is the sole user...
Paul Walker [Thu, 2 Mar 2023 13:23:53 +0000 (13:23 +0000)]
[SVE] Restrict cmp+and->pred_cmp isel to instances where the and is the sole user of the compare.

Without the single use restriction we may replace the and with a
more costly duplicated compare.

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

16 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

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

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

16 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

16 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.

16 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.

16 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.

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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.

16 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

16 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

16 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)

16 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

16 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

16 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.

16 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.

16 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.

16 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)

16 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.

16 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.

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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.

16 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.

16 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.

16 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.

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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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