platform/upstream/llvm.git
18 months ago[mlir] GreedyPatternRewriteDriver: Add new strict mode option
Matthias Springer [Fri, 20 Jan 2023 09:01:27 +0000 (10:01 +0100)]
[mlir] GreedyPatternRewriteDriver: Add new strict mode option

There are now three options:
* `AnyOp` (previously `false`)
* `ExistingAndNewOps` (previously `true`)
* `ExistingOps`: this one is new.

The last option corresponds to what the `applyOpPatternsAndFold(Operation*, ...)` overload is doing. It is now also supported on the `applyOpPatternsAndFold(ArrayRef<Operation *>, ...)` overload.

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

18 months ago[clang][Interp] Initialize remaining InlineDescriptor fields
Timm Bäder [Fri, 20 Jan 2023 08:09:55 +0000 (09:09 +0100)]
[clang][Interp] Initialize remaining InlineDescriptor fields

for local variables. Hoping this will please msan.

18 months ago[Flang] Explicitly include cstdint (NFC)
Nikita Popov [Thu, 19 Jan 2023 13:28:58 +0000 (14:28 +0100)]
[Flang] Explicitly include cstdint (NFC)

This header uses std::int8_t, but does not include cstdint.

This fixes the build against libstc++ 13, where some indirect
header includes have been removed.

18 months ago[GVN] Refactor findDominatingLoad function
Sergey Kachkov [Fri, 13 Jan 2023 13:02:21 +0000 (16:02 +0300)]
[GVN] Refactor findDominatingLoad function

Improve findDominatingLoad implementation:
1. Result is saved into gvn::AvailableValue struct
2. Search is done in extended BB (while there is a single predecessor or
   limit is reached)

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

18 months ago[include-mapping] Parse zombie_names.html into a removed symbols map.
Viktoriia Bakalova [Mon, 16 Jan 2023 16:17:47 +0000 (16:17 +0000)]
[include-mapping] Parse zombie_names.html into a removed symbols map.

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

18 months agoAdd security group 2022 transparency report.
Kristof Beyls [Fri, 20 Jan 2023 08:49:16 +0000 (09:49 +0100)]
Add security group 2022 transparency report.

18 months agoRevert "[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on...
Craig Topper [Fri, 20 Jan 2023 08:41:14 +0000 (00:41 -0800)]
Revert "[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows."

This reverts commit 928a1764d6bdf84073c9d85875f45c1716d6ff12.

Committed accidentally

18 months ago[RISCV][TableGen] Use getAllDerivedDefinitions in RISCVTargetDefEmitter to simplify...
Craig Topper [Fri, 20 Jan 2023 08:20:13 +0000 (00:20 -0800)]
[RISCV][TableGen] Use getAllDerivedDefinitions in RISCVTargetDefEmitter to simplify the code. NFC

