platform/upstream/llvm.git
2 years agoAdd thin wrapper for perf_event_open API
Jakob Johnson [Tue, 15 Mar 2022 19:22:17 +0000 (12:22 -0700)]
Add thin wrapper for perf_event_open API
  - Add PerfEvent class to handle creating ring buffers and handle the resources associated with a perf_event
  - Refactor IntelPT collection code to use this new API
  - Add TSC to timestamp conversion logic with unittest

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

2 years ago[AMDGPU] Fix AV classes VTs. NFCI.
Stanislav Mekhanoshin [Mon, 21 Mar 2022 20:12:36 +0000 (13:12 -0700)]
[AMDGPU] Fix AV classes VTs. NFCI.

NFC at this point, but will be used at a later patch.

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

2 years ago[llvm-libtools-darwin] Don't use global LLVMContext
Arthur Eubanks [Mon, 21 Mar 2022 20:33:09 +0000 (13:33 -0700)]
[llvm-libtools-darwin] Don't use global LLVMContext

Fixes some initialization order fiasco issues
https://lab.llvm.org/buildbot#builders/5/builds/20996

2 years ago[CUDA] Add getTargetFeatures for the NVPTX toolchain
Joseph Huber [Mon, 21 Mar 2022 20:32:12 +0000 (16:32 -0400)]
[CUDA] Add getTargetFeatures for the NVPTX toolchain

The NVPTX toolchain uses target features to determine the PTX version to
use. However this isn't exposed externally like most other toolchain
specific target features are. Add this functionaliy in preparation for
using it in for OpenMP offloading.

Reviewed By: jdoerfert, tra

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

2 years ago[PowerPC][NFC] Add test case for byval argument passing
Stefan Pintilie [Mon, 21 Mar 2022 19:02:28 +0000 (14:02 -0500)]
[PowerPC][NFC] Add test case for byval argument passing

Add a test case for byval argument passing where the argument size is more than
8 bytes and is not a factor of 8 bytes.

2 years ago[AMDGPU] divergence patterns for the BUILD_VECTOR i16, undef expansion.
alex-t [Sat, 19 Mar 2022 15:12:00 +0000 (16:12 +0100)]
[AMDGPU] divergence patterns for the BUILD_VECTOR i16, undef expansion.

BUILD_VECTOR of i16 and undef gets expanded to the COPY_TO_REGCLASS.
         The latter is further lowererd to the copy instructions.
 We need to provide the correct register class for the uniform and divergent BUILD_VECTOR nodes
 to avoid VGPR to SGPR copies.

Reviewed By: rampitec

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

2 years ago[flang] Expose error recovery cases in external I/O
Peter Klausler [Tue, 15 Mar 2022 19:17:17 +0000 (12:17 -0700)]
[flang] Expose error recovery cases in external I/O

Some I/O error situations are current handled with fatal
runtime asserts, but should be exposed for user program
error recovery.

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

2 years ago[bootstrap] Allow passing options to sub-builds for all targets
Louis Dionne [Wed, 16 Mar 2022 16:35:35 +0000 (12:35 -0400)]
[bootstrap] Allow passing options to sub-builds for all targets

This patch makes it possible to pass a CMake option to one of the runtimes
for all targets being built. Basically, any option that starts with the
name of a runtime project being built will be forwarded as-is to the
sub-build. This is useful for customizing a sub-build for all targets.

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

2 years ago[MLIR][Presburger] Deduplicate and move getNegatedCoeffs and getComplementIneq into...
Arjun P [Fri, 18 Mar 2022 14:51:00 +0000 (14:51 +0000)]
[MLIR][Presburger] Deduplicate and move getNegatedCoeffs and getComplementIneq into Utils

2 years ago[SelectionDAG] Make getPreferredExtendForValue take a Instruction * instead of Value *.
Craig Topper [Mon, 21 Mar 2022 19:08:56 +0000 (12:08 -0700)]
[SelectionDAG] Make getPreferredExtendForValue take a Instruction * instead of Value *.

This is only called for instructions and the caller is already holding
an Instruction *. This makes the code more explicit and makes it
obvious the code doesn't make decisions about constants.

2 years ago[ASTMatchers] Output currently processing match and nodes on crash
Nathan James [Mon, 21 Mar 2022 19:13:35 +0000 (19:13 +0000)]
[ASTMatchers] Output currently processing match and nodes on crash

Create a PrettyStackTraceEvent that will dump the current `MatchCallback` id as well as the `BoundNodes` if the 'run' method of a `MatchCallback` results in a crash.
The purpose of this is sometimes clang-tidy checks can crash in the `check` method. And in a large codebase with alot of checks enabled and in a release build, it can be near impossible to figure out which check as well as the source code that caused the crash. Without that information a reproducer is very hard to create.
This is a more generalised version of D118520 which has a nicer integration and should be useful to clients other than clang-tidy.

Reviewed By: aaron.ballman

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

2 years agoAdding a release note
Kim Gräsman [Mon, 21 Mar 2022 19:09:02 +0000 (15:09 -0400)]
Adding a release note

This amends 403d7d8d7093d6637a006f8b3f75382294259d3f.

2 years agoRevert "[libTooling] Generalize string explanation as templated metadata"
Yitzhak Mandelbaum [Mon, 21 Mar 2022 19:03:20 +0000 (19:03 +0000)]
Revert "[libTooling] Generalize string explanation as templated metadata"

This reverts commit 18440547d3520b78c9ab929685309419fc1fbe95. Causing failures
in some build modes.

e.g. https://lab.llvm.org/buildbot/#/builders/217/builds/1886

