platform/upstream/llvm.git
2 years agoclang-format HostInfoBase.cpp
Adrian Prantl [Fri, 1 Apr 2022 22:55:07 +0000 (15:55 -0700)]
clang-format HostInfoBase.cpp

2 years ago[test] Mark uuid.s as unsupported on Windows
Arthur Eubanks [Fri, 1 Apr 2022 22:32:22 +0000 (15:32 -0700)]
[test] Mark uuid.s as unsupported on Windows

For systems using gnuwin32, awk does not exist.

2 years ago[libc][NFC] add outline of printf
Michael Jones [Wed, 30 Mar 2022 22:54:30 +0000 (15:54 -0700)]
[libc][NFC] add outline of printf

This patch adds the headers for printf. It contains minimal actual code,
and is more intended to be used for design review. The code is not built
yet, and may have minor errors.

Reviewed By: sivachandra

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

2 years ago[gn build] Port f547fc89c073
LLVM GN Syncbot [Fri, 1 Apr 2022 21:24:52 +0000 (21:24 +0000)]
[gn build] Port f547fc89c073

2 years ago[clang-tidy] Add modernize-macro-to-enum check
Richard [Fri, 1 Apr 2022 19:53:00 +0000 (13:53 -0600)]
[clang-tidy] Add modernize-macro-to-enum check

[buildbot issues fixed]

This check performs basic analysis of macros and replaces them
with an anonymous unscoped enum.  Using an unscoped anonymous enum
ensures that everywhere the macro token was used previously, the
enumerator name may be safely used.

Potential macros for replacement must meet the following constraints:
- Macros must expand only to integral literal tokens.  The unary
  operators plus, minus and tilde are recognized to allow for positive,
  negative and bitwise negated integers.
- Macros must be defined on sequential source file lines, or with
  only comment lines in between macro definitions.
- Macros must all be defined in the same source file.
- Macros must not be defined within a conditional compilation block.
- Macros must not be defined adjacent to other preprocessor directives.
- Macros must not be used in preprocessor conditions

Each cluster of macros meeting the above constraints is presumed to
be a set of values suitable for replacement by an anonymous enum.
From there, a developer can give the anonymous enum a name and
continue refactoring to a scoped enum if desired.  Comments on the
same line as a macro definition or between subsequent macro definitions
are preserved in the output.  No formatting is assumed in the provided
replacements.

The check cppcoreguidelines-macro-to-enum is an alias for this check.

Fixes #27408

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

2 years agoSimplify ArchSpec::IsFullySpecifiedTriple() (NFC)
Adrian Prantl [Fri, 1 Apr 2022 21:15:58 +0000 (14:15 -0700)]
Simplify ArchSpec::IsFullySpecifiedTriple() (NFC)

I found this function somewhat hard to read and removed a few entirely
redundant checks and converted it to early exits.

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

2 years ago[flang] add evaluate::IsAllocatableDesignator helper
Jean Perier [Fri, 1 Apr 2022 20:31:23 +0000 (22:31 +0200)]
[flang] add evaluate::IsAllocatableDesignator helper

Previously, some semantic checks that are checking if an entity is an
allocatable were relying on the expression being a designator whose
last symbol has the allocatable attribute.

This is wrong since this was considering substrings and array sections of
allocatables as being allocatable. This is wrong (see NOTE 2 in
Fortran 2018 section 9.5.3.1).

Add evaluate::IsAllocatableDesignator to correctly test this.
Also add some semantic tests for ALLOCATED to test the newly added helper.
Note that ifort and nag are rejecting coindexed-named-object in
ALLOCATED (`allocated(coarray_scalar_alloc[2])`).
I think it is wrong given allocated argument is intent(in) as per
16.2.1 point 3.
So 15.5.2.6 point 4 regarding allocatable dummy is not violated (If the actual
argument is a coindexed object, the dummy argument shall have the INTENT (IN)
attribute.) and I think this is valid. gfortran accepts it.

The need for this helper was exposed in https://reviews.llvm.org/D122779.

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

Co-authored-by: Peixin-Qiao <qiaopeixin@huawei.com>
2 years ago[RISCV][AMDGPU][TargetLowering] Special case overflow expansion for (uaddo X, 1).
Craig Topper [Fri, 1 Apr 2022 20:14:10 +0000 (13:14 -0700)]
[RISCV][AMDGPU][TargetLowering] Special case overflow expansion for (uaddo X, 1).

If we expand (uaddo X, 1) we previously expanded the overflow calculation
as (X + 1) <u X. This potentially increases the live range of X and
can prevent X+1 from reusing the register that previously held X.

Since we're adding 1, overflow only occurs if X was UINT_MAX in which
case (X+1) would be 0. So this patch adds a special case to expand
the overflow calculation to (X+1) == 0.

This seems to help with uaddo intrinsics that get introduced by
CodeGenPrepare after LSR. Alternatively, we could block the uaddo
transform in CodeGenPrepare for this case.

Reviewed By: arsenm

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

2 years agoFix behavior of ifuncs with 'used' extern "C" static functions
Erich Keane [Mon, 28 Mar 2022 15:57:50 +0000 (08:57 -0700)]
Fix behavior of ifuncs with 'used' extern "C" static functions

We expect that `extern "C"` static functions to be usable in things like
inline assembly, as well as ifuncs:
See the bug report here: https://github.com/llvm/llvm-project/issues/54549

However, we were diagnosing this as 'not defined', because the
ifunc's attempt to look up its resolver would generate a declared IR
function.

Additionally, as background, the way we allow these static extern "C"
functions to work in inline assembly is by making an alias with the C
mangling in MOST situations to the version we emit with
internal-linkage/mangling.