18 months ago[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows.
Craig Topper [Fri, 20 Jan 2023 05:34:23 +0000 (21:34 -0800)]
[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows.

This is an alternative to D141074 to fix the problem by adjusting
the precision control dynamically.

This isn't quite complete yet. I want to support fadd with an load
folded into it too. That's the code we will usually generate.

Posting for early review so we can do some testing of this solution.

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

18 months ago[mlir][Linalg] Add a structured.pack_transpose transform op
Nicolas Vasilache [Wed, 18 Jan 2023 20:26:13 +0000 (12:26 -0800)]
[mlir][Linalg] Add a structured.pack_transpose transform op

This transform is complementary to the `structured.pack` op which
allows packing a whole op but does not allow transposes on the individual
operands.

`structured.pack_transpose` allows transposing single operands connected to
pack or unpack ops after the fact.

This makes the system overall more composable than e.g. a giant transform
op with all permutation specified at once.

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

18 months ago[mlir][Linalg] Fix crash in LinalgToStandard
Nicolas Vasilache [Fri, 20 Jan 2023 08:06:34 +0000 (00:06 -0800)]
[mlir][Linalg] Fix crash in LinalgToStandard

Properly handle `appendMangledType` failure instead of asserting.

Fixes #59986.

18 months ago[mlir][Linalg] Add missing test
Nicolas Vasilache [Fri, 20 Jan 2023 08:06:34 +0000 (00:06 -0800)]
[mlir][Linalg] Add missing test

c3f0efe753e27105b519ae9283796d41fe574741 lacked a test, added here.

18 months ago[clangd] Fix shared lib builds
Kadir Cetinkaya [Fri, 20 Jan 2023 07:57:08 +0000 (08:57 +0100)]
[clangd] Fix shared lib builds

18 months agoNFC. Refactor affine fusion code for readability
Uday Bondhugula [Fri, 20 Jan 2023 06:53:32 +0000 (12:23 +0530)]
NFC. Refactor affine fusion code for readability

Replace a couple of check instances with llvm::any_of (clang-tidy
warnings).  Factor out "canCreatePrivateMemRef" and
"performFusionsIntoDest" into separate methods to reduce the
length/indent of the containing methods. Add doc comments and debug messages.

Mark some of the methods that should have been const const.

NFC.

Reviewed By: vinayaka-polymage

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

18 months ago[mlir][Linalg] Fix crash in LinalgToStandard
Nicolas Vasilache [Fri, 20 Jan 2023 07:29:16 +0000 (23:29 -0800)]
[mlir][Linalg] Fix crash in LinalgToStandard

Use rewriter.notifyMatchFailure instead of assert.

Fixes #59986.

18 months ago[gn build] Port 21f4232dd963
LLVM GN Syncbot [Fri, 20 Jan 2023 06:58:57 +0000 (06:58 +0000)]
[gn build] Port 21f4232dd963

18 months ago[libc++] Enable segmented iterator optimizations for join_view::iterator
Nikolas Klauser [Mon, 21 Nov 2022 11:41:15 +0000 (12:41 +0100)]
[libc++] Enable segmented iterator optimizations for join_view::iterator

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

18 months ago[ADT,Support] Include compiler.h
Kazu Hirata [Fri, 20 Jan 2023 06:49:31 +0000 (22:49 -0800)]
[ADT,Support] Include compiler.h

This restores builds with gcc-9, which does not have __has_builtin.

18 months ago[ORC][ORC-RT] Add support for callback-based lookup of JIT'd MachO unwind info.
Lang Hames [Fri, 20 Jan 2023 05:33:41 +0000 (21:33 -0800)]
[ORC][ORC-RT] Add support for callback-based lookup of JIT'd MachO unwind info.

In LLVM the MachOPlatform class is modified to identify unwind info sections
and the address ranges of the functions these sections cover. These address
ranges are then communicated to the ORC runtime by attaching them to the
register-object-platform-sections allocation action.

In the ORC runtime the unwind-info section addresses are recorded and used to
support lookup of unwind info via the new `findDynamicUnwindSections` function.
At bootstrap time the ORC runtime checks for the presence of new
unwind-info-lookup-registration functions in libunwind (see
https://reviews.llvm.org/D142176), and if available uses them to register the
`findDynamicUnwindSections` function with libunwind to enable callback-based
lookup. If the new unwind-info-lookup-registration functions are not available
then the ORC runtime falls back to using the existing libunwind registration
APIs.

The callback-based scheme is intended to address three shortcomings in the
current registration scheme for JIT'd unwind info on Darwin: (1) Lack of
compact-unwind support, (2) inability to describe the subarchitecture of JIT'd
frames, and (3) lack of efficient address-based lookup data structures in
libunwind.

For more details see the proposed libunwind changes in
https://reviews.llvm.org/D142176.

18 months ago[libc++] Mark LWG3349 as complete
Nikolas Klauser [Fri, 20 Jan 2023 06:06:40 +0000 (07:06 +0100)]
[libc++] Mark LWG3349 as complete

18 months agoRevert "[X86] Avoid converting u64 to f32 using x87 on Windows"
Craig Topper [Fri, 20 Jan 2023 05:36:07 +0000 (21:36 -0800)]
Revert "[X86] Avoid converting u64 to f32 using x87 on Windows"

This reverts commit a6e3027db7ebe6863e44bafcfeaacc16bdc88a3f.

Chrome and Halide are both reporting issues with importing builtins.

Maybe the better direction is to manually adjust FPCW for the inline
sequence on Windows.

18 months ago[llvm] Move bit counting functions to bit.h (NFC)
Kazu Hirata [Fri, 20 Jan 2023 05:15:39 +0000 (21:15 -0800)]
[llvm] Move bit counting functions to bit.h (NFC)

This patch provides C++20-style countl_zero, countr_zero, countl_one,
and countr_one in bit.h.  Existing functions like countLeadingZeros
become wrappers around the new functions.

Note that I cannot quite declare countLeadingZeros as:

  template <class T> using countLeadingZeros = countl_zero<T>;

because countl_zero returns int, whereas countLeadingZeros returns
unsigned.

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

18 months ago[gn build] Port b40a3d73dc9c
LLVM GN Syncbot [Fri, 20 Jan 2023 05:06:41 +0000 (05:06 +0000)]
[gn build] Port b40a3d73dc9c

18 months ago[libc++] Remove old CI configurations and update the supported compiler versions
Nikolas Klauser [Tue, 6 Sep 2022 17:01:17 +0000 (19:01 +0200)]
[libc++] Remove old CI configurations and update the supported compiler versions

`_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` doesn't do anything anymore in C++23 mode, so it's now just a duplicate of the C++23 configuration.
Also add new steps to the post-release checklist for updating the supported compilers.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, arphaman

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

18 months ago[libc++] Implement P2446R2 (views::as_rvalue)
Nikolas Klauser [Sun, 11 Dec 2022 10:32:54 +0000 (11:32 +0100)]
[libc++] Implement P2446R2 (views::as_rvalue)

Reviewed By: ldionne, var-const, #libc

Spies: libcxx-commits

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

18 months agoAdding missing colon
Advenam Tacet [Fri, 20 Jan 2023 04:52:18 +0000 (20:52 -0800)]
Adding missing colon

Simple typo fix.
The absence of this colon may be confusing and result in misinterpretation of the result.

In normal libfuzzer mode, that colon is present.

You can compare with:
https://github.com/llvm/llvm-project/blob/aa0e9046c16bf27a8affbd903e2e3cad924a5217/compiler-rt/lib/fuzzer/FuzzerLoop.cpp#L356

Reviewed By: #sanitizers, vitalybuka

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

18 months ago[Clang][OpenMP] Allow `f16` literal suffix when compiling OpenMP target offloading...
Shilei Tian [Fri, 20 Jan 2023 03:24:23 +0000 (22:24 -0500)]
[Clang][OpenMP] Allow `f16` literal suffix when compiling OpenMP target offloading for NVPTX

Fix #58087.

Reviewed By: jhuber6

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

18 months ago[HIP] Unbundler allows missing host entry
Yaxun (Sam) Liu [Thu, 19 Jan 2023 15:37:55 +0000 (10:37 -0500)]
[HIP] Unbundler allows missing host entry

Reviewed by: Artem Belevich

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

18 months ago[clang] Don't short-circuit constant evaluation for array or record types
Charles Magahern [Mon, 9 Jan 2023 22:28:29 +0000 (14:28 -0800)]
[clang] Don't short-circuit constant evaluation for array or record types

FastEvaluateAsRValue returns `true` without setting a result value for when a
given constant expression is an array or record type.

Clang attributes must be able to support constant expressions that are array or
record types, so proceed with the slower path for evaluation in the case where
`FastEvaluateAsRValue` does not yield an evaluation result.

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

18 months agollvm-reduce: Trim includes and avoid using namespace in a header
Matt Arsenault [Sat, 14 Jan 2023 13:50:55 +0000 (08:50 -0500)]
llvm-reduce: Trim includes and avoid using namespace in a header

18 months ago[AVR] Fix incorrectly printed global symbol operands in inline-asm
Ben Shi [Thu, 19 Jan 2023 10:06:27 +0000 (18:06 +0800)]
[AVR] Fix incorrectly printed global symbol operands in inline-asm

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

Reviewed By: aykevl

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

18 months ago[mlir][LLVM] Tidy up DebugTranslation casting
River Riddle [Fri, 20 Jan 2023 01:42:30 +0000 (17:42 -0800)]
[mlir][LLVM] Tidy up DebugTranslation casting

Add a specific class for local scope attributes and remove
some unnecessary casts.

18 months agollvm-reduce: Fix typo in help text
Matt Arsenault [Thu, 19 Jan 2023 21:21:05 +0000 (17:21 -0400)]
llvm-reduce: Fix typo in help text

18 months agollvm-reduce: Use WithColor in another error message
Matt Arsenault [Thu, 19 Jan 2023 20:13:37 +0000 (16:13 -0400)]
llvm-reduce: Use WithColor in another error message

18 months agollvm-reduce: Account for initializer complexity
Matt Arsenault [Tue, 17 Jan 2023 19:31:17 +0000 (14:31 -0500)]
llvm-reduce: Account for initializer complexity

18 months agollvm-reduce: Account for aliases and ifuncs in IR complexity score
Matt Arsenault [Tue, 17 Jan 2023 00:41:49 +0000 (19:41 -0500)]
llvm-reduce: Account for aliases and ifuncs in IR complexity score

18 months agollvm-reduce: Use consistent ReductionFunc types
Matt Arsenault [Mon, 16 Jan 2023 16:00:01 +0000 (11:00 -0500)]
llvm-reduce: Use consistent ReductionFunc types

Some of these were relying on ReducerWorkItem's operator Module&.

18 months ago[lldb] Re-enable xmm/ymm/zmm tests with the system debugserver
Jonas Devlieghere [Fri, 20 Jan 2023 01:07:12 +0000 (17:07 -0800)]
[lldb] Re-enable xmm/ymm/zmm tests with the system debugserver

Re-enable the xmm/ymm/zmm tests now that the system debugserver used by
our CI is capable or writing xmm/ymm/zmm registers.

18 months agoRevert "[gn] port a033dbbe5c43 (clang-stat-cache)"
Nico Weber [Fri, 20 Jan 2023 01:06:44 +0000 (20:06 -0500)]
Revert "[gn] port a033dbbe5c43 (clang-stat-cache)"

This reverts commit 8d498e08deaf6e06a578cfedb4eb259b722ac7f6.
a033dbbe5c43 was reverted in cf12709222a4.

18 months agoRevert "[clang][Darwin] Try to guess the SDK root with xcrun when unspecified"
Nico Weber [Fri, 20 Jan 2023 01:04:38 +0000 (20:04 -0500)]
Revert "[clang][Darwin] Try to guess the SDK root with xcrun when unspecified"

This reverts commit ecade80d93960ad01d8665db02c23841e055a80f.
Breaks tests on macOS and tries to run xcrun on non-mac platforms,
see comments on https://reviews.llvm.org/D136315

18 months agoRevert "[LoopUnroll] Directly update DT instead of DTU."
Arthur Eubanks [Fri, 20 Jan 2023 00:59:36 +0000 (16:59 -0800)]
Revert "[LoopUnroll] Directly update DT instead of DTU."

This reverts commit d0907ce7ed9f159562ca3f4cfd8d87e89e93febe.

Causes `opt -passes=loop-unroll-full` to crash on

```
define void @foo() {
bb:
  br label %bb1

bb1:                                              ; preds = %bb1, %bb1, %bb
  switch i1 true, label %bb1 [
    i1 true, label %bb2
    i1 false, label %bb1
  ]

bb2:                                              ; preds = %bb1
  ret void
}
```

18 months ago[Linalg] Don't create complex vectors when vectorizing copies
Benjamin Kramer [Thu, 19 Jan 2023 16:58:54 +0000 (17:58 +0100)]
[Linalg] Don't create complex vectors when vectorizing copies

vector<complex<...>> is currently not valid. This is a reduced version
of https://reviews.llvm.org/D141578

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

18 months ago[Lex] For dependency directive lexing, angled includes in `__has_include` should...
Argyrios Kyrtzidis [Thu, 19 Jan 2023 18:40:11 +0000 (10:40 -0800)]
[Lex] For dependency directive lexing, angled includes in `__has_include` should be lexed as string literals

rdar://104386604

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

18 months ago[mlir][vector] Disable folding for masked reductions
Diego Caballero [Thu, 19 Jan 2023 22:59:02 +0000 (22:59 +0000)]
[mlir][vector] Disable folding for masked reductions

Reductions can't be folded into plain arith ops until we can mask
those arith ops.

Reviewed By: nicolasvasilache

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

18 months agoCUDA/HIP: Use kernel name to map to symbol
Daniele Castagna [Sun, 25 Dec 2022 20:36:41 +0000 (12:36 -0800)]
CUDA/HIP: Use kernel name to map to symbol

Currently CGCUDANV uses an llvm::Function as a key to map kernels to a
symbol in host code.  HIP adds one level of indirection and uses the
llvm::Function to map to a global variable that will be initialized to
the kernel stub ptr.

Unfortunately there is no garantee that the llvm::Function created
by GetOrCreateLLVMFunction will be the same.  In fact, the first
time we encounter GetOrCrateLLVMFunction for a kernel, the type
might not be completed yet, and the type of llvm::Function will be
a generic {}, since the complete type is not required to get a symbol
to a function.  In this case we end up creating two global variables,
one for the llvm::Function with the incomplete type and one for the
function with the complete type. The first global variable will be
declared by not defined, resulting in a linking error.

This change uses the mangled name of the llvm::Function as key in the
KernelHandles map, in this way the same llvm::Function will be
associated to the same kernel handle even if they types are different.

Reviewed By: yaxunl

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

18 months ago[AMDGPU] Further reduce attaching of implicit operands to spills
Jeffrey Byrnes [Thu, 12 Jan 2023 01:06:48 +0000 (17:06 -0800)]
[AMDGPU] Further reduce attaching of implicit operands to spills

Extension of https://reviews.llvm.org/D141101 to even further reduce the amount of implicit operands we attach. The main benefit is to improve cability of post-ra scheduler, and reduce unneeded dependency resolution (e.g. inserting snops).

Unfortunately, we run into regressions if we completely minimize the amount implicit operands (naively), we run into some regressions (e.g. dual_movs are replaced with multiple calls to v_mov). This is even more reason to switch to LiveRegUnits.

Nonetheless, this patch removes the operands which we can for free (more or less).

Change-Id: Ib4f409202b36bdbc59eed615bc2d19fa8bd8c057

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

Change-Id: I8b039e3c0d39436b384083f8beb947ee1b1730b2

18 months ago[Bazel] Fix layering issues
Geoffrey Martin-Noble [Thu, 19 Jan 2023 21:57:33 +0000 (13:57 -0800)]
[Bazel] Fix layering issues

These are caught by clang-16, which we're using in our project.

Reviewed By: rupprecht

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

18 months ago[llvm] Cleanup edit_distance short circuiting
serge-sans-paille [Thu, 19 Jan 2023 22:00:53 +0000 (23:00 +0100)]
[llvm] Cleanup edit_distance short circuiting

Also prevent integer overflow if MaximumDistance == UINT_MAX.

This is a follow-up to 6ad1b4095172373590134afff19a7fbad9d7889d

18 months agoRevert "[AArch64][v8.3A] Avoid inserting implicit landing pads (PACI*SP)"
Evgenii Stepanov [Wed, 18 Jan 2023 00:17:03 +0000 (16:17 -0800)]
Revert "[AArch64][v8.3A] Avoid inserting implicit landing pads (PACI*SP)"

Linux kernel sets SCTRL_EL1.BT0 and BT1 to 1 unconditionally, which
makes PACIASP equivalent to BTI C + PACIA LR,SP.

Use the shorter instruction sequence by default.

I'm not aware of anyone who needs the opposite. They are welcome to
revert to the current behavior under a subtarget feature or an
environment check.

This reverts commit 571c8c5263a79293aaadae07b11feb36726eaf53.

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

18 months agoRevert "[Clang] Give Clang the ability to use a shared stat cache"
Fred Riss [Thu, 19 Jan 2023 21:51:25 +0000 (13:51 -0800)]
Revert "[Clang] Give Clang the ability to use a shared stat cache"

This reverts commit c5abe893120b115907376359a5809229a9f9608a.
This reverts commit a033dbbe5c43247b60869b008e67ed86ed230eaa.

This broke the build with -DLLVM_LINK_LLVM_DYLIB=ON. Reverting while I
investigate.

18 months ago[ODRHash] Detect mismatches in anonymous `RecordDecl`.
Volodymyr Sapsai [Tue, 6 Dec 2022 02:03:08 +0000 (18:03 -0800)]
[ODRHash] Detect mismatches in anonymous `RecordDecl`.

Allow completing a redeclaration check for anonymous structs/unions
inside `RecordDecl`, so we deserialize and compare anonymous entities
from different modules.

Completing the redeclaration chain for `RecordDecl` in
`ASTContext::getASTRecordLayout` mimics the behavior in
`CXXRecordDecl::dataPtr`. Instead of completing the redeclaration chain
every time we request a definition, do that right before we need a
complete definition in `ASTContext::getASTRecordLayout`.

Such code is required only for anonymous `RecordDecl` because we
deserialize named decls when we look them up by name. But it doesn't
work for anonymous decls as they don't have a name. That's why need to
force deserialization of anonymous decls in a different way.

rdar://81864186

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

18 months ago[ODRHash] Hash `RecordDecl` and diagnose discovered mismatches.
Volodymyr Sapsai [Fri, 2 Dec 2022 02:39:23 +0000 (18:39 -0800)]
[ODRHash] Hash `RecordDecl` and diagnose discovered mismatches.

When two modules contain struct/union with the same name, check the
definitions are equivalent and diagnose if they are not. This is similar
to `CXXRecordDecl` where we already discover and diagnose mismatches.

rdar://problem/56764293

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

18 months ago[SLP]Improve isGatherShuffledEntry by looking deeper through the reused scalars.
Alexey Bataev [Tue, 10 Jan 2023 21:49:05 +0000 (13:49 -0800)]
[SLP]Improve isGatherShuffledEntry by looking deeper through the reused scalars.

The compiler may produce better results if it does not look for
constants, uses an extra analysis of phi nodes, looks through all tree
nodes without skipping the cases, where the very first set of nodes is
empty. Also, it tries to reshufle the nodes if it is profitable for
sure, i.e. at least 2 scalars are used for single node permutation and at
least 3 scalars are used for the permutation of 2 nodes.

Part of D110978

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

18 months ago[OpenMP] Build device runtimes for sm_89 and sm_90
Ye Luo [Thu, 19 Jan 2023 21:39:05 +0000 (15:39 -0600)]
[OpenMP] Build device runtimes for sm_89 and sm_90

18 months agoReland "[lit] Stop supporting triple substrings in UNSUPPORTED and
Paul Robinson [Thu, 19 Jan 2023 21:08:03 +0000 (13:08 -0800)]
Reland "[lit] Stop supporting triple substrings in UNSUPPORTED and
XFAIL"

This reverts commit 2f8b920f95aa1e308193cf5803df7912025e8400.

Forgot to update lit's own tests.

18 months ago[Clang] Add lifetimebound attribute to std::move/std::forward
Alexander Shaposhnikov [Thu, 19 Jan 2023 20:57:24 +0000 (20:57 +0000)]
[Clang] Add lifetimebound attribute to std::move/std::forward

Clang now automatically adds [[clang::lifetimebound]] to the parameters of
std::move, std::forward et al, this enables Clang to diagnose more cases
where the returned reference outlives the object.
Associated GitHub issue: https://github.com/llvm/llvm-project/issues/60020

Test plan: ninja check-clang check-all

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

18 months ago[VPlan] Add vp_depth_first_deep (NFC)
Florian Hahn [Thu, 19 Jan 2023 20:34:22 +0000 (20:34 +0000)]
[VPlan] Add vp_depth_first_deep (NFC)

Similar to vp_depth_first_shallow (D140512) add vp_depth_first_deep to
make existing code clearer and more compact.

Reviewed By: Ayal

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

18 months ago[OpenMP][libomp] Insert correct HWLOC version guards
Gilles Gouaillardet [Thu, 19 Jan 2023 20:24:00 +0000 (14:24 -0600)]
[OpenMP][libomp] Insert correct HWLOC version guards

Put needed HWLOC version guards around relevant HWLOC API.
Tested OpenMP host runtime build with HWLOC 1.11.13, 2.0-2.9.

Differential Revision: https://reviews.llvm.org/D142152
Fix #54951

18 months ago[mlir] Update VectorToGPU to new memory space
Thomas Raoux [Thu, 19 Jan 2023 13:38:38 +0000 (13:38 +0000)]
[mlir] Update VectorToGPU to new memory space

GPU memory space have changed to new attributes. Update VectorToGPU pass
to use those.

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

18 months agoRevert "[MLIR] Update bazel build file after 455305624884cf9237143e2ba0635fcc5ba5206"
Frederik Gossen [Thu, 19 Jan 2023 20:05:05 +0000 (15:05 -0500)]
Revert "[MLIR] Update bazel build file after 455305624884cf9237143e2ba0635fcc5ba5206"

This reverts commit 399b8ee7edf1b108adf7cddead7bf1ab284cf190.

18 months ago[llvm][codegen] Fix non-determinism in StackFrameLayoutAnalysisPass output
Paul Kirth [Thu, 19 Jan 2023 16:14:43 +0000 (16:14 +0000)]
[llvm][codegen] Fix non-determinism in StackFrameLayoutAnalysisPass output

We were iterating over a SmallPtrSet when outputting slot variables.
This is still correct but made the test fail under reverse iteration.
This patch replaces the SmallPtrSet with a SmallVector.

Also remove the "Stack Frame Layout" lines from arm64-opt-remarks-lazy-bfi test,
since those also break under reverse iteration.

Reviewed By: nickdesaulniers

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

18 months agoRemove the undocumented `help` subcommand.
Jim Ingham [Thu, 19 Jan 2023 19:59:54 +0000 (11:59 -0800)]
Remove the undocumented `help` subcommand.

This is processed by hand in CommandObjectMultiword, and is undiscoverable,
it doesn't work in all cases.  Because it is a bare word, it can't really be
extended w/o introducing the possibility of collisions as well.  If we did
want to do something like this we should add a --help flag to CommandObject.  That
way the feature would be consistent and documented.

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

18 months ago[libc++][format] range-default-formatter for map
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] range-default-formatter for map

Implements the range-default-formatter specialization range_format::map.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140653

Reviewed By: ldionne, #libc

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

18 months agoRemove useless / untested verifier in scf.foreach_thread (NFC)
Mehdi Amini [Tue, 17 Jan 2023 11:36:54 +0000 (11:36 +0000)]
Remove useless / untested verifier in scf.foreach_thread (NFC)

18 months ago[opt] Fix static code analysis concerns
Arvind Sudarsanam [Thu, 19 Jan 2023 18:24:46 +0000 (10:24 -0800)]
[opt] Fix static code analysis concerns

This is an issue reported inside the NewPMDriver module. Static analyzer reported that Null pointer 'P' may be dereferenced at line 371 and two more sites. Proposed change guards this use.

Reviewed By: aeubanks

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

18 months agoRemoving 'TuningSlow3OpsLEA' from ICL config
Noah Goldstein [Thu, 19 Jan 2023 19:02:40 +0000 (11:02 -0800)]
Removing 'TuningSlow3OpsLEA' from ICL config

According to https://uops.info/ ICL and newer have fast 3-term LEA.

Reviewed By: pengfei

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

18 months agoAdd transform ctpop(X) -> 1 iff X is non-zero power of 2
Noah Goldstein [Thu, 19 Jan 2023 19:02:26 +0000 (11:02 -0800)]
Add transform ctpop(X) -> 1 iff X is non-zero power of 2

Definitionally a non-zero power of 2 will only have 1 bit set so this
is a freebee.

Reviewed By: spatel

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

18 months agoAdd tests for ctpop(X) where X is a power of 2; NFC
Noah Goldstein [Thu, 19 Jan 2023 19:01:25 +0000 (11:01 -0800)]
Add tests for ctpop(X) where X is a power of 2; NFC

Reviewed By: spatel

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

18 months ago[MLIR] Update bazel build file after 455305624884cf9237143e2ba0635fcc5ba5206
Frederik Gossen [Thu, 19 Jan 2023 19:25:55 +0000 (14:25 -0500)]
[MLIR] Update bazel build file after 455305624884cf9237143e2ba0635fcc5ba5206

18 months ago[gn build] Port c90801457f7c
LLVM GN Syncbot [Thu, 19 Jan 2023 19:13:26 +0000 (19:13 +0000)]
[gn build] Port c90801457f7c

18 months ago[libc++] Refactor deque::iterator algorithm optimizations
Nikolas Klauser [Sun, 20 Nov 2022 22:16:20 +0000 (23:16 +0100)]
[libc++] Refactor deque::iterator algorithm optimizations

This has multiple benefits:
- The optimizations are also performed for the `ranges::` versions of the algorithms
- Code duplication is reduced
- it is simpler to add this optimization for other segmented iterators,
  like `ranges::join_view::iterator`
- Algorithm code is removed from `<deque>`

Reviewed By: ldionne, huixie90, #libc

Spies: mstorsjo, sstefan1, EricWF, libcxx-commits, mgorny

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

18 months ago[AMDGPU] Treat WMMA the same as MFMA for sched_barrier
Stanislav Mekhanoshin [Wed, 18 Jan 2023 23:20:36 +0000 (15:20 -0800)]
[AMDGPU] Treat WMMA the same as MFMA for sched_barrier

MFMA and WMMA essentially the same thing, but apear on different ASICs.

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

18 months ago[AMDGPU] Introduce separate register limit bias in scheduler
Stanislav Mekhanoshin [Wed, 18 Jan 2023 19:58:50 +0000 (11:58 -0800)]
[AMDGPU] Introduce separate register limit bias in scheduler

Current implementation abuses ErrorMargin to apply an additional
bias to VGPR and SGPR limits under a high register pressure. The
ErrorMargin exists to account for inaccuracies of the RP tracker
and not to tackle an excess pressure. Introduce separate bias for
this purpose and also make it different for SGPRs and VGPRs as we
may want to use different values in the future.

This is supposed to be NFC, however there is a subtle difference
when subtracting a margin overflows the limit. Doing two subtractions
makes it less probable, although manifests only in mir tests with
an artificially small register budget.

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

18 months ago[Clang][NFC] Tweak error message for GPU architecture tools
Joseph Huber [Thu, 19 Jan 2023 18:48:28 +0000 (12:48 -0600)]
[Clang][NFC] Tweak error message for GPU architecture tools

Summary:
There shouldn't be an extra newline in these messages.

18 months ago[LinkerWrapper] Use `clang` to perform the device linking
Joseph Huber [Thu, 19 Jan 2023 17:20:07 +0000 (11:20 -0600)]
[LinkerWrapper] Use `clang` to perform the device linking

Right now in the linker wrapper we manually invoke a lot of the
toolchain programs. This reproduces a lot of logic that is already
handled in clang. Since D140158 we can now target all supported
toolchains directly via cross-compilation.

This patch changes the linker wrapper to consolidate all the alternate
linking and assembler steps into a generic call to `clang` and let clang
handle the argument handling. This heavily simplifies the interface.

Reviewed By: tra, JonChesterfield

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

18 months agoRevert "[mlir][Index] Implement InferIntRangeInterface"
Krzysztof Drewniak [Thu, 19 Jan 2023 18:41:00 +0000 (18:41 +0000)]
Revert "[mlir][Index] Implement InferIntRangeInterface"

This reverts commit 455305624884cf9237143e2ba0635fcc5ba5206a.

Linker error, unbreak build while I work out how to fix it.

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

18 months ago[IRLinker] Replace CallInstr with CallBase
Gulfem Savrun Yeniceri [Sat, 14 Jan 2023 00:48:32 +0000 (00:48 +0000)]
[IRLinker] Replace CallInstr with CallBase

This patch replaces CallInstr with CallBase to cover InvokeInstr
besides CallInstr while removing nocallback attribute on a call site.
It also extends drop-attribute.ll test to include a case for an invoke
instruction.

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

18 months agoRevert "Reland [pgo] Avoid introducing relocations by using private alias"
Arthur Eubanks [Thu, 19 Jan 2023 18:19:27 +0000 (10:19 -0800)]
Revert "Reland [pgo] Avoid introducing relocations by using private alias"

This reverts commit da5a8d14b8cc6cea16ee0929413c0672b47c93d9.

Causes more duplicate symbol errors, see https://bugs.chromium.org/p/chromium/issues/detail?id=1408161.

18 months ago[MLIR] Add InferTypeOpInterface to scf.if op
Frederik Gossen [Thu, 19 Jan 2023 18:18:22 +0000 (13:18 -0500)]
[MLIR] Add InferTypeOpInterface to scf.if op

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

18 months agoForbid implicit conversion of constraint expression to bool
Erich Keane [Tue, 17 Jan 2023 19:29:04 +0000 (11:29 -0800)]
Forbid implicit conversion of constraint expression to bool

As reported in https://github.com/llvm/llvm-project/issues/54524, and
later in https://github.com/llvm/llvm-project/issues/60038, we were not
properly implmenting temp.constr.atomic P3. This patch stops implicitly
converting constraints to bool, and ensures the Rvalue conversion takes
place as needed.

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

18 months ago[LoopUnroll] Directly update DT instead of DTU.
Florian Hahn [Thu, 19 Jan 2023 18:10:51 +0000 (18:10 +0000)]
[LoopUnroll] Directly update DT instead of DTU.

The scope of DT updates are very limited when unrolling loops: the DT
should only need updating for
* new blocks added
* exiting blocks we simplified branches

This can be done manually without too much extra work.
MergeBlockIntoPredecessor also needs to be updated to support direct
DT updates.

This fixes excessive time spent in DTU for same cases. In an internal
example, time spent in LoopUnroll with this patch goes from ~200s to 2s.

It also is slightly positive for CTMark:
* NewPM-O3: -0.13%
* NewPM-ReleaseThinLTO: -0.11%
* NewPM-ReleaseLTO-g: -0.13%

Notable improvements are mafft (~ -0.50%) and lencod (~ -0.30%), with no
workload regressed.

https://llvm-compile-time-tracker.com/compare.php?from=78a9ee7834331fb4360457cc565fa36f5452f7e0&to=687e08d011b0dc6d3edd223612761e44225c7537&stat=instructions:u

Reviewed By: kuhar

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

18 months ago[mlir][SCF] Fix crash in loop peeling
Matthias Springer [Thu, 19 Jan 2023 18:01:22 +0000 (19:01 +0100)]
[mlir][SCF] Fix crash in loop peeling

Upper bound and step size should be symbols instead of dims.

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

18 months ago[Sanitizers] GetMemoryProfile implementation for FreeBSD.
David Carlier [Thu, 19 Jan 2023 18:01:03 +0000 (18:01 +0000)]
[Sanitizers] GetMemoryProfile implementation for FreeBSD.

Reviewers: dvyukov

Reviewed-By: dvyukov
Differental Revision: https://reviews.llvm.org/D140688

18 months ago[mlir][Index] Implement InferIntRangeInterface
Krzysztof Drewniak [Mon, 9 Jan 2023 17:09:17 +0000 (17:09 +0000)]
[mlir][Index] Implement InferIntRangeInterface

Implement InferIntRangeInterface for all operations in the Index dialect. The
inference implementation, unlike the one for Arith, accounts for the
fact that Index can be either 64 or 32 bits long by evaluating both
cases. Bounds are stored as if index were i64, but when inferring new
bounds, we compute both f(...) and f(trunc(...)). We then compare
trunc(f(...)) to f(trunc(...)). If they are equal in the relevant
range components, we use the 64-bit range computation, otherwise we
give the range ext(f(trunc(...))) union f(...).

Note that this can cause surprising behavior as seen in the tests,
where, for example, the order of min and max operations impacts the
behavior of the inference. The inference could perhaps be made more
precise in the future (ex. by tracking 32 and 64-bit results
separately and having them influence each other somehow) butt, since
my project targets an index=i32 platform and doesn't see index-valued
values > uint32_max, I'm not too concerned about it.

Depends on https://reviews.llvm.org/D141299

Depends on https://reviews.llvm.org/D141296

Reviewed By: Mogball

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

18 months ago[clang][driver][AIX] Add OpenMP runtime if -fopenmp specified
Xing Xue [Thu, 19 Jan 2023 17:46:22 +0000 (12:46 -0500)]
[clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

Summary:
This patch adds OpenMP runtime to the linker command line if -fopenmp is specifed for AIX.

Reviewed by: daltenty

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

18 months agoFix zero-initialization fix-it for variable template
v1nh1shungry [Thu, 19 Jan 2023 17:35:09 +0000 (12:35 -0500)]
Fix zero-initialization fix-it for variable template

Current version there is a fix-it for

template <class> constexpr int x = 0;
template <> constexpr int x<int>; // fix-it here
but it will cause

template <> constexpr int x = 0<int>;

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

18 months agoRevert "[lit] Stop supporting triple substrings in UNSUPPORTED and XFAIL"
Paul Robinson [Thu, 19 Jan 2023 17:26:33 +0000 (09:26 -0800)]
Revert "[lit] Stop supporting triple substrings in UNSUPPORTED and XFAIL"

This reverts commit a0f8bdbb18a82ec150515d24f6eefb3519d4459a.

Several bots are failing in shtest-format.py, likely because of this.

18 months ago[NFC][flang] Added debug option to bisect TBAA tag attachments.
Slava Zakharin [Thu, 19 Jan 2023 16:46:52 +0000 (08:46 -0800)]
[NFC][flang] Added debug option to bisect TBAA tag attachments.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months agoSilence some sign comparison warnings; NFC
Aaron Ballman [Thu, 19 Jan 2023 17:25:14 +0000 (12:25 -0500)]
Silence some sign comparison warnings; NFC

The std::optional implementation in MSVC causes this code to produce a
sign comparison warning. This ensures the types are the same sign.

18 months ago[libc] add scanf float converter
Michael Jones [Wed, 21 Dec 2022 22:29:43 +0000 (14:29 -0800)]
[libc] add scanf float converter

This patch adds the %f/F/e/E/g/G/a/A conversions for scanf, as well as
accompanying tests. This implementation matches the definition set forth
in the standard, which may conflict with some other implementations.

Reviewed By: sivachandra

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

18 months ago[libc] add internal string class
Michael Jones [Fri, 6 Jan 2023 23:00:51 +0000 (15:00 -0800)]
[libc] add internal string class

The scanf implementation needs a dynamically resizing string class. This
patch adds a minimal version of that class along with tests to check the
current functionality.

Reviewed By: sivachandra

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

18 months ago[Flang][Debug] Modifications for getting pathname
Kiran Chandramohan [Thu, 19 Jan 2023 16:49:26 +0000 (16:49 +0000)]
[Flang][Debug] Modifications for getting pathname

-> Use file pathname from the Flang frontend. It is the frontend
that is in-charge of finding the files and is hence the canonical
source for paths.
-> Convert pathname to absolute pathname while creating the moduleOp.

Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Reviewed By: PeteSteinfeld, vzakhari, jeanPerier, awarzynski

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

18 months ago[libc++][format] Adds formatter std::vector<bool>.
Mark de Wever [Tue, 29 Nov 2022 06:57:30 +0000 (07:57 +0100)]
[libc++][format] Adds formatter std::vector<bool>.

Implements parts of
- P2286R8 Formatting Ranges

Depends on D140653

Reviewed By: ldionne, #libc

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

18 months ago[gn build] Port 04d4f4b3d4e4
LLVM GN Syncbot [Thu, 19 Jan 2023 16:51:17 +0000 (16:51 +0000)]
[gn build] Port 04d4f4b3d4e4

18 months ago[AARCH64][SVE] Do not optimize vector conversions
Zino Benaissa [Thu, 19 Jan 2023 16:44:23 +0000 (16:44 +0000)]
[AARCH64][SVE] Do not optimize vector conversions

shuffle_vector instructions are serialized targeting SVE fixed vectors, see
https://reviews.llvm.org/D139111. This patch disables
optimizeExtendOrTruncateConversion peepholes that generates shuffle_vector.

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

18 months ago[CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC.
Sjoerd Meijer [Wed, 11 Jan 2023 14:41:10 +0000 (14:41 +0000)]
[CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC.

18 months ago[libc++][format] Adds container adaptor formatters.
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] Adds container adaptor formatters.

Implements parts of
- P2286R8 Formatting Ranges

Depends on D140653

Reviewed By: ldionne, #libc

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

18 months ago[SystemZ] Improvement in tryRxSBG().
Jonas Paulsson [Wed, 18 Jan 2023 19:29:37 +0000 (13:29 -0600)]
[SystemZ] Improvement in tryRxSBG().

Only allow replacements of nodes that have a single user. This is better as
simple instructions (e.g. XGRK) are one cycle faster, and it helps in cases
where both inputs share a common node.

Review: Ulrich Weigand

18 months ago[NFC][bazel] Move _tensor_ops_ext.py to the correct filegroup
Jordan Rupprecht [Thu, 19 Jan 2023 16:43:24 +0000 (08:43 -0800)]
[NFC][bazel] Move _tensor_ops_ext.py to the correct filegroup

18 months ago[NFC][bazel] Add _tensor_ops_ext.py to SparseTensorOpsPyFiles
Jordan Rupprecht [Thu, 19 Jan 2023 16:39:18 +0000 (08:39 -0800)]
[NFC][bazel] Add _tensor_ops_ext.py to SparseTensorOpsPyFiles

This corresponds to the cmake change in 81ca5aa452400843235e058bc9c83fe71eccd593