2 years agoIgnore FullExpr when traversing cast sub-expressions
Aaron Ballman [Mon, 21 Mar 2022 19:05:53 +0000 (15:05 -0400)]
Ignore FullExpr when traversing cast sub-expressions

Full-expressions are Sema-generated implicit nodes that cover
constant-expressions and expressions-with-cleanup for temporaries.

Ignore those as part of implicit-ignore, and also remove too-aggressive
IgnoreImplicit (which includes nested ImplicitCastExprs, for example)
on unpacked sub-expressions.

Add some unittests to demonstrate that RecursiveASTVisitor sees through
ConstantExpr nodes correctly.

Adjust cxx2a-consteval test to cover diagnostics for nested consteval
expressions that were previously missed.

Fixes bug #53044.

2 years agoGeneralize and harmonize sub-expression traversal
Kim Gräsman [Mon, 21 Mar 2022 19:01:31 +0000 (15:01 -0400)]
Generalize and harmonize sub-expression traversal

CastExpr::getSubExprAsWritten and getConversionFunction used to have
disparate implementations to traverse the sub-expression chain and skip
so-called "implicit temporaries" (which are really implicit nodes added
by Sema to represent semantic details in the AST).

There's some friction in these algorithms that makes it hard to extend
and change them:

* skipImplicitTemporary is order-dependent; it can skip a
CXXBindTemporaryExpr nested inside a MaterializeTemporaryExpr, but not
vice versa
* skipImplicitTemporary only runs one pass, it does not traverse
multiple nested sequences of MTE/CBTE/MTE/CBTE, for example

Both of these weaknesses are void at this point, because this kind of
out-of-order multi-level nesting does not exist in the current AST.

Adding a new implicit expression to skip exacerbates the problem,
however, since a node X might show up in any and all locations between
the existing.

Thus;

* Harmonize the form of getSubExprAsWritten and getConversionFunction
so they both use a for loop
* Use the IgnoreExprNodes machinery to skip multiple nodes
* Rename skipImplicitTemporary to ignoreImplicitSemaNodes to generalize
* Update ignoreImplicitSemaNodes so it only skips one level per call,
to mirror existing Ignore functions and work better with
IgnoreExprNodes

This is a functional change, but one without visible effect.

2 years agoCompiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
Duncan P. N. Exon Smith [Mon, 21 Mar 2022 18:43:00 +0000 (11:43 -0700)]
Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE

`llvm_unreachable()` and `LLVM_ASSUME_ALIGNED` use
`defined(LLVM_BUILTIN_UNREACHABLE)` to check whether it has a
definition. Remove the fallback added in 26827337dff26ba3 (as a drive-by
when updating the GCC logic) and add a comment to prevent future
mistakes.

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

2 years ago[libTooling] Generalize string explanation as templated metadata
Eric Li [Mon, 21 Mar 2022 18:19:17 +0000 (18:19 +0000)]
[libTooling] Generalize string explanation as templated metadata

Change RewriteRule from holding an `Explanation` to being able to generate
arbitrary metadata. Where TransformerClangTidyCheck was interested in a string
description for the diagnostic, other tools may be interested in richer metadata
at a higher level of abstraction than at the edit level (which is currently
available as ASTEdit::Metadata).

Reviewed By: ymandel

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

2 years ago[libc++][AIX] AIX allows for changing permissions of symlinks
Zarko Todorovski [Mon, 21 Mar 2022 18:38:29 +0000 (14:38 -0400)]
[libc++][AIX] AIX allows for changing permissions of symlinks

The test fails on AIX due to it expecting an error as on Linux. However, as on
other non-Linux systems symlinks permissions are supported so expect an empty
error code.

Reviewed By: daltenty, #libc, ldionne

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

2 years ago[MLIR][Presburger] simplify removeConstraintsInvolvingRange
Arjun P [Fri, 18 Mar 2022 12:38:54 +0000 (12:38 +0000)]
[MLIR][Presburger] simplify removeConstraintsInvolvingRange

2 years ago[clang] Remove stdint.h include from a test
Nico Weber [Mon, 21 Mar 2022 18:28:59 +0000 (14:28 -0400)]
[clang] Remove stdint.h include from a test

Tests must not include headers from the host system.
It looks like the include wasn't needed for anything, so just remove it.

This makes check-clang work in a `git bash` launched from a cmd.exe
that isn't an MSVC shell (that is, %INCLUDE% isn't set).

2 years agoFix buildbot failures from 7917b3c6.
Daniel Thornburgh [Mon, 21 Mar 2022 17:57:36 +0000 (17:57 +0000)]
Fix buildbot failures from 7917b3c6.

2 years ago[clangd] Fix nullptr crash in AddUsing tweak on catch(...)
Sam McCall [Mon, 21 Mar 2022 17:53:59 +0000 (18:53 +0100)]
[clangd] Fix nullptr crash in AddUsing tweak on catch(...)

Fixes https://github.com/clangd/clangd/issues/1072

2 years ago[libc++] Trigger CI when cmake/ is modified
Louis Dionne [Mon, 21 Mar 2022 17:50:53 +0000 (13:50 -0400)]
[libc++] Trigger CI when cmake/ is modified

2 years ago[test] Add regression test from pr54465
Philip Reames [Sun, 20 Mar 2022 21:38:46 +0000 (14:38 -0700)]
[test] Add regression test from pr54465

The reported crash regression was (presumably) fixed in 79a1823, but without adding coverage.