The problem here was multi-fold: First- We generated the alias after the
ifunc was checked, so the function by that name didn't exist yet.
Second, the ifunc's generation caused a symbol to exist under the name
of the alias already (the declared function above), which suppressed the
alias generation.

This patch fixes all of this by moving the checking of ifuncs/CFE aliases
until AFTER we have generated the extern-C alias.  Then, it does a
'fixup' around the GlobalIFunc to make sure we correct the reference.

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

2 years ago[RISCV] Add tests for uaddo with a constant 1. NFC
Craig Topper [Fri, 1 Apr 2022 19:23:42 +0000 (12:23 -0700)]
[RISCV] Add tests for uaddo with a constant 1. NFC

The overflow calculation can be optimized to check if the add
result is 0.

2 years agoFIX the wildcards to pass an FP diff in mangle-nttp-anon-union.cpp
Erich Keane [Fri, 1 Apr 2022 19:22:44 +0000 (12:22 -0700)]
FIX the wildcards to pass an FP diff in mangle-nttp-anon-union.cpp

2 years agoAdd some wildcards to pass FP difference on one of the buildbots
Erich Keane [Fri, 1 Apr 2022 19:02:45 +0000 (12:02 -0700)]
Add some wildcards to pass FP difference on one of the buildbots

2 years ago[mlir][vector] Fold transpose(broadcast(<scalar>))
Lei Zhang [Fri, 1 Apr 2022 18:43:09 +0000 (14:43 -0400)]
[mlir][vector] Fold transpose(broadcast(<scalar>))

For such cases, the transpose op can be elided.

Reviewed By: mravishankar

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

2 years ago[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs
Erich Keane [Thu, 31 Mar 2022 14:27:11 +0000 (07:27 -0700)]
[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs

As reported in https://github.com/llvm/llvm-project/issues/54588
and discussed in https://github.com/itanium-cxx-abi/cxx-abi/issues/139

We are supposed to do a DFS, pre-order, decl-order search for a name for
the union in this case. Prevoiusly we crashed because the IdentiferInfo
pointer was nullptr, so this makes sure we have a name in the cases
described by the ABI.

I added an llvm-unreachable to cover an unexpected case at the end of
the new function with information/reference to the ABI in case we come
up with some way to get back to here.

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

2 years agoAddressed post-commit comment https://reviews.llvm.org/D122746#inline-1175831
zhijian [Fri, 1 Apr 2022 18:10:22 +0000 (14:10 -0400)]
Addressed post-commit comment https://reviews.llvm.org/D122746#inline-1175831

2 years ago[mlir][sparse] Moving `delete coo` into codegen instead of runtime library
wren romano [Wed, 30 Mar 2022 19:32:33 +0000 (12:32 -0700)]
[mlir][sparse] Moving `delete coo` into codegen instead of runtime library

Prior to this change there were a number of places where the allocation and deallocation of SparseTensorCOO objects were not cleanly paired, leading to inconsistencies regarding whether each function released its tensor/coo arguments or not, as well as making it easy to run afoul of memory leaks, use-after-free, or double-free errors.  This change cleans up the codegen vs runtime boundary to resolve those issues.  Now, the only time the runtime library frees an object is either (a) because it's a function explicitly designed to do so, or (b) because the allocated object is entirely local to the function and would be a memory leak if not released.  Thus, now the codegen takes complete responsibility for releasing any objects it caused to be allocated.

Reviewed By: aartbik

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

2 years ago[AArch64] add tests for funnel+or == 0; NFC
Sanjay Patel [Fri, 1 Apr 2022 16:22:10 +0000 (12:22 -0400)]
[AArch64] add tests for funnel+or == 0; NFC

These are copied from x86 ( 1074bdfb52b2e1753e51472 ) to
provide more coverage for a potential generic combine.

2 years ago[InstCombine] add tests for icmp with sub with multiple uses; NFC
Sanjay Patel [Fri, 1 Apr 2022 14:32:35 +0000 (10:32 -0400)]
[InstCombine] add tests for icmp with sub with multiple uses; NFC

Issue #54558

2 years ago[LLDB] Add require x86 for NativePdb Test.
Zequan Wu [Fri, 1 Apr 2022 17:38:57 +0000 (10:38 -0700)]
[LLDB] Add require x86 for NativePdb Test.

2 years ago[clang][dataflow] Add support for correlation of boolean (tracked) values
Yitzhak Mandelbaum [Mon, 28 Mar 2022 15:38:17 +0000 (15:38 +0000)]
[clang][dataflow] Add support for correlation of boolean (tracked) values

This patch extends the join logic for environments to explicitly handle
boolean values. It creates the disjunction of both source values, guarded by the
respective flow conditions from each input environment. This change allows the
framework to reason about boolean correlations across multiple branches (and
subsequent joins).

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

2 years ago[clang][dataflow] Add support for (built-in) (in)equality operators
Yitzhak Mandelbaum [Fri, 25 Mar 2022 20:01:18 +0000 (20:01 +0000)]
[clang][dataflow] Add support for (built-in) (in)equality operators

Adds logical interpretation of built-in equality operators, `==` and `!=`.s

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

2 years ago[LLDB][NativePDB] Create inline function decls
Zequan Wu [Fri, 18 Mar 2022 22:31:19 +0000 (15:31 -0700)]
[LLDB][NativePDB] Create inline function decls

This creates inline functions decls in the TUs where the funcitons are inlined and local variable decls inside those functions.

Reviewed By: labath

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

2 years ago[DAG] Add llvm::isMinSignedConstant helper. NFC
Simon Pilgrim [Fri, 1 Apr 2022 16:47:24 +0000 (17:47 +0100)]
[DAG] Add llvm::isMinSignedConstant helper. NFC

Pulled out of D122754

2 years agoRevert "[runtimes] Create Tests.cmake if it does not exist"
Petr Hosek [Fri, 1 Apr 2022 16:29:54 +0000 (09:29 -0700)]
Revert "[runtimes] Create Tests.cmake if it does not exist"

This reverts commit d6623d72461b5a1ed3bd3ac966d14329e5b0f851 since
it broke the build on Mac.

2 years ago[X86] matchAddressRecursively - add XOR(X, MIN_SIGNED_VALUE) handling
Simon Pilgrim [Fri, 1 Apr 2022 16:22:33 +0000 (17:22 +0100)]
[X86] matchAddressRecursively - add XOR(X, MIN_SIGNED_VALUE) handling

Allows us to fold XOR(X, MIN_SIGNED_VALUE) == ADD(X, MIN_SIGNED_VALUE) into LEA patterns

As mentioned on PR52267.

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

2 years ago[intelpt] Refactor timestamps out of `IntelPTInstruction`
Alisamar Husain [Mon, 28 Mar 2022 18:20:28 +0000 (23:50 +0530)]
[intelpt] Refactor timestamps out of `IntelPTInstruction`
Storing timestamps (TSCs) in a more efficient map at the decoded thread level to speed up TSC lookup, as well as reduce the amount of memory used by each decoded instruction. Also introduced TSC range which keeps the current timestamp valid for all subsequent instructions until the next timestamp is emitted.

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

2 years ago[mlir][vector] Handle scalars in extract_strided_slice(broadcast)
Lei Zhang [Fri, 1 Apr 2022 16:07:25 +0000 (12:07 -0400)]
[mlir][vector] Handle scalars in extract_strided_slice(broadcast)

For such cases we cannot generate extract_strided_slice ops.

Reviewed By: ThomasRaoux

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

2 years ago[mlir][spirv] Add pattern to lower math.copysign
Lei Zhang [Fri, 1 Apr 2022 16:02:43 +0000 (12:02 -0400)]
[mlir][spirv] Add pattern to lower math.copysign

This follows the logic:
https://git.musl-libc.org/cgit/musl/tree/src/math/copysignf.c

Reviewed By: ThomasRaoux

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

2 years ago[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) (RECOMMITTED)
Simon Pilgrim [Fri, 1 Apr 2022 15:58:45 +0000 (16:58 +0100)]
[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) (RECOMMITTED)

As noticed on PR39174, if we're extracting a single non-constant bit index, then try to use BT+SETCC instead to avoid messing around moving the shift amount to the ECX register, using slow x86 shift ops etc.

Recommitted with a fix to ensure we zext/trunc the SETCC result to the original type.

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

2 years agosanitizer_common: add Mutex::TryLock
Dmitry Vyukov [Fri, 1 Apr 2022 14:30:55 +0000 (16:30 +0200)]
sanitizer_common: add Mutex::TryLock

Will be used in future changes.

Reviewed By: melver

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

2 years agosanitizer_common: expose max_address from LoadedModule
Dmitry Vyukov [Fri, 1 Apr 2022 14:35:33 +0000 (16:35 +0200)]
sanitizer_common: expose max_address from LoadedModule

Currently LoadedModule provides max_executable_address.
Replace it with just max_address.
It's only used for printing for human inspection and since
modules are non-overlapping, max_address is as good as max_executable_address
for matching addresses/PCs against modules (I assume it's used for that).
On the hand, max_address is more general and can used to match e.g. data addresses.
I want to use it for that purpose in future changes.

Reviewed By: melver

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

2 years ago[AIX][XCOFF] print unsupported message for llvm-ar big archive write operation
zhijian [Fri, 1 Apr 2022 15:55:11 +0000 (11:55 -0400)]
[AIX][XCOFF] print unsupported message for llvm-ar big archive write operation
Summary:

when run "llvm-ar cr" on AIX OS , it created a gnu archive, it is not desirable in aix OS.
instead of creating a gnu archive, the patch will print a unsupport message for llvm-ar big archive write operation in AIX OS.

after implement the big archive operation, I will revert the XFAIL: AIX " and "--format=gnu" test cases in the patch.

Reviewer : James Henderson, Jinsong Ji
Differential Revision: https://reviews.llvm.org/D122746

2 years agoRecommit "[LV] Remove unneeded createHeaderBranch.(NFCI)"
Florian Hahn [Fri, 1 Apr 2022 15:53:39 +0000 (16:53 +0100)]
Recommit "[LV] Remove unneeded createHeaderBranch.(NFCI)"

This reverts commit 14e3650f01d158f7e4117c353927a07ceebdd504.

The issue causing the revert were fixed independently in
a08c90a4023f and 14e5f9785c9c.

2 years agoRevert rGa5f637bcbb7d1e08ce637f113fc117c3f4b2b110 "[X86] Fold AND(SRL(X,Y),1) ->...
Simon Pilgrim [Fri, 1 Apr 2022 15:48:24 +0000 (16:48 +0100)]
Revert rGa5f637bcbb7d1e08ce637f113fc117c3f4b2b110 "[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y))"

Investigating a sanitizer-windows buildbot breakage

2 years ago[X86] lowerShuffleAsRepeatedMaskAndLanePermute - allow 64-bit sublane shuffling on...
Simon Pilgrim [Fri, 1 Apr 2022 15:40:10 +0000 (16:40 +0100)]
[X86] lowerShuffleAsRepeatedMaskAndLanePermute - allow 64-bit sublane shuffling on AVX512BW v64i8 shuffles

We were only performing this on 256-bit vectors on AVX2 targets

Noticed while triaging Issue #54658

2 years ago[X86] Add PR54658 test case
Simon Pilgrim [Fri, 1 Apr 2022 15:21:54 +0000 (16:21 +0100)]
[X86] Add PR54658 test case

2 years ago[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y))
Simon Pilgrim [Fri, 1 Apr 2022 14:57:29 +0000 (15:57 +0100)]
[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y))

As noticed on PR39174, if we're extracting a single non-constant bit index, then try to use BT+SETCC instead to avoid messing around moving the shift amount to the ECX register, using slow x86 shift ops etc.

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

2 years ago[clang][dataflow] Fix handling of base-class fields.
Yitzhak Mandelbaum [Wed, 23 Mar 2022 00:01:55 +0000 (00:01 +0000)]
[clang][dataflow] Fix handling of base-class fields.

Currently, the framework does not track derived class access to base
fields. This patch adds that support and a corresponding test.

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

2 years ago[InstCombine] Add additional tests for strlen/strnlen (NFC)
Martin Sebor [Fri, 1 Apr 2022 14:58:38 +0000 (16:58 +0200)]
[InstCombine] Add additional tests for strlen/strnlen (NFC)

Taken from D122686.

2 years agoAdd prototypes to functions which need them; NFC
Aaron Ballman [Fri, 1 Apr 2022 14:31:59 +0000 (10:31 -0400)]
Add prototypes to functions which need them; NFC

2 years ago[MemCpyOpt] Add test for PR54682 (NFC)
Nikita Popov [Fri, 1 Apr 2022 14:31:08 +0000 (16:31 +0200)]
[MemCpyOpt] Add test for PR54682 (NFC)

2 years ago[LV] Add SCEV workaround from 80e8025 to epilogue vector code path.
Florian Hahn [Fri, 1 Apr 2022 14:14:47 +0000 (15:14 +0100)]
[LV] Add SCEV workaround from 80e8025 to epilogue vector code path.

This was exposed by 14e3650f. The recommit of 14e3650f will hit the
problematic code path requiring the workaround.
test case that crashes without the workaround.

2 years ago[OpenMP] Make linker wrapper thin-lto default thread count use all
Joseph Huber [Fri, 1 Apr 2022 13:42:21 +0000 (09:42 -0400)]
[OpenMP] Make linker wrapper thin-lto default thread count use all

Summary:
Currently there is no option to configure the number of thin-backend
threads to use when performing thin-lto on the device, but we should
default to use all the threads rather than just one. In the future we
should use the same arguments that gold / lld use and parse it here.

2 years ago[mlir][tensor][bufferize] Support 0-d collapse_shape with offset
Matthias Springer [Fri, 1 Apr 2022 13:07:00 +0000 (22:07 +0900)]
[mlir][tensor][bufferize] Support 0-d collapse_shape with offset

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

2 years ago[x86] add tests for funnel+or == 0; NFC
Sanjay Patel [Thu, 31 Mar 2022 19:10:47 +0000 (15:10 -0400)]
[x86] add tests for funnel+or == 0; NFC

This is another family of patterns based on issue #49541

2 years agofix bazel build after 369337e3c2
Mikhail Goncharov [Fri, 1 Apr 2022 13:27:12 +0000 (15:27 +0200)]
fix bazel build after 369337e3c2

2 years ago[clangd] Record IO precentage for first preamble build of the instance
Kadir Cetinkaya [Fri, 1 Apr 2022 11:53:16 +0000 (13:53 +0200)]
[clangd] Record IO precentage for first preamble build of the instance

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

2 years ago[demangler] Fix node matcher test
Nathan Sidwell [Fri, 1 Apr 2022 12:47:35 +0000 (05:47 -0700)]
[demangler] Fix node matcher test

Move node matcher compilation test to non-anonymous namespace and
avoid using attribute.

2 years ago[AMDGPU] Only count global-to-global as indirect accesses
Jay Foad [Thu, 31 Mar 2022 12:39:02 +0000 (13:39 +0100)]
[AMDGPU] Only count global-to-global as indirect accesses

Previously any load (global, local or constant) feeding into a
global load or store would be counted as an indirect access. This
patch only counts global loads feeding into a global load or store.
The rationale is that the latency for global loads is generally
much larger than the other kinds.

As a side effect this makes it easier to write small kernels test
cases that are not counted as having indirect accesses, despite
the fact that arguments to the kernel are accessed with an SMEM
load.

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

2 years ago[LV] Re-use TripCount from EPI.TripCount.
Florian Hahn [Fri, 1 Apr 2022 12:47:34 +0000 (13:47 +0100)]
[LV] Re-use TripCount from EPI.TripCount.

During skeleton construction for the epilogue vector loop, generic
helpers use getOrCreateTripCount, which will re-expand the trip count
computation. Instead, re-use the TripCount created during main loop
vectorization.

2 years ago[demangler] Fix node matchers
Nathan Sidwell [Tue, 29 Mar 2022 13:19:18 +0000 (06:19 -0700)]
[demangler] Fix node matchers

* Add instantiation tests to ItaniumDemangleTest, to make sure all
  match functions provide constructor arguments to the provided functor.

* Fix the Node constructors that lost const qualification on arguments.

Reviewed By: dblaikie

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

2 years ago[MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation
Groverkss [Fri, 1 Apr 2022 12:08:27 +0000 (17:38 +0530)]
[MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation

This patch modifies the name "integerRelations" and "relation" to refer to the
disjuncts in PresburgerRelation to "disjunct(s)".  This is done to be
consistent with the rest of the interface.

Reviewed By: arjunp

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

2 years ago[demangler][NFC] Use def file for node names
Nathan Sidwell [Wed, 30 Mar 2022 12:59:16 +0000 (05:59 -0700)]
[demangler][NFC] Use def file for node names

In order to add a unit test, we need to expose the node names beyond
ItaniumDemangle.h.  This breaks them out into a def file.

Reviewed By: dblaikie

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

2 years ago[analyzer][ctu] Only import const and trivial VarDecls
Gabor Marton [Fri, 1 Apr 2022 09:58:17 +0000 (11:58 +0200)]
[analyzer][ctu] Only import const and trivial VarDecls

Do import the definition of objects from a foreign translation unit if that's type is const and trivial.

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

2 years ago[AMDGPU][DOC][NFC] Added GFX1013 assembler syntax description
Dmitry Preobrazhensky [Fri, 1 Apr 2022 11:44:24 +0000 (14:44 +0300)]
[AMDGPU][DOC][NFC] Added GFX1013 assembler syntax description

2 years ago[MLIR][Presburger] subtract: fix bug when an input set has duplicate divisions
Arjun P [Fri, 1 Apr 2022 11:21:46 +0000 (12:21 +0100)]
[MLIR][Presburger] subtract: fix bug when an input set has duplicate divisions

Previously, when an input set had a duplicate division, the duplicates might
be removed by a call to mergeLocalIds due to being detected as being duplicate
for the first time. The subtraction implementation cannot handle existing
locals being removed, so this would lead to unexpected behaviour. Resolve this
by removing all the duplicates up front.

Reviewed By: Groverkss

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

2 years ago[CoroSplit] Use freeze instead of bitcast for dummy instructions
Nikita Popov [Fri, 1 Apr 2022 11:06:44 +0000 (13:06 +0200)]
[CoroSplit] Use freeze instead of bitcast for dummy instructions

Not all types that can appear in arguments can be bitcasts -- in
particular, bitcasts do not support struct types.

2 years agoRefine tls-load-hoista llvm option
Xiang1 Zhang [Fri, 1 Apr 2022 10:12:38 +0000 (18:12 +0800)]
Refine tls-load-hoista llvm option

Reviewed By: LuoYuanke

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

2 years ago[compiler-rt] [scudo] Use -mcrc32 on x86 when available
Michał Górny [Thu, 31 Mar 2022 07:55:25 +0000 (09:55 +0200)]
[compiler-rt] [scudo] Use -mcrc32 on x86 when available

Update the hardware CRC32 logic in scudo to support using `-mcrc32`
instead of `-msse4.2`.  The CRC32 intrinsics use the former flag
in the newer compiler versions, e.g. in clang since 12fa608af44a.
With these versions of clang, passing `-msse4.2` is insufficient
to enable the instructions and causes build failures when `-march` does
not enable CRC32 implicitly:

    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.cpp:20:10: error: always_inline function '_mm_crc32_u32' requires target feature 'crc32', but would be inlined into function 'computeHardwareCRC32' that is compiled without support for 'crc32'
      return CRC32_INTRINSIC(Crc, Data);
             ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.h:27:27: note: expanded from macro 'CRC32_INTRINSIC'
    #  define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
                              ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/../sanitizer_common/sanitizer_platform.h:132:36: note: expanded from macro 'FIRST_32_SECOND_64'
    #  define FIRST_32_SECOND_64(a, b) (a)
                                       ^
    1 error generated.

For backwards compatibility, use `-mcrc32` when available and fall back
to `-msse4.2`.  The `<smmintrin.h>` header remains in use as it still
works and is compatible with GCC, while clang's `<crc32intrin.h>`
is not.

Use __builtin_ia32*() rather than _mm_crc32*() when using `-mcrc32`
to preserve compatibility with GCC.  _mm_crc32*() are aliases
to __builtin_ia32*() in both compilers but GCC requires `-msse4.2`
for the former, while both use `-mcrc32` for the latter.

Originally reported in https://bugs.gentoo.org/835870.

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

2 years ago[MLIR][Presburger] Factor out some functionality from LexSimplex into a LexSimplexBase
Arjun P [Fri, 1 Apr 2022 10:53:25 +0000 (11:53 +0100)]
[MLIR][Presburger] Factor out some functionality from LexSimplex into a LexSimplexBase

LexSimplex cannot be made to support symbols for symbolic lexmin; this requires
a second class. In preparation for upstreaming support for symbolic lexmin,
keep the part of LexSimplex that are specific to non-symbolic lexmin in LexSimplex
and move the parts that are required to a common class LexSimplexBase for both to
inherit from.

Reviewed By: Groverkss

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

2 years ago[X86] Add getBT helper node for attempting to create a X86ISD::BT node
Simon Pilgrim [Fri, 1 Apr 2022 10:28:34 +0000 (11:28 +0100)]
[X86] Add getBT helper node for attempting to create a X86ISD::BT node

Avoids repeating all the extension/legalization wrappers in every use

2 years ago[CoroSplit] Handle argument being the frame pointer (PR54523)
Nikita Popov [Thu, 24 Mar 2022 09:31:47 +0000 (10:31 +0100)]
[CoroSplit] Handle argument being the frame pointer (PR54523)

If the frame pointer is an argument of the original pointer (which
happens with opaque pointers), then we currently first replace the
argument with undef, which will prevent later replacement of the
old frame pointer with the new one.

Fix this by replacing arguments with some dummy instructions first,
and then replacing those with undef later. This gives us a chance
to replace the frame pointer before it becomes undef.

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

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

2 years ago[Float2Int] Add test for PR54669 (NFC)
Nikita Popov [Fri, 1 Apr 2022 10:27:14 +0000 (12:27 +0200)]
[Float2Int] Add test for PR54669 (NFC)

2 years agoRevert rGff2d1bb2b749bd8a5697c25d2380b7c97a59ae06 "[X86] Add getBT helper node for...
Simon Pilgrim [Fri, 1 Apr 2022 10:20:51 +0000 (11:20 +0100)]
Revert rGff2d1bb2b749bd8a5697c25d2380b7c97a59ae06 "[X86] Add getBT helper node for attempting to create a X86ISD::BT node"

Typo means that this doesn't return a value in all cases.

2 years ago[InstCombine] Add additional memchr tests (NFC)
Martin Sebor [Fri, 1 Apr 2022 10:15:31 +0000 (12:15 +0200)]
[InstCombine] Add additional memchr tests (NFC)

2 years ago[X86] Add getBT helper node for attempting to create a X86ISD::BT node
Simon Pilgrim [Fri, 1 Apr 2022 10:12:12 +0000 (11:12 +0100)]
[X86] Add getBT helper node for attempting to create a X86ISD::BT node

Avoids repeating all the extension/legalization wrapper in every use

2 years ago[FuncSpec][NFC] Cache code metrics for analyzed functions.
Alexandros Lamprineas [Thu, 31 Mar 2022 14:27:09 +0000 (15:27 +0100)]
[FuncSpec][NFC] Cache code metrics for analyzed functions.

This isn't expected to reduce compilation times as 'max-iters' is set to
one by default, but it helps with recursive functions that require higher
iteration counts.

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

2 years ago[X86] lowerV8I16Shuffle - use explicit SmallVector<SDValue, 4> width to avoid MSVC...
Simon Pilgrim [Fri, 1 Apr 2022 09:54:14 +0000 (10:54 +0100)]
[X86] lowerV8I16Shuffle - use explicit SmallVector<SDValue, 4> width to avoid MSVC AVX alignment bug

As discussed on Issue #54645 - building llc with /AVX can result in incorrectly aligned structs

2 years ago[MLIR][Presburger] Use PresburgerSpace in constructors
Groverkss [Fri, 1 Apr 2022 09:32:27 +0000 (15:02 +0530)]
[MLIR][Presburger] Use PresburgerSpace in constructors

This patch modifies IntegerPolyhedron, IntegerRelation, PresburgerRelation,
PresburgerSet, PWMAFunction, constructors to take PresburgerSpace instead of
dimensions. This allows information present in PresburgerSpace to be carried
better and allows for a general interface.

Reviewed By: arjunp

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

2 years ago[LLDB] Fix TestJobControl.py decorators import
Muhammad Omair Javaid [Fri, 1 Apr 2022 09:13:11 +0000 (14:13 +0500)]
[LLDB] Fix TestJobControl.py decorators import

2 years ago[LLDB] Skip TestJobControl.py AArch64/Arm Linux
Muhammad Omair Javaid [Fri, 1 Apr 2022 08:58:16 +0000 (13:58 +0500)]
[LLDB] Skip TestJobControl.py AArch64/Arm Linux

TestJobControl.py is randomly failing on AArch64/Arm Linux buildbots.
I am marking it as skipped to make buildbot stable.

2 years ago[OMPIRBuilder] Remove unused variable in test (NFC)
Adrian Kuegel [Fri, 1 Apr 2022 08:33:08 +0000 (10:33 +0200)]
[OMPIRBuilder] Remove unused variable in test (NFC)

2 years ago[OMPIRBuilder] Support ordered clause specified without parameter
Peixin-Qiao [Fri, 1 Apr 2022 08:17:29 +0000 (16:17 +0800)]
[OMPIRBuilder] Support ordered clause specified without parameter

This patch supports ordered clause specified without parameter in
worksharing-loop directive in the OpenMPIRBuilder and lowering MLIR to
LLVM IR.

Reviewed By: Meinersbur

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

2 years ago[C++20][Modules] Limit ModuleInternalLinkage to modules-ts.
Iain Sandoe [Tue, 29 Jun 2021 07:06:26 +0000 (08:06 +0100)]
[C++20][Modules] Limit ModuleInternalLinkage to modules-ts.

At present, we are generating wrong code for C++20 modules entities which
should have internal linkage.  This is because we are assigning
'ModuleInternalLinkage' unconditionally to such entities.  However this mode
is only applicable to the modules-ts.

This change makes the special linkage mode conditional on fmodules-ts and
adds a unit test to verify that we generate the correct linkage.

Currently, static variables and functions in module purview are emitted into
object files as external. On some platforms, lambdas are emitted as global
weak defintions (on Windows this causes a mangler crash).

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

2 years agoRevert "[compiler-rt] [scudo] Use -mcrc32 on x86 when available"
Nikita Popov [Fri, 1 Apr 2022 07:34:13 +0000 (09:34 +0200)]
Revert "[compiler-rt] [scudo] Use -mcrc32 on x86 when available"

This reverts commit 09b53121c323f260ab97cecd067d4e7b3be1bf7c.

Breaks the build with GCC 11.2 on x86_64:

In file included from /home/npopov/repos/llvm-project/compiler-rt/lib/scudo/scudo_crc32.h:27,
                 from /home/npopov/repos/llvm-project/compiler-rt/lib/scudo/scudo_crc32.cpp:14:
/usr/lib/gcc/x86_64-redhat-linux/11/include/smmintrin.h: In function ‘__sanitizer::u32 __scudo::computeHardwareCRC32(__sanitizer::u32, __sanitizer::uptr)’:
/usr/lib/gcc/x86_64-redhat-linux/11/include/smmintrin.h:846:1: error: inlining failed in call to ‘always_inline’ ‘long long unsigned int _mm_crc32_u64(long long unsigned int, long long unsigned int)’: target specific option mismatch
  846 | _mm_crc32_u64 (unsigned long long __C, unsigned long long __V)

2 years ago[libcxx] [test] Avoid spurious test breakage in clang-cl-dll configs with newer CMake
Martin Storsjö [Wed, 30 Mar 2022 10:34:02 +0000 (13:34 +0300)]
[libcxx] [test] Avoid spurious test breakage in clang-cl-dll configs with newer CMake

The pointer.volatile.pass.cpp test was already marked as XFAIL for
mingw-dll (for reasons explained in the comment above it).

The same issue also appears in clang-cl-dll when built with newer
CMake versions. (It didn't appear with older versions of CMake, as
CMake built the library with the clang-cl flag `-std:c++latest` when
we've requested C++ 20 - which practically built it in c++2b mode with
current clang versions. With current versions of CMake, it passes
`-std:c++20` instead.)

As it succeeds/fails dependent on factors we don't
directly control, mark it as UNSUPPORTED instead of XFAIL.

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

2 years ago[libcxx] [ci] Enable -Werror for libcxxabi and libunwind too
Martin Storsjö [Thu, 31 Mar 2022 08:51:30 +0000 (11:51 +0300)]
[libcxx] [ci] Enable -Werror for libcxxabi and libunwind too

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

2 years agoUpdate callers to SendPacket with std::string's to not devolve to c-strs
Jason Molenda [Fri, 1 Apr 2022 06:44:17 +0000 (23:44 -0700)]
Update callers to SendPacket with std::string's to not devolve to c-strs

Many callers of SendPacket() in RNBRemote.cpp have a local std::string
object, call c_str() on it to pass a c-string, which is then copied into
a std::string temporary object.

Also free JSONGenerator objects once we've formatted them into
ostringstream and don't need the objects any longer, to reduce max
memory use in debugserver.

Differential Revision: https://reviews.llvm.org/D122848
rdar://91117263

2 years agoFix MLIR test pass
Mehdi Amini [Fri, 1 Apr 2022 06:36:34 +0000 (06:36 +0000)]
Fix MLIR test pass

Inadvertently removed `populateWithGenerated` while testing native
patterns.

2 years ago[C++20] [Modules] Don't generate strong function of a partition in importing modules
Chuanqi Xu [Fri, 1 Apr 2022 06:35:35 +0000 (14:35 +0800)]
[C++20] [Modules] Don't generate strong function of a partition in importing modules

This solves the multiple defintiion issue
https://github.com/llvm/llvm-project/issues/54269.

I think the cause of the bug might be an oversight. We just forget to
edit this when implementing partitions. And it should be a good fix.

Reviewed By: iains

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

2 years ago[CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG
Kees Cook [Fri, 1 Apr 2022 06:27:10 +0000 (23:27 -0700)]
[CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG

-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=CSKY -DLLVM_ENABLE_ASSERTIONS=OFF
builds will fail to link due to undefined `llvm::MCInst::dump() const`

```
ld.lld: error: undefined symbol: llvm::MCInst::dump() const
>>> referenced by CSKYAsmBackend.cpp
>>>               /home/kees/src/built-compilers/llvm/stage2-prof-gen/lto.cache/llvmcache-0656FC38C728A7FE0F767D10CD84C7F820114C46:(llvm::CSKYAsmBackend::relaxInstruction(llvm::MCInst&, llvm::MCSubtargetInfo const&) const)
```

Wrap it in LLVM_DEBUG().

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

Reviewed By: MaskRay

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

2 years agoAdd a test case for `applyPatternsAndFoldGreedily` to support the revert of 59bbc7a08
Mehdi Amini [Fri, 1 Apr 2022 05:52:25 +0000 (05:52 +0000)]
Add a test case for `applyPatternsAndFoldGreedily` to support the revert of 59bbc7a08

This shows that pushing constant to the right in a commutative op leads
to `applyPatternsAndFoldGreedily` to converge without applying all the
patterns.

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

2 years agoRevert "[GreedPatternRewriter] Preprocess constants while building worklist when...
Mehdi Amini [Fri, 1 Apr 2022 06:16:00 +0000 (06:16 +0000)]
Revert "[GreedPatternRewriter] Preprocess constants while building worklist when not processing top down"

This reverts commit 59bbc7a0851b6e0054bb3ed47df0958822f08880.

This exposes an issue breaking the contract of
`applyPatternsAndFoldGreedily` where we "converge" without applying
remaining patterns.

2 years ago[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions
Fangrui Song [Fri, 1 Apr 2022 06:04:50 +0000 (23:04 -0700)]
[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions

This approach is used by AArch64/RISCV to make frame-setup/frame-destroy
instructions contiguous instead of being interleaved by CFI instructions. Code
checking `MBBI->getFlag(MachineInstr::FrameSetup) || MBBI->isCFIInstruction()`
can be simplified to just check FrameSetup.

This helps locate all CFI instructions in the prologue, which can be handy to use
.cfi_remember_state/.cfi_restore_state to decrease unwind table size (D114545).

Reviewed By: RKSimon

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

2 years ago[PowerPC] Add cmpxchg test for pwr7 in atomic expand pass. NFC.
Kai Luo [Fri, 1 Apr 2022 05:16:11 +0000 (13:16 +0800)]
[PowerPC] Add cmpxchg test for pwr7 in atomic expand pass. NFC.

2 years agoDestroy ValueNames after all unique_ptr<Value>
Vitaly Buka [Fri, 1 Apr 2022 03:39:03 +0000 (20:39 -0700)]
Destroy ValueNames after all unique_ptr<Value>

This UB detected by -fsanitize-memory-use-after-dtor in tensorflow/MLIR.

2 years ago[llvm-cov] Add test cases for coverage_watermark
Tan Jinhua [Thu, 31 Mar 2022 06:43:47 +0000 (14:43 +0800)]
[llvm-cov] Add test cases for coverage_watermark

Add test cases for coverage_watermark in llvm-cov, also refer to
https://reviews.llvm.org/D116876

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

2 years agoFix Typo in SmallVector doc
Jake Vossen [Fri, 1 Apr 2022 03:38:14 +0000 (03:38 +0000)]
Fix Typo in SmallVector doc

Replace forward slash with backward slash.

Reviewed By: kiranchandramohan

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

2 years ago[RISCV] Supplement SDNode patterns for vfwmul/vfwadd/vfwsub
Lian Wang [Thu, 31 Mar 2022 01:51:06 +0000 (01:51 +0000)]
[RISCV] Supplement SDNode patterns for vfwmul/vfwadd/vfwsub

Reviewed By: jacquesguan

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

2 years agoAn expression should only contain an unexpanded parameter pack if it
Richard Smith [Fri, 1 Apr 2022 01:40:40 +0000 (18:40 -0700)]
An expression should only contain an unexpanded parameter pack if it
lexically contains a mention of the pack.

Systematically distinguish between syntactic and semantic references to
packs, especially when propagating dependence from a type into an
expression. We should consult the type-as-written when computing
syntactic dependence and should consult the semantic type when computing
semantic dependence.

Fixes #54402.

2 years ago[VP] Add more cast VPintrinsic and docs.
yanming [Wed, 23 Mar 2022 06:11:55 +0000 (14:11 +0800)]
[VP] Add more cast VPintrinsic and docs.

Add vp.fptoui, vp.uitofp, vp.fptrunc, vp.fpext, vp.trunc, vp.zext, vp.sext, vp.ptrtoint, vp.inttoptr intrinsic and docs.

Reviewed By: frasercrmck, craig.topper

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

2 years ago[llvm-profgen] Fixing a context attribure update issue due to a non-derministic proce...
Hongtao Yu [Thu, 31 Mar 2022 19:35:40 +0000 (12:35 -0700)]
[llvm-profgen] Fixing a context attribure update issue due to a non-derministic processing order on different platforms.

 A context can  be created by invoking the `getFunctionProfileForContext` function in two ways:
      - by using a probe and its calling context.
      - by removing the leaf frame from an existing contexts. The first way is used when generating a function profile for a given LBR range, and the input `WasLeafInlined` is computed depending on the actually probe in the LBR range. The second way is used when using the entry count of an inlinee function profile to update its inliner callsite count, so `WasLeafInlined` is unknown for the inliner frame.

The two  invocations can happen in different order on different platforms, since the lbr ranges are stored in an unordered_map, and  we are making sure `ContextWasInlined` is always set correctly.

This should fix the random test failure introduced by D121655

Reviewed By: wenlei

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

2 years agoFix MemorySSAUpdater::insertDef for dead code
Artur Pilipenko [Thu, 31 Mar 2022 23:30:14 +0000 (16:30 -0700)]
Fix MemorySSAUpdater::insertDef for dead code

Fix for https://github.com/llvm/llvm-project/issues/51257.

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

2 years agoRevert "[LLDB][NativePDB] Minor fix on inline line table."
Zequan Wu [Thu, 31 Mar 2022 23:07:49 +0000 (16:07 -0700)]
Revert "[LLDB][NativePDB] Minor fix on inline line table."

This reverts commit 4b2af365b6fadde9e578ca08e6de332388b2f9c2.

2 years agoAdd output filename to UUID hash
Leonard Grey [Thu, 31 Mar 2022 18:49:12 +0000 (14:49 -0400)]
Add output filename to UUID hash

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

2 years agoTarget: Use getPointerSizeInBits instead of 8 * getPointerSize
Matt Arsenault [Thu, 31 Mar 2022 21:57:39 +0000 (17:57 -0400)]
Target: Use getPointerSizeInBits instead of 8 * getPointerSize

2 years agoX86/GlobalISel: Use LLT form of getMachineMemOperand
Matt Arsenault [Thu, 31 Mar 2022 21:42:02 +0000 (17:42 -0400)]
X86/GlobalISel: Use LLT form of getMachineMemOperand

2 years agoX86/GlobalISel: Regenerate test checks
Matt Arsenault [Thu, 31 Mar 2022 21:43:32 +0000 (17:43 -0400)]
X86/GlobalISel: Regenerate test checks

2 years agoSelectionDAG: Avoid some uses of getPointerTy
Matt Arsenault [Thu, 31 Mar 2022 21:25:11 +0000 (17:25 -0400)]
SelectionDAG: Avoid some uses of getPointerTy

Avoids use of the default address space parameter, and avoids some
assumptions about the incoming address space.

2 years agoMSP430: Avoid using getPointerSize/getPointerTy
Matt Arsenault [Thu, 31 Mar 2022 21:10:35 +0000 (17:10 -0400)]
MSP430: Avoid using getPointerSize/getPointerTy

Use the contextually appropriate value instead of relying on the
default address space default parameters. Usually you should be
reusing a pre-existing type.