2 years ago[gn build] Use lld-link's new /winsysroot: flag
Nico Weber [Mon, 21 Mar 2022 17:42:28 +0000 (13:42 -0400)]
[gn build] Use lld-link's new /winsysroot: flag

If `clang_base_path` is set, it must now point to a directory that contains
an lld-link built with D118070.

(If this is a problem for anyone, we can guard this behind a
lld_link_understands_winsysroot gn arg, but let's see if we can get away
without that for now.)

With this, it's possible to build everything in a normal cmd.exe Window,
an MSVC shell isn't needed \o/

(Assuming you set `clang_base_path`, and you set `sysroot` to a directory
that contains a win sysroot. If you have MSVC installed,
`python3 llvm\utils\sysroot.py make-fake --out-dir=my-sysroot` and
setting `sysroot = "//my-sysroot"` in args.gn works, for example.)

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

2 years ago[llvm-lipo] Don't use a global LLVMContext
Arthur Eubanks [Mon, 21 Mar 2022 17:37:13 +0000 (10:37 -0700)]
[llvm-lipo] Don't use a global LLVMContext

Fixes initialization order fiasco issue reported by
https://lab.llvm.org/buildbot/#builders/5/builds/20987

2 years ago[X86][AVX512] lower1BitShuffle - fold broadcast(setcc(x,y)) -> setcc(broadcast(x...
Simon Pilgrim [Mon, 21 Mar 2022 17:38:06 +0000 (17:38 +0000)]
[X86][AVX512] lower1BitShuffle - fold broadcast(setcc(x,y)) -> setcc(broadcast(x),broadcast(y)) (PR52500)

AVX512 has excellent broadcast ops for everything but vXi1 bool vectors - so if we're broadcasting a comparison result, see if we can broadcast the comparison operands instead.

2 years ago[DebugInfo][NFC] Add a comment on the ordering of DILineInfo frames.
Snehasish Kumar [Fri, 18 Mar 2022 20:34:15 +0000 (13:34 -0700)]
[DebugInfo][NFC] Add a comment on the ordering of DILineInfo frames.

Add a comment to getFrame() to mention that frames are stored in
bottom-up, i.e. leaf to root in order of increasing index.

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

2 years ago[memprof] Update the frame is inline logic and unittests.
Snehasish Kumar [Wed, 16 Mar 2022 17:31:55 +0000 (10:31 -0700)]
[memprof] Update the frame is inline logic and unittests.

Since DI frames are enumerated with the leaf function at index 0, this
patch fixes the logic when IsInlineFrame is set. Also update the
unittests to check that only the last frame is marked as non-inline from
a set of DI Frames for a PC address.

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

2 years ago[mlir][sparse] implement loop index value vectorization
Aart Bik [Fri, 18 Mar 2022 20:28:59 +0000 (13:28 -0700)]
[mlir][sparse] implement loop index value vectorization

with CHECK and integration test

Reviewed By: bixia

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

2 years ago[clang] [OpenMP] Diagnose use of 'target_clones' in OpenMP variant declarations.
Tom Honermann [Tue, 15 Mar 2022 21:43:58 +0000 (14:43 -0700)]
[clang] [OpenMP] Diagnose use of 'target_clones' in OpenMP variant declarations.

Previously, OpenMP variant declarations for a function declaration that included
the 'cpu_dispatch', 'cpu_specific', or 'target' attributes was diagnosed, but
one with the 'target_clones' attribute was not. Now fixed.

Reviewed By: erichkeane, jdoerfert

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

2 years ago[clang] [OpenMP] Extend OpenMP variant declaration tests.
Tom Honermann [Tue, 15 Mar 2022 21:36:26 +0000 (14:36 -0700)]
[clang] [OpenMP] Extend OpenMP variant declaration tests.

This change extends the existing diagnostic tests for OpenMP variant
declarations to cover diagnostics for declarations that include
multiversion function attributes. The new tests demonstrate a missing
check for the 'target_clones' attribute.

Reviewed By: erichkeane, jdoerfert

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

2 years ago[clang] Produce a "multiversion" annotation in textual AST output.
Tom Honermann [Wed, 2 Mar 2022 22:10:33 +0000 (14:10 -0800)]
[clang] Produce a "multiversion" annotation in textual AST output.

This change adds a "multiversion" annotation to textual AST output.
For example:
  FunctionDecl 0xb6628b0 <t.c:1:1, col:13> col:5 multiversion foo 'int (void)'

Reviewed By: aaron.ballman

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

2 years ago[clang] NFC: Rename 'MVType' variables to 'MVKind' for consistency with their type.
Tom Honermann [Tue, 1 Mar 2022 17:17:14 +0000 (09:17 -0800)]
[clang] NFC: Rename 'MVType' variables to 'MVKind' for consistency with their type.

Reviewed By: aaron.ballman

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

2 years ago[clang] Add missing diagnostics for invalid overloads of multiversion functions in C.
Tom Honermann [Wed, 9 Feb 2022 23:02:13 +0000 (15:02 -0800)]
[clang] Add missing diagnostics for invalid overloads of multiversion functions in C.

Previously, an attempt to declare an overload of a multiversion function
in C was not properly diagnosed. In some cases, diagnostics were simply
missing. In other cases the following assertion failure occured...
```
Assertion `(Previous.empty() || llvm::any_of(Previous, [](const NamedDecl *ND) { return ND->hasAttr(); })) && "Non-redecls shouldn't happen without overloadable present"' failed.
```
... or the following diagnostic was spuriously issued.
```
error: at most one overload for a given name may lack the 'overloadable' attribute
```

The diagnostics issued in some cases could be improved. When the function
type of a redeclaration does not match the prior declaration, it would be
preferable to diagnose the type mismatch before diagnosing mismatched
attributes. Diagnostics are also missing for some cases.

Reviewed By: erichkeane

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

2 years ago[clang] NFC: Remove forced type merging in multiversion function checks.
Tom Honermann [Wed, 23 Feb 2022 17:00:02 +0000 (09:00 -0800)]
[clang] NFC: Remove forced type merging in multiversion function checks.

Checking of multiversion function declarations performed by various functions
in clang/lib/Sema/SemaDecl.cpp previously forced the valus of a passed in
'MergeTypeWithPrevious' reference argument in several scenarios. This was
unnecessary and possibly incorrect in the one case that the value
was forced to 'true' (though seemingly unobservably so).

Reviewed By: erichkeane

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

2 years ago[clang] NFC: Redundant code removal in SemaDecl.cpp, CheckTargetCausesMultiVersioning().
Tom Honermann [Tue, 8 Mar 2022 21:48:26 +0000 (13:48 -0800)]
[clang] NFC: Redundant code removal in SemaDecl.cpp, CheckTargetCausesMultiVersioning().

This change removes redundant code in the definition of
CheckTargetCausesMultiVersioning() in SemaDecl.cpp. The removed code checked
for multiversion function support. The code immediately following the removed
code is a call to CheckMultiVersionAdditionalRules(); that function performs
the same check on entry. In both cases, the consequences of missing multiversion
function support results in the same diagnostic message being issued and the
applicable function declaration being marked as invalid.

Reviewed By: erichkeane, aaron.ballman

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

2 years ago[clang] NFC: Dead code removal in SemaDecl.cpp, CheckMultiVersionFunction().
Tom Honermann [Tue, 22 Feb 2022 15:57:49 +0000 (07:57 -0800)]
[clang] NFC: Dead code removal in SemaDecl.cpp, CheckMultiVersionFunction().

This change removes dead code in the definition of CheckMultiVersionFunction()
in clang/lib/Sema/SemaDecl.cpp. The removed code was made dead by commit
fc53eb69c26cdd7efa6b629c187d04326f0448ca: "Reapply 'Implement target_clones multiversioning'".
See the added code just above the code being deleted; it contains the same
return statement with the previous condition now distributed across an if
statement and a switch statement.

Reviewed By: erichkeane, aaron.ballman

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

2 years ago[clang] Add test cases for multiversion function overload scenarios in C.
Tom Honermann [Fri, 28 Jan 2022 23:08:33 +0000 (15:08 -0800)]
[clang] Add test cases for multiversion function overload scenarios in C.

This change adds test cases to validate diagnostics for overloaded sets
that contain declarations of multiversion functions. Many of the added test
cases exercise declarations that are intended to be valid. Others are
intended to be valid if and when restrictions on multiversion functions
being declared with the overloadable attribute are lifted.

Several of the new test cases currently trigger the following assertion
failure in SemaDecl.cpp; the relevant test is therefore marked as an
expected failure pending a fix.
```
Assertion `(Previous.empty() || llvm::any_of(Previous, [](const NamedDecl *ND) { return ND->hasAttr(); })) && "Non-redecls shouldn't happen without overloadable present"' failed.
```

Reviewed By: erichkeane

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

2 years ago[IROutliner][NFC] Fix typo in doc of findOrCreatePHIInBlock
Hirochika Matsumoto [Mon, 21 Mar 2022 16:21:53 +0000 (11:21 -0500)]
[IROutliner][NFC] Fix typo in doc of findOrCreatePHIInBlock

Typo Fix in Documentation

Author: hkmatsumoto

Reviewers: AndrewLitteken

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

2 years ago[clangd] Track time spent in filesystem ops during preamble builds
Adam Czachorowski [Mon, 14 Mar 2022 17:49:15 +0000 (18:49 +0100)]
[clangd] Track time spent in filesystem ops during preamble builds

In some deployments, for example when running on FUSE or using some
network-based VFS implementation, the filesystem operations might add up
to a significant fraction of preamble build time. This change allows us
to track time spent in FS operations to better understand the problem.

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

2 years ago[gn build] Port 7917b3c6957c
LLVM GN Syncbot [Mon, 21 Mar 2022 17:28:05 +0000 (17:28 +0000)]
[gn build] Port 7917b3c6957c

2 years ago[Debuginfod] Don't depend on Content-Length.
Daniel Thornburgh [Fri, 11 Mar 2022 01:51:13 +0000 (01:51 +0000)]
[Debuginfod] Don't depend on Content-Length.

The present implementation of debuginfod lookups requires the
Content-Length field to be populated in the HTTP server response.
Unfortunately, Content-Length is optional, and there are some real
scenarios where it's missing. (For example, a Google Cloud Storage
server doing on-the-fly gunzipping.)

This changes the debuginfod response handler to directly stream the
output to the cache file as it is received. In addition to allowing
lookups to proceed without a Content-Lenght, it seems somewhat more
straightforward to implement, and it allows the disk I/O to be
interleaved with the network I/O.

Reviewed By: noajshu

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

2 years ago[X86][AVX512] Add PR52500 vXi1 broadcast test case
Simon Pilgrim [Mon, 21 Mar 2022 16:46:48 +0000 (16:46 +0000)]
[X86][AVX512] Add PR52500 vXi1 broadcast test case

2 years agoAdd missing dependencies to mayHaveNonDefUseDependency
Philip Reames [Mon, 21 Mar 2022 17:15:36 +0000 (10:15 -0700)]
Add missing dependencies to mayHaveNonDefUseDependency

Two interesting ommissions:
* When reordering in either direction, reordering two calls which both
  contain inf-loops is illegal.  This one is possibly a change in behavior
  for certain callers (e.g. fixes a latent bug.)
* When moving down, control dependence must be respected by checking the
  inverse of isSafeToSpeculativeExecute.  Current callers all seem to
  handle this case - though admitted, I did not do an exhaustive audit.
  Most seem to be only interested in moving upwards within a block.  This
  is mostly a case of future proofing an API so that it implements what
  the comments says, not just what current callers need.

Noticed via inspection.  I don't have a test case.

2 years agoRename mayBeMemoryDependent in polly to fix build bot
Philip Reames [Mon, 21 Mar 2022 17:11:06 +0000 (10:11 -0700)]
Rename mayBeMemoryDependent in polly to fix build bot

This case was missed in ee7324b8.

2 years ago[flang] Lower procedure designator
Valentin Clement [Mon, 21 Mar 2022 17:04:18 +0000 (18:04 +0100)]
[flang] Lower procedure designator

This patch adds lowering for procedure designator.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[lldb] Fix llvm::Optional summary provider
Dave Lee [Fri, 18 Mar 2022 21:20:44 +0000 (14:20 -0700)]
[lldb] Fix llvm::Optional summary provider

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

2 years agoRename mayBeMemoryDependent to mayHaveNonDefUseDependency [nfc]
Philip Reames [Mon, 21 Mar 2022 17:01:24 +0000 (10:01 -0700)]
Rename mayBeMemoryDependent to mayHaveNonDefUseDependency [nfc]

2 years agoRemove the clang/INPUTS directory; NFC
Aaron Ballman [Mon, 21 Mar 2022 16:51:33 +0000 (12:51 -0400)]
Remove the clang/INPUTS directory; NFC

This directory seems to be unused. At least, when I remove it, I can
still build and all of the lit tests pass for me. I can't find any real
information on why this directory exists in the first place, and the
fact that it hasn't been touched in 10 years (or longer in most cases)
leads me to believe it's safe to remove entirely.

2 years ago[MachineCopyPropagation] More robust isForwardableRegClassCopy
Jay Foad [Thu, 17 Mar 2022 11:13:46 +0000 (11:13 +0000)]
[MachineCopyPropagation] More robust isForwardableRegClassCopy

Change the implementation of isForwardableRegClassCopy so that it
does not rely on getMinimalPhysRegClass. Instead, iterate over all
classes looking for any that satisfy a required property.

NFCI on current upstream targets, but this copes better with
downstream AMDGPU changes where some new smaller classes have been
introduced, which was breaking regclass equality tests in the old
code like:
    if (UseDstRC != CrossCopyRC && CopyDstRC == CrossCopyRC)

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

2 years ago[clang] Remove Address::deprecated from MveEmitter
Arthur Eubanks [Fri, 18 Mar 2022 23:02:43 +0000 (16:02 -0700)]
[clang] Remove Address::deprecated from MveEmitter

We have to keep track of pointer pointee types with opaque pointers.

Reviewed By: simon_tatham

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

2 years ago[clangd] Test against path insensitivity
Kadir Cetinkaya [Wed, 9 Mar 2022 13:55:38 +0000 (14:55 +0100)]
[clangd] Test against path insensitivity

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

2 years ago[X86][NFC] MnemonicTables: only access RI fields if they're initialized
Amir Ayupov [Mon, 21 Mar 2022 14:43:08 +0000 (07:43 -0700)]
[X86][NFC] MnemonicTables: only access RI fields if they're initialized

Fix an issue reported by UBSan.

Test Plan:
Configure with `-DLLVM_USE_SANITIZER="Address;Undefined"`
`ninja llc`

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

2 years ago[MLIR][Presburger] unittests: move more util functions into Utils.h (NFC)
Arjun P [Thu, 17 Mar 2022 22:22:11 +0000 (22:22 +0000)]
[MLIR][Presburger] unittests: move more util functions into Utils.h (NFC)

2 years ago[OpaquePointers][BitcodeReader] Enable -opaque-pointers if we see an opaque pointer...
Arthur Eubanks [Fri, 18 Mar 2022 23:49:12 +0000 (16:49 -0700)]
[OpaquePointers][BitcodeReader] Enable -opaque-pointers if we see an opaque pointer type

This allows us to more easily test opaque pointers e.g. in the case of
ThinLTO where we only have to pass -opaque-pointers to the frontend.

Reviewed By: #opaque-pointers, nikic

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

2 years ago[VP] Make VectorBuilder take IRBuilderBase instead of IRBuilder<>
Craig Topper [Mon, 21 Mar 2022 16:09:13 +0000 (09:09 -0700)]
[VP] Make VectorBuilder take IRBuilderBase instead of IRBuilder<>

IRBuilder<> assumes specific values for template parameters.
IRBuilderBase abstracts away the template.

Reviewed By: simoll

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

2 years ago[X86] Add PR34666 redundant broadcast test case
Simon Pilgrim [Mon, 21 Mar 2022 16:09:45 +0000 (16:09 +0000)]
[X86] Add PR34666 redundant broadcast test case

2 years ago[IROutliner] Fix phi nodes when self referential within block but doesn't contain...
Andrew Litteken [Mon, 21 Mar 2022 15:18:24 +0000 (10:18 -0500)]
[IROutliner] Fix phi nodes when self referential within block but doesn't contain branch

When outlining a phi node, if the the incoming branch is a block contained in the region and the branch from that block is not outlined, we create broken code. The fix is to recognize when that branch from the included incoming block is not contained, and ignore the region.

Reviewer: paquette

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

2 years ago[InferAddressSpaces][NFC] Small code improvements for the InferAddressSpaces pass
psamolysov-intel [Mon, 21 Mar 2022 15:56:26 +0000 (10:56 -0500)]
[InferAddressSpaces][NFC] Small code improvements for the InferAddressSpaces pass

There is a bunch of code improvements in the patch: marking as const everything what can be
const and fixing some typos in comments.

Also the patch removes the shadowing parameter TTI from the rewriteWithNewAddressSpaces
method, the TTI parameter is not required because the same field is in the class.

Reviewed By: arsenm

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

2 years ago[MLIR][Presburger] Support PWMAFunction::dump by calling into print
Arjun P [Fri, 18 Mar 2022 12:25:15 +0000 (12:25 +0000)]
[MLIR][Presburger] Support PWMAFunction::dump by calling into print

This was declared but not defined previously.

2 years ago[X86] Don't fold SUB(X,SBB(0,0,W)) -> SUB(ADC(0,0,W),Y)
Simon Pilgrim [Mon, 21 Mar 2022 15:50:51 +0000 (15:50 +0000)]
[X86] Don't fold SUB(X,SBB(0,0,W)) -> SUB(ADC(0,0,W),Y)

This will further fold to a AND(SETCC_CARRY(),1) pattern which tends to prevent further folds.

2 years ago[X86] Add ((z & m) >> s) - (x + y)) sub -> sbb test case
Simon Pilgrim [Mon, 21 Mar 2022 15:36:21 +0000 (15:36 +0000)]
[X86] Add ((z & m) >> s) - (x + y)) sub -> sbb test case

Another variant based off the PR35908 test cases

2 years ago[MLIR][Presburger] fix typo: maybeGetNonIntegeralVarRow -> maybeGetNonIntegralVarRow...
Arjun P [Fri, 18 Mar 2022 14:53:52 +0000 (14:53 +0000)]
[MLIR][Presburger] fix typo: maybeGetNonIntegeralVarRow -> maybeGetNonIntegralVarRow (NFC)

2 years ago[AArch64][SelectionDAG] Supports unpklo/hi instructions to reduce the number of loads
zhongyunde [Mon, 21 Mar 2022 15:14:15 +0000 (23:14 +0800)]
[AArch64][SelectionDAG] Supports unpklo/hi instructions to reduce the number of loads

Trying to reduce the number of masked loads in favour of more unpklo/hi
instructions. Both ISD::ZEXTLOAD and ISD::SEXTLOAD are supported to extensions
from legal types.

Both of normal and masked loads test cases added to guard compile crash.

Reviewed By: paulwalker-arm

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

2 years ago[MLIR][SCF] Fix nested if merging bug
William S. Moses [Mon, 21 Mar 2022 00:32:36 +0000 (20:32 -0400)]
[MLIR][SCF] Fix nested if merging bug

The current nested if merging has a bug. Specifically, consider the following code:

```
    %r = scf.if %arg3 -> (i32) {
      scf.if %arg1 {
        "test.op"() : () -> ()
      }
      scf.yield %arg0 : i32
    } else {
      scf.yield %arg2 : i32
    }
```

When the above gets merged, it will become:
```
    %r = scf.if %arg3 && %arg1-> (i32) {
      "test.op"() : () -> ()
      scf.yield %arg0 : i32
    } else {
      scf.yield %arg2 : i32
    }
```

However, this means that when only %arg3 is true, we will incorrectly return %arg2 instead
of %arg0. This change updates the behavior of the pass to only enable nested if merging where
the outer yield contains only values from the inner if, or values defined outside of the if.

In the case of the latter, they can turned into a select of only the outer if condition, thus
maintaining correctness.

Reviewed By: ftynse

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

2 years ago[MLIR][Presburger] fix the names of some tests (NFC)
Arjun P [Thu, 17 Mar 2022 22:24:47 +0000 (22:24 +0000)]
[MLIR][Presburger] fix the names of some tests (NFC)

2 years ago[MLIR][Presburger] IntegerPolyhedronTest: remove unused include (NFC)
Arjun P [Thu, 17 Mar 2022 22:24:16 +0000 (22:24 +0000)]
[MLIR][Presburger] IntegerPolyhedronTest: remove unused include (NFC)

2 years ago[MLIR][Presburger] IntegerRelation.h: Fix header guard
Arjun P [Mon, 21 Mar 2022 15:19:30 +0000 (15:19 +0000)]
[MLIR][Presburger] IntegerRelation.h: Fix header guard

2 years ago[MLIR][Presburger] add a non-const Matrix::getRow() returning a MutableArrayRef
Arjun P [Thu, 17 Mar 2022 22:20:42 +0000 (22:20 +0000)]
[MLIR][Presburger] add a non-const Matrix::getRow() returning a MutableArrayRef

Reviewed By: Groverkss

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

2 years ago[mlir][bazel] filegroups for Python CF, PDL, Tensor dialects
Alex Zinenko [Mon, 21 Mar 2022 14:28:11 +0000 (15:28 +0100)]
[mlir][bazel] filegroups for Python CF, PDL, Tensor dialects

These dialects have Python bindings and are tested, but were not
previously exposed through Bazel filegroups.

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

2 years agoAdd cmake/ to release tarballs via concatenation
Aaron Puchert [Mon, 21 Mar 2022 14:28:27 +0000 (15:28 +0100)]
Add cmake/ to release tarballs via concatenation

The solution using append was reported not to work, but additionally it
would use the contents of the checked-out source tree instead of the git
tag or commit. This uses `git archive`, so it will use the right commit,
and at least for me (with GNU tar) it seems to work as intended.

Should fix #53281.

Reviewed By: kwk

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

2 years ago[Flang] Add OpenMP Conversion patterns
Kiran Chandramohan [Mon, 21 Mar 2022 14:09:47 +0000 (14:09 +0000)]
[Flang] Add OpenMP Conversion patterns

This patch adds the OpenMP conversion patterns to the FIR to LLVM
dialect lowering pass in Codegen. Appropriate legalization
conditions are also added. This ensures that a mix of FIR and OpenMP
dialects can be lowered to LLVM and OpenMP  dialects. Also adds two
tests.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval, peixin

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

Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[CodeGen][OpenMP] Use correct type in EmitLoadOfPointer()
Nikita Popov [Mon, 21 Mar 2022 11:30:30 +0000 (12:30 +0100)]
[CodeGen][OpenMP] Use correct type in EmitLoadOfPointer()

The EmitLoadOfPointer() call already specified the right pointer
type, but it did not match the Address we're loading from, so we
need to insert a bitcast first.

2 years ago[X86] Fold SUB(X,SBB(Y,Z,W)) -> SUB(ADC(X,Z,W),Y)
Simon Pilgrim [Mon, 21 Mar 2022 14:20:46 +0000 (14:20 +0000)]
[X86] Fold SUB(X,SBB(Y,Z,W)) -> SUB(ADC(X,Z,W),Y)

Prefer the commutable ADC over SBB to improve load folding opportunities

2 years agoRevert "Matrix::getRow non-const"
Arjun P [Mon, 21 Mar 2022 14:16:44 +0000 (14:16 +0000)]
Revert "Matrix::getRow non-const"

This reverts commit 68575ddea52d3104a7a6e2998fa05be278b99b34.
This commit was pushed accidentally.

2 years agoMatrix::getRow non-const
Arjun P [Thu, 17 Mar 2022 22:20:42 +0000 (22:20 +0000)]
Matrix::getRow non-const

2 years agoReapply [Utils] Fix %S substitution
Nikita Popov [Mon, 21 Mar 2022 12:20:32 +0000 (13:20 +0100)]
Reapply [Utils] Fix %S substitution

%S refers to the directory of %s, not to the cwd. This is mostly
handled correctly, but update_cc_test_checks.py used the wrong
path for non-FileCheck RUN lines.

Reapplying this with a fix for an update_cc_test_checks test that
was based on cwd semantics.

2 years ago[libunwind] Add libunwind to the bootstrapping build CI
Louis Dionne [Fri, 18 Mar 2022 14:03:01 +0000 (10:03 -0400)]
[libunwind] Add libunwind to the bootstrapping build CI

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

2 years ago[libc++] Disable modules with the bootstrapping build
Louis Dionne [Mon, 21 Mar 2022 14:06:40 +0000 (10:06 -0400)]
[libc++] Disable modules with the bootstrapping build

It turns out that we had never been enabling it anyways, since the
LIBCXX_TEST_PARAMS parameter was not being passed from the bootstrapping
build to the libc++ and libc++abi builds. Furthermore, it looks like the
per-target include directories used by the bootstrapping build by default
are incompatible with our current modulemap, since __config_site doesn't
live in the directory that our modulemap claims.

This disables modules in our bootstrapping CI job to unblock D121822,
but we should work on fixing the underlying issue once we're able to
pass those configuration options to our bootstrapping build.

2 years ago[WebAssembly][NFC] Add test case for functype emission
Alex Bradbury [Mon, 21 Mar 2022 14:03:01 +0000 (14:03 +0000)]
[WebAssembly][NFC] Add test case for functype emission

This test aims to demonstrate the WebAssembly backend's behaviour around
emission of the .functype directive. It covers defined and declared
functions as well as libcalls.

It currently fails to emit functypes for all defined functions at the
head of the file, causing issues with the type checker
<https://github.com/llvm/llvm-project/issues/54022>. The patch in
<https://reviews.llvm.org/D122134> is a proposal to fix this issue.

2 years ago[X86] combineAddOrSubToADCOrSBB - commute + neg subtraction patterns
Simon Pilgrim [Mon, 21 Mar 2022 13:55:26 +0000 (13:55 +0000)]
[X86] combineAddOrSubToADCOrSBB - commute + neg subtraction patterns

Handle SUB(AND(SRL(Y,Z),1),X) -> NEG(SBB(X,0,BT(Y,Z))) folds

I'll address the X86 lost folded-load regressions in a follow-up patch

2 years ago[compiler-rt] Expand comment about Exynos 9810 workaround.
James Y Knight [Mon, 21 Mar 2022 13:27:26 +0000 (13:27 +0000)]
[compiler-rt] Expand comment about Exynos 9810 workaround.

2 years ago[X86] combineAddOrSubToADCOrSBB - bail for illegal types
Simon Pilgrim [Mon, 21 Mar 2022 13:31:11 +0000 (13:31 +0000)]
[X86] combineAddOrSubToADCOrSBB - bail for illegal types

Ensure we don't attempt to fold to illegal types to ADC/SBB nodes.

After D122084 its possible for ADD(X,AND(SRL(Y,Z),1) patterns to be matched before type legalization.

2 years agoRevert "[Utils] Fix %S substitution"
Nikita Popov [Mon, 21 Mar 2022 13:24:27 +0000 (14:24 +0100)]
Revert "[Utils] Fix %S substitution"

This reverts commit 8ee1ef2a087da1a101a6b2c0bea31788da289e0b.

This breaks an update_cc_test_checks test that is based on an
incorrect %S use, revert until I can fix it.

2 years ago[OpenMP] Regenerate test checks (NFC)
Nikita Popov [Mon, 21 Mar 2022 13:17:38 +0000 (14:17 +0100)]
[OpenMP] Regenerate test checks (NFC)

2 years ago[SLP]Make stricter check for instructions that do not require
Alexey Bataev [Mon, 21 Mar 2022 12:47:29 +0000 (05:47 -0700)]
[SLP]Make stricter check for instructions that do not require
scheduling.

Need to check that the instructions with external operands can be
reordered safely before actualy exclude them from the scheduling.

2 years ago[pseudo] fix typo'd test assertions
Sam McCall [Mon, 21 Mar 2022 13:04:20 +0000 (14:04 +0100)]
[pseudo] fix typo'd test assertions

2 years ago[SDAG] enable binop identity constant folds for shifts
Simon Pilgrim [Mon, 21 Mar 2022 13:02:30 +0000 (13:02 +0000)]
[SDAG] enable binop identity constant folds for shifts

Add shl/srl/sra to the list of ops that we canonicalize with a select to expose an identity merge

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

2 years ago[OpenCL] Guard write_only image3d_t with TypeExtension
Sven van Haastregt [Mon, 21 Mar 2022 12:45:58 +0000 (12:45 +0000)]
[OpenCL] Guard write_only image3d_t with TypeExtension

Ensure that the TypeExtension of an `ImageType` is also taken into
account when generating `OpenCLBuiltins.inc`.

This aligns the handling of the `write_only image3d_t` type for
`-fdeclare-opencl-builtins` with opencl-c.h with respect to the
`cl_khr_3d_image_writes` extension.

Since the `write_only image3d_t` type is not available when the
extension is disabled, this commit does not add a test to
`SemaOpenCL/fdeclare-opencl-builtins.cl`.

2 years ago[AMDGPU][MC][NFC] Refactored sendmsg(...) handling
Dmitry Preobrazhensky [Mon, 21 Mar 2022 12:23:44 +0000 (15:23 +0300)]
[AMDGPU][MC][NFC] Refactored sendmsg(...) handling

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

2 years ago [LV] Fix typo in comment
Sophia [Fri, 18 Mar 2022 02:14:50 +0000 (10:14 +0800)]
[LV] Fix typo in comment

    Reviewed by: fhahn (Florian Hahn)

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

2 years ago[mlir] Fix block merging with the result of a terminator
Markus Böck [Mon, 21 Mar 2022 12:26:00 +0000 (13:26 +0100)]
[mlir] Fix block merging with the result of a terminator

When the current implementation merges two blocks that have operands defined outside of their block respectively, it will merge these by adding a block argument in the resulting merged block and adding successor arguments to the predecessors.
There is a special case where this is incorrect however: If one of predecessors terminator produce the operand, inserting the block argument and updating the predecessor would lead to the terminator using its own result as successor argument.
IR Example:
```
  %0 = "test.producing_br"()[^bb1, ^bb2] {
        operand_segment_sizes = dense<0> : vector<2 x i32>
} : () -> i32

^bb1:
  "test.br"(%0)[^bb4] : (i32) -> ()
```
where `^bb1` is then merged with another block would lead to:
 ```
  %0 = "test.producing_br"(%0)[^bb1, ^bb2]
```

This patch fixes that issue during clustering by making sure that if the operand is from an outside block, that it is not produced by the terminator of a predecessor.

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

2 years ago[Utils] Fix %S substitution
Nikita Popov [Mon, 21 Mar 2022 12:20:32 +0000 (13:20 +0100)]
[Utils] Fix %S substitution

%S refers to the directory of %s, not to the cwd. This is mostly
handled correctly, but update_cc_test_checks.py used for the wrong
path for non-FileCheck RUN lines.

2 years ago[mlir] Add a function to print C-strings to RunnerUtils.cpp.
Alexander Belyaev [Mon, 21 Mar 2022 10:01:50 +0000 (11:01 +0100)]
[mlir] Add a function to print C-strings to RunnerUtils.cpp.

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

2 years ago[X86] Add nounwind to adc/sbb tests to prevent cfi noise
Simon Pilgrim [Mon, 21 Mar 2022 11:44:12 +0000 (11:44 +0000)]
[X86] Add nounwind to adc/sbb tests to prevent cfi noise

2 years ago[AMDGPU] Add an agpr copy propagation test
Jay Foad [Mon, 21 Mar 2022 11:41:22 +0000 (11:41 +0000)]
[AMDGPU] Add an agpr copy propagation test

2 years ago[AMDGPU] Update checks in agpr-copy-propagation.mir
Jay Foad [Mon, 21 Mar 2022 11:40:42 +0000 (11:40 +0000)]
[AMDGPU] Update checks in agpr-copy-propagation.mir

2 years ago[lld-macho][nfc] Add comment explaining why a cast<> is safe
Jez Ng [Wed, 16 Mar 2022 21:53:02 +0000 (17:53 -0400)]
[lld-macho][nfc] Add comment explaining why a cast<> is safe

2 years ago[lld-macho][nfc] Have findContainingSubsection take a Section
Jez Ng [Wed, 16 Mar 2022 22:05:32 +0000 (18:05 -0400)]
[lld-macho][nfc] Have findContainingSubsection take a Section

... instead of an instance of `Subsections`.

This simplifies the code slightly since all its callsites have a Section
instance anyway.