platform/upstream/llvm.git
17 months ago[clang-tidy] Support SystemHeaders in .clang-tidy
Carlos Galvez [Thu, 4 May 2023 19:47:41 +0000 (19:47 +0000)]
[clang-tidy] Support SystemHeaders in .clang-tidy

A previous patch update the clang-tidy documentation
incorrectly claiming that SystemHeaders can be provided
in the .clang-tidy configuration file.

This patch adds support for it, together with tests.

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

17 months ago[Tests] Preserve original test scenario
Dávid Bolvanský [Sun, 7 May 2023 14:55:16 +0000 (16:55 +0200)]
[Tests] Preserve original test scenario

17 months ago[flang][hlfir] Add TODO for polymorphic vector subscripted entities
Jean Perier [Sun, 7 May 2023 14:24:45 +0000 (16:24 +0200)]
[flang][hlfir] Add TODO for polymorphic vector subscripted entities

I removed the barriers a bit fast. Some mold is needed on
hlfir.elemental for polymorphic vector subscripted designator (and for
parenthesized polymorphic) so that a temporary can be later created.

The parenthesized array case may also just used asExpr and that
could later use AssignTemporary to deal with this. But the vector
subscripted designator case will need to use some new runtime
to get some mold allocation done for the temp.

Add TODOs in the meantime.

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

17 months ago[MC][X86] Fix encoding for VMOVPQIto64Zmr for correct disassembly
Simon Pilgrim [Sun, 7 May 2023 14:25:13 +0000 (15:25 +0100)]
[MC][X86] Fix encoding for VMOVPQIto64Zmr for correct disassembly

Fixes #62412

17 months ago[MC][X86] Add test coverage for Issue #62412
Simon Pilgrim [Sun, 7 May 2023 13:57:57 +0000 (14:57 +0100)]
[MC][X86] Add test coverage for Issue #62412

17 months ago[bazel] Make labels to third-party dependencies explicit
Aaron Siddhartha Mondal [Sun, 7 May 2023 13:34:15 +0000 (15:34 +0200)]
[bazel] Make labels to third-party dependencies explicit

Prefix occurrences of `//utils/bazel` with an explicit `@llvm-raw`.

This change lets us reuse code from `configure.bzl` in future compatibility patches for the bzlmod
module system.

The llvm-project overlay will be made available as an `@llvm-project-overlay` (name WIP) module in
the Bazel Central Registry. This means that we will have an `@llvm-project-overlay` workspace in
addition to the `@llvm-raw` and `@llvm-project` workspaces currently involved in the build. To keep
future patches to the existing build files as small as possible, the explicit naming proposed in this
change appears to be the simplest way to not confuse the module workspace resolution.

This is not a functional change to the current WORKSPACE build. It is a foundation for future patches.

GitHub Issue in the BCR: https://github.com/bazelbuild/bazel-central-registry/issues/206
GitHub Issue in LLVM: https://github.com/llvm/llvm-project/issues/55924

Reviewed By: csigg

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

17 months ago[SLC] Use unsigned char to fix test failures on some platforms
Dávid Bolvanský [Sun, 7 May 2023 13:50:36 +0000 (15:50 +0200)]
[SLC] Use unsigned char to fix test failures on some platforms

17 months ago[MC][X86] Split off avx512vpopcntdq tests and add att/intel coverage
Simon Pilgrim [Sun, 7 May 2023 13:42:37 +0000 (14:42 +0100)]
[MC][X86] Split off avx512vpopcntdq tests and add att/intel coverage

17 months ago[InstCombine] Improve bswap + logic_op optimization
Austin Chang [Sun, 7 May 2023 13:27:59 +0000 (14:27 +0100)]
[InstCombine] Improve bswap + logic_op optimization

The patch implements a helper function that matches and fold the following cases in the InstCombine pass:

    bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)
    bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))
    bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y) in multiuse case, which still reduces the number of instructions.

The helper function accepts bswap and bitreverse intrinsics. This patch folds the bswap cases and remain the bitreverse optimization for the future

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

17 months ago[InstCombine] Add bswap(logic_op(bswap(x), y)) regression test case; NFC
Austin Chang [Sun, 7 May 2023 13:24:56 +0000 (14:24 +0100)]
[InstCombine] Add bswap(logic_op(bswap(x), y)) regression test case; NFC

Fold the following case on IR InstCombine pass. This patch includes the new test cases for this optimization

bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)
bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))
bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y) with multi-use

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

17 months ago[SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs
Dávid Bolvanský [Sun, 7 May 2023 13:00:53 +0000 (15:00 +0200)]
[SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs

Motivation:

```
#include <string_view>

size_t findFirst_ABCDEF(std::string_view sv) {
  return sv.find_first_of("ABCDEF");
}
```

memchr("ABCDEF", C,  6) != NULL -> (C == 'A' || C == 'B' || C == 'C' || C == 'D' || C == 'E' || C == 'F') != 0

Reviewed By: nikic

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

17 months ago[ASAN] Support memory checks on vp.load/store.
Yeting Kuo [Sun, 7 May 2023 08:33:36 +0000 (16:33 +0800)]
[ASAN] Support memory checks on vp.load/store.

The patch adds new member MaybeEVL into InterestingMemoryOperand to represent
the effective vector length for vp intrinsics. It may be extended for some target intrinsics in the future.

Reviewed By: kito-cheng

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

17 months agoRevert "[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for...
Mark de Wever [Sun, 7 May 2023 10:39:18 +0000 (12:39 +0200)]
Revert "[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for a while"

This reverts commit 3e44aa659b98674a1220da235bc2cbafcb311a78.

The CI has been fixed so this band aid is no longer needed.

17 months ago[libc++] Modernizes the forwarded ios headers.
Mark de Wever [Sat, 6 May 2023 09:45:13 +0000 (11:45 +0200)]
[libc++] Modernizes the forwarded ios headers.

Reviewed By: #libc, philnik

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

17 months ago[RISCV] Make zve32f imply F and zve64d imply D.
Craig Topper [Sun, 7 May 2023 06:17:16 +0000 (23:17 -0700)]
[RISCV] Make zve32f imply F and zve64d imply D.

The 1.0 vector spec PDF has text that says that Zve32f is compatible
with F or Zfinx and that Zve64d is compatible with D and Zdinx.
The references to *inx were removed from the spec in the github repository in
October 2021. The 1.0 pdf was made in September 2021.

Relevant commit https://github.com/riscv/riscv-v-spec/commit/6fedb869e213da03f36092d661d14911a2f9d2c6

Reviewed By: jacquesguan

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

17 months ago[clang-format] Don't indent Verilog `begin` keyword on its own line
sstwcw [Sun, 7 May 2023 05:12:20 +0000 (05:12 +0000)]
[clang-format] Don't indent Verilog `begin` keyword on its own line

When the line is too long and the `begin` keyword wraps to the next
line, it shouldn't be indented.

Reviewed By: HazardyKnusperkeks

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

17 months ago[clang-format] Recognize Verilog edge identifiers
sstwcw [Sun, 7 May 2023 05:12:18 +0000 (05:12 +0000)]
[clang-format] Recognize Verilog edge identifiers

Previously the event expression would be misidentified as a port list.
A line break would be added after the comma.  The events can be
separated with either a comma or the `or` keyword, and a line break
would not be inserted if the `or` keyword was used.  We changed the
behavior of the comma to match the `or` keyword.

Before:
```
always @(posedge x,
         posedge y)
  x <= x;
always @(posedge x or posedge y)
  x <= x;
```

After:
```
always @(posedge x, posedge y)
  x <= x;
always @(posedge x or posedge y)
  x <= x;
```

Reviewed By: HazardyKnusperkeks

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

17 months ago[lldb] [NetBSD] getValue => operator* for Optional migration
Nikita Ronja Gillmann [Sat, 6 May 2023 10:36:55 +0000 (12:36 +0200)]
[lldb] [NetBSD] getValue => operator* for Optional migration

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

17 months ago[bazel] Fix missing deps for layering check
Aaron Siddhartha Mondal [Sun, 7 May 2023 03:55:24 +0000 (05:55 +0200)]
[bazel] Fix missing deps for layering check

Reviewed By: #bazel_build, stellaraccident

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

17 months ago[OpenMP] Make `libomptarget` link against `libomp`
Shilei Tian [Sun, 7 May 2023 03:26:43 +0000 (23:26 -0400)]
[OpenMP] Make `libomptarget` link against `libomp`

In `libomptarget` we use a couple of functions from `libomp`, but we didn't link
`libomptarget` against `libomp`. That will not work on some platforms such
as macOS. A linker error will be encountered because those symbols are not resolved
at link time when building `libomptarget`. This patch simply makes `libomptarget`
link agains `libomp`, makes it a "user" of `libomp`. I think this will not break
the policies between `libomp` and `libomptarget`.

Reviewed By: jdoerfert

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

17 months ago[NFC][OpenMP] Remove trailing whitespaces in `openmp/runtime/src/CMakeLists.txt`
Shilei Tian [Sun, 7 May 2023 03:19:14 +0000 (23:19 -0400)]
[NFC][OpenMP] Remove trailing whitespaces in `openmp/runtime/src/CMakeLists.txt`

17 months ago[gn] port 3b6bc87 more
Nico Weber [Sun, 7 May 2023 02:43:02 +0000 (22:43 -0400)]
[gn] port 3b6bc87 more

17 months ago[gn build] Port 6ab43f9b87ce
LLVM GN Syncbot [Sun, 7 May 2023 02:22:39 +0000 (02:22 +0000)]
[gn build] Port 6ab43f9b87ce

17 months ago[gn build] Port 5902bb9584d6
LLVM GN Syncbot [Sun, 7 May 2023 02:22:38 +0000 (02:22 +0000)]
[gn build] Port 5902bb9584d6

17 months ago[gn build] Port 3b6bc8752027
LLVM GN Syncbot [Sun, 7 May 2023 02:22:37 +0000 (02:22 +0000)]
[gn build] Port 3b6bc8752027

17 months ago[gn build] Port 040a41a85293
LLVM GN Syncbot [Sun, 7 May 2023 02:22:36 +0000 (02:22 +0000)]
[gn build] Port 040a41a85293

17 months ago[gn] port e7e3711885133
Nico Weber [Sun, 7 May 2023 02:22:25 +0000 (22:22 -0400)]
[gn] port e7e3711885133

17 months ago[gn] port 95bb95ebe448
Nico Weber [Sun, 7 May 2023 02:21:04 +0000 (22:21 -0400)]
[gn] port 95bb95ebe448

17 months ago[X86][AsmParser] Move include forward to reduce unnecessary declaration, NFCI
Shengchen Kan [Sun, 7 May 2023 01:43:20 +0000 (09:43 +0800)]
[X86][AsmParser] Move include forward to reduce unnecessary declaration, NFCI

17 months ago[InstCombine] Remove Descale
Kazu Hirata [Sun, 7 May 2023 01:20:19 +0000 (18:20 -0700)]
[InstCombine] Remove Descale

The last use of Descale was removed on Apr 6, 2023 in commit
db6b30b1831095c216378a9df215b7c0ae6b959f.

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

17 months ago[ARM] Remove unused declaration RematerializeIterCount
Kazu Hirata [Sun, 7 May 2023 00:31:40 +0000 (17:31 -0700)]
[ARM] Remove unused declaration RematerializeIterCount

The corresponding function definition was removed by:

  commit af45907653fd312264632b616eff0fad1ae1eb2e
  Author: Sjoerd Meijer <sjoerd.meijer@arm.com>
  Date:   Mon Jun 29 15:40:03 2020 +0100

17 months ago[ARM] Remove unused declaration LowerGLOBAL_OFFSET_TABLE
Kazu Hirata [Sun, 7 May 2023 00:31:39 +0000 (17:31 -0700)]
[ARM] Remove unused declaration LowerGLOBAL_OFFSET_TABLE

The unused declaration was introduced without a corresponding function
definition by:

  commit bd41cf880c9f3a65c9366565fa4db2ddb6b57e1c
  Author: Tim Northover <tnorthover@apple.com>
  Date:   Thu Jan 7 09:03:03 2016 +0000

17 months ago[ARM] Remove unused declaration EmitPatchedInstruction
Kazu Hirata [Sun, 7 May 2023 00:31:37 +0000 (17:31 -0700)]
[ARM] Remove unused declaration EmitPatchedInstruction

The corresponding function definition was removed by:

  commit db092d7aebb52699d800f20324f19970c2413a2d
  Author: Craig Topper <craig.topper@gmail.com>
  Date:   Tue Oct 9 04:23:49 2012 +0000

17 months ago[X86] or-with-overflow.ll - adjust or_i64_ri constant to not constant fold the icmp
Simon Pilgrim [Sat, 6 May 2023 21:42:14 +0000 (22:42 +0100)]
[X86] or-with-overflow.ll - adjust or_i64_ri constant to not constant fold the icmp

Better KnownBits handling of the icmp and/or an upcoming USUBSAT fold would constant fold this test away and prevent us testing for a cleared overflow flag.

17 months ago[DAG] computeOverflowForUnsignedAdd - use ConstantRange::unsignedAddMayOverflow as...
Simon Pilgrim [Sat, 6 May 2023 21:03:25 +0000 (22:03 +0100)]
[DAG] computeOverflowForUnsignedAdd - use ConstantRange::unsignedAddMayOverflow as fallback

Replaces the more specific uadd_ov case

17 months ago[lldb] Fix language label in ObjC Language unittest
Caroline Tice [Sat, 6 May 2023 07:04:57 +0000 (00:04 -0700)]
[lldb] Fix language label in ObjC Language unittest

The recently added ObjC Language unittest, InvalidMethondNameParsing, currently has CPlusPlusLanguage as its language label (see https://reviews.llvm.org/D149804). There is already a test with the same name and same language label in the C++ Language unittests, so this creates a name conflict. This patch corrects the language label on the ObjC test.

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

17 months ago[mlir][doc] Fix typos in mlir/docs/LangRef.md
Yan Xin [Sat, 6 May 2023 18:52:28 +0000 (11:52 -0700)]
[mlir][doc] Fix typos in mlir/docs/LangRef.md

It fixes some typos in the language reference.

Reviewed By: mehdi_amini

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

17 months ago[DAG] computeOverflowForUnsignedAdd - use getMaxValue().ult(2) to detect 0/1 values...
Simon Pilgrim [Sat, 6 May 2023 18:45:16 +0000 (19:45 +0100)]
[DAG] computeOverflowForUnsignedAdd - use getMaxValue().ult(2) to detect 0/1 values. NFCI.

17 months ago[libc] Fix typos in documentation
Kazu Hirata [Sat, 6 May 2023 18:26:32 +0000 (11:26 -0700)]
[libc] Fix typos in documentation

17 months ago[PowerPC] Remove dead declaration mightUseCTR
Kazu Hirata [Sat, 6 May 2023 18:26:31 +0000 (11:26 -0700)]
[PowerPC] Remove dead declaration mightUseCTR

The corresponding function definition was removed on Dec 2, 2022 in
commit b5e1fc19da9527b96665bc4937f96a60092e77c6.

17 months ago[WebAssembly] Remove dead declaration MatchTableForLowering
Kazu Hirata [Sat, 6 May 2023 18:26:30 +0000 (11:26 -0700)]
[WebAssembly] Remove dead declaration MatchTableForLowering

The corresponding function definition was removed on Sep 27, 2022 in
commit 1bd1a4407058c4a159eee6f6956f3bcabeb0d7f8.

17 months ago[libunwind] Unwind through Linux riscv sigreturn trampoline
Feng Wang [Sat, 6 May 2023 18:17:02 +0000 (11:17 -0700)]
[libunwind] Unwind through Linux riscv sigreturn trampoline

Similar to D90898 (Linux AArch64) and D124765 (SystemZ).

On an Arch Linux RISC-V (riscv64gc), the following code

```
#define _GNU_SOURCE
#include <dlfcn.h>
#include <libunwind.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

static void handler(int signo) {
  unw_context_t context;
  unw_cursor_t cursor;
  unw_getcontext(&context);
  unw_init_local(&cursor, &context);
  unw_word_t pc, sp;
  do {
    unw_get_reg(&cursor, UNW_REG_IP, &pc);
    unw_get_reg(&cursor, UNW_REG_SP, &sp);
    printf("pc=0x%016zx sp=0x%016zx", (size_t)pc, (size_t)sp);
    Dl_info info = {};
    if (dladdr((void *)pc, &info))
      printf(" %s:%s", info.dli_fname, info.dli_sname ? info.dli_sname : "");
    puts("");
  } while (unw_step(&cursor) > 0);
  exit(0);
}

int main() {
  signal(SIGUSR1, handler);
  raise(SIGUSR1);
  return 1;
}
```

linked with `-Wl,--export-dynamic` gives an output like
```
pc=0x0000000000010a82 sp=0x00007fffd8a0b910 ./b:
pc=0x00007fffa7e77800 sp=0x00007fffd8a0c520 linux-vdso.so.1:__vdso_rt_sigreturn
pc=0x00007fffa7d73bee sp=0x00007fffd8a0c960 /usr/lib/libc.so.6:
pc=0x00007fffa7d3ed66 sp=0x00007fffd8a0c9b0 /usr/lib/libc.so.6:gsignal
pc=0x0000000000010a3c sp=0x00007fffd8a0c9c0 ./b:main
pc=0x00007fffa7d2f1d4 sp=0x00007fffd8a0c9e0 /usr/lib/libc.so.6:
pc=0x00007fffa7d2f27c sp=0x00007fffd8a0cb10 /usr/lib/libc.so.6:__libc_start_main
pc=0x00000000000109a0 sp=0x00007fffd8a0cb60 ./b:_start
```

Co-Authored-By: Fangrui Song <i@maskray.me>
Reviewed By: #libunwind, MaskRay

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

17 months ago[libc++][ranges] Addresses LWG3759
Mark de Wever [Sat, 21 Jan 2023 12:38:39 +0000 (13:38 +0100)]
[libc++][ranges] Addresses LWG3759

  LWG3759 ranges::rotate_copy should use std::move

This has been one in the initial version (D127211).

Reviewed By: #libc, ldionne

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

17 months ago[clangd] Fix missing dependency on clang/Driver/Options.inc's tblgen target
Jon Roelofs [Sat, 6 May 2023 17:11:39 +0000 (10:11 -0700)]
[clangd] Fix missing dependency on clang/Driver/Options.inc's tblgen target

17 months ago[Clang][OpenMP]Solved the the always truth condition in Arm64
Samuel Maina [Sat, 6 May 2023 16:28:17 +0000 (21:58 +0530)]
[Clang][OpenMP]Solved the the always truth condition in Arm64

There was a bug in the getAArch64MTV function on the third if statement which returns truth  as reported by this issue [[ https://github.com/llvm/llvm-project/issues/61319 |[Clang] Condition is always true which is caused by a possible copy-pasted bug in CGOpenMPRuntime.cpp
 ]].
All the testcases are passing. The first unit tests I could find are for functions that are 6 levels from this issue. The function is very low level and couldn't find a way to affect it from the higher functions.

Reviewed By: jhuber6

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

17 months ago[clang-tidy] Modernize HungarianNotationOption (NFC)
Kazu Hirata [Sat, 6 May 2023 15:56:27 +0000 (08:56 -0700)]
[clang-tidy] Modernize HungarianNotationOption (NFC)

17 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Sat, 6 May 2023 15:56:25 +0000 (08:56 -0700)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

17 months ago[lldb] Replace None with std::nullopt in comments (NFC)
Kazu Hirata [Sat, 6 May 2023 15:56:24 +0000 (08:56 -0700)]
[lldb] Replace None with std::nullopt in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

17 months ago[Sema] Avoid emitting warnings for constant destruction.
Peter Kasting [Sat, 6 May 2023 14:42:14 +0000 (20:12 +0530)]
[Sema] Avoid emitting warnings for constant destruction.

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

Reviewed By: rsmith

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

17 months agoRevert "Reland "[CMake] Bumps minimum version to 3.20.0.""
Mark de Wever [Sat, 6 May 2023 14:53:15 +0000 (16:53 +0200)]
Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""

Unfortunatly not all buildbots are updated.

This reverts commit ffb807ab5375b3f78df198dc5d4302b3b552242f.

17 months ago[DAG] visitSUBSAT - fold subsat(x,y) -> sub(x,y) if it never overflows
Simon Pilgrim [Sat, 6 May 2023 14:54:24 +0000 (15:54 +0100)]
[DAG] visitSUBSAT - fold subsat(x,y) -> sub(x,y) if it never overflows

17 months ago[X86] Add tests showing failure to simplify ssubsat/usubsat to sub
Simon Pilgrim [Sat, 6 May 2023 14:29:08 +0000 (15:29 +0100)]
[X86] Add tests showing failure to simplify ssubsat/usubsat to sub

17 months ago[DAG] Add computeOverflowForSignedSub/computeOverflowForUnsignedSub/computeOverflowForSub
Simon Pilgrim [Sat, 6 May 2023 14:25:40 +0000 (15:25 +0100)]
[DAG] Add computeOverflowForSignedSub/computeOverflowForUnsignedSub/computeOverflowForSub

Match the addition variants (although computeOverflowForUnsignedSub is really just a placeholder), and use this in DAGCombiner::visitSUBO

17 months ago[RegisterCoalescer] Fix problem with IMPLICIT_DEF live-in to an invoke
Jay Foad [Fri, 5 May 2023 12:25:21 +0000 (13:25 +0100)]
[RegisterCoalescer] Fix problem with IMPLICIT_DEF live-in to an invoke

Give up on erasing an IMPLICIT_DEF if it might be live-in to a call
instruction in a basic block with EH pad successors. This fixes a
liveness bug that will be diagnosed by MachineVerifer when D149947
lands.

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

17 months ago[X86] Generate checks for 2012-01-10-UndefExceptionEdge
Jay Foad [Fri, 5 May 2023 12:59:38 +0000 (13:59 +0100)]
[X86] Generate checks for 2012-01-10-UndefExceptionEdge

Also add -verify-machineinstrs to make it easier to catch a
MachineVerifier failure introduced by D149947.

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

17 months ago[UpdateTestChecks] More support for X86 exception handling
Jay Foad [Fri, 5 May 2023 16:18:04 +0000 (17:18 +0100)]
[UpdateTestChecks] More support for X86 exception handling

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

17 months ago[GlobalISel] Fix typo. NFC
Michael Liao [Mon, 1 May 2023 14:35:07 +0000 (10:35 -0400)]
[GlobalISel] Fix typo. NFC

17 months ago[DAG] visitADDSAT - fold saddsat(x,y) -> add(x,y) if it never overflows
Simon Pilgrim [Sat, 6 May 2023 13:18:06 +0000 (14:18 +0100)]
[DAG] visitADDSAT - fold saddsat(x,y) -> add(x,y) if it never overflows

Extend existing uaddsat(x,y) fold

17 months ago[DAG] computeOverflowForSignedAdd - fix typo in comment. NFC.
Simon Pilgrim [Sat, 6 May 2023 13:01:42 +0000 (14:01 +0100)]
[DAG] computeOverflowForSignedAdd - fix typo in comment. NFC.

17 months ago[Support] Add PerThreadBumpPtrAllocator class.
Alexey Lapshin [Thu, 4 May 2023 09:50:11 +0000 (11:50 +0200)]
[Support] Add PerThreadBumpPtrAllocator class.

PerThreadBumpPtrAllocator allows separating allocations by thread id.
That makes allocations race free. It is possible because
ThreadPoolExecutor class creates threads, keeps them until
the destructor of ThreadPoolExecutor is called, and assigns ids
to the threads. Thus PerThreadBumpPtrAllocator should be used with only
threads created by ThreadPoolExecutor. This allocator is useful when
thread safe BumpPtrAllocator is needed.

Reviewed By: MaskRay, dexonsmith, andrewng

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

17 months ago[DAG] Add computeOverflowForSignedAdd and computeOverflowForAdd wrapper
Simon Pilgrim [Sat, 6 May 2023 12:33:08 +0000 (13:33 +0100)]
[DAG] Add computeOverflowForSignedAdd and computeOverflowForAdd wrapper

Add basic computeOverflowForSignedAdd helper to recognise that sadd overflow can't occur if both operands have more that one sign bit.

Add computeOverflowForAdd wrapper that calls computeOverflowForSignedAdd/computeOverflowForUnsignedAdd depending on the IsSigned argument, and use this in DAGCombiner::visitADDO

17 months ago[X86] xaluo.ll - add test coverage showing the failure to recognise when saddo/ssubo...
Simon Pilgrim [Sat, 6 May 2023 11:22:57 +0000 (12:22 +0100)]
[X86] xaluo.ll - add test coverage showing the failure to recognise when saddo/ssubo will not overflow

sadd/ssub with both operands with more than one sign bit will not overflow

Alive2: https://alive2.llvm.org/ce/z/a8HmNp

17 months ago[X86] Regenerate xaluo.ll with common CHECK prefix
Simon Pilgrim [Sat, 6 May 2023 10:55:26 +0000 (11:55 +0100)]
[X86] Regenerate xaluo.ll with common CHECK prefix

17 months ago[clang-tidy] Optimize performance of RenamerClangTidyCheck
Piotr Zegar [Sat, 6 May 2023 12:23:05 +0000 (12:23 +0000)]
[clang-tidy] Optimize performance of RenamerClangTidyCheck

Refactor RenamerClangTidyCheck to achieve better performance
by removing object copies, duplicated function calls and by
using RecursiveASTVisitor.

Measured -72% execution time on bugprone-reserved-identifier.

Reviewed By: njames93

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

17 months ago[clang][NFC] Optimize clang::ASTNodeKind::isBaseOf
Piotr Zegar [Sat, 6 May 2023 12:04:34 +0000 (12:04 +0000)]
[clang][NFC] Optimize clang::ASTNodeKind::isBaseOf

Create dedicated isBaseOf method without calculating
distance.

Tested on RISCVISelDAGToDAG.cpp with:
clang-tidy --checks=*,-bugprone-unchecked-optional-access

Amount of CPU cycles for isBaseOf reduced by ~15% (according to perf).

Reviewed By: aaron.ballman

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

17 months ago[libc++][format] Fixes vector<bool> requirements.
Mark de Wever [Thu, 20 Apr 2023 18:53:46 +0000 (20:53 +0200)]
[libc++][format] Fixes vector<bool> requirements.

Makes sure the formatter for the vector<bool>::reference is enabled
when only the header <vector> is included. Before this change it
required <vector> and <format> to be included. This violated the
requirements in the Standard.

Fixes: https://llvm.org/PR61314

Reviewed By: #libc, ldionne

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

17 months ago[VPlan] Use operands directly in VPInstructionsToVPRecipes (NFC).
Florian Hahn [Sat, 6 May 2023 11:36:00 +0000 (12:36 +0100)]
[VPlan] Use operands directly in VPInstructionsToVPRecipes (NFC).

New that def-use chains are modeled directly in VPlan, we can simply use
the operands of the recipe we are replacing. There is no need to use the
operands of the underlying instruction to look up a VPValue.

17 months ago[clang-tidy] Implement cppcoreguidelines F.19
Chris Cotter [Sat, 6 May 2023 07:02:36 +0000 (07:02 +0000)]
[clang-tidy] Implement cppcoreguidelines F.19

Warns when a function accepting a forwarding reference does anything besides
forwarding (with std::forward) the parameter in the body of the function.

Reviewed By: PiotrZSL

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

17 months ago[NFC]adjust identaion and update comments in X86InstrArithmeic.td
Wang, Xin10 [Sat, 6 May 2023 10:10:20 +0000 (06:10 -0400)]
[NFC]adjust identaion and update comments in X86InstrArithmeic.td

 After https://reviews.llvm.org/D144154, I introduce some identation issues,
and some comments are not that precise.

Reviewed By: skan

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

17 months agoReland "[CMake] Bumps minimum version to 3.20.0."
Mark de Wever [Sat, 6 May 2023 09:43:02 +0000 (11:43 +0200)]
Reland "[CMake] Bumps minimum version to 3.20.0."

All build bots should be updated now.

This reverts commit 44d38022ab29a3156349602733b3459df5beef93.

17 months ago[VPlan] Assert instead of check if VF is vector when widening GEPs(NFC)
Florian Hahn [Sat, 6 May 2023 08:25:46 +0000 (09:25 +0100)]
[VPlan] Assert instead of check if VF is vector when widening GEPs(NFC)

VPWidenGEPRecipe should not be generated for scalar VFs. Replace
check with an assert.

17 months agoRevert "[2a/3][ASan][libcxx] std::deque annotations"
Vitaly Buka [Sat, 6 May 2023 07:21:17 +0000 (00:21 -0700)]
Revert "[2a/3][ASan][libcxx] std::deque annotations"

https://lab.llvm.org/buildbot/#/builders/168/builds/13310
https://lab.llvm.org/buildbot/#/builders/239/builds/2107

This reverts commit 9a5f283139201ba5878780c06c97e4ad1f5eac39.

17 months ago[clang-tidy] Modernize Handler (NFC)
Kazu Hirata [Sat, 6 May 2023 07:02:56 +0000 (00:02 -0700)]
[clang-tidy] Modernize Handler (NFC)

17 months ago[Vectorize] Use Densemap::contains (NFC)
Kazu Hirata [Sat, 6 May 2023 07:02:54 +0000 (00:02 -0700)]
[Vectorize] Use Densemap::contains (NFC)

17 months ago[clangd] Replace None with std::nullopt in comments (NFC)
Kazu Hirata [Sat, 6 May 2023 07:02:53 +0000 (00:02 -0700)]
[clangd] Replace None with std::nullopt in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

17 months agoRevert "Give NullabilityKind a printing operator<<"
Caroline Tice [Sat, 6 May 2023 06:37:30 +0000 (23:37 -0700)]
Revert "Give NullabilityKind a printing operator<<"

This reverts commit 0a532207b8696d81e46017f444bd2257347f129b.

This breaks several of our tests. Have given reproducers to author.
Reverting this until author can fix the issue.

17 months ago[LoongArch] Provide basic TargetTransformInfo implementation
Weining Lu [Sat, 6 May 2023 02:23:33 +0000 (10:23 +0800)]
[LoongArch] Provide basic TargetTransformInfo implementation

This patch only provides basic LoongArchTTIImpl, and more hooks
will be added to provide TTI machinery for LoongArch soon.

Reviewed By: SixWeining, xen0n

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

17 months ago[C++20] [Modules] Don't check input files for C++20 Modules
Chuanqi Xu [Sat, 6 May 2023 03:10:43 +0000 (11:10 +0800)]
[C++20] [Modules] Don't check input files for C++20 Modules

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

Currently, the compiler will emit errors when we compile C++20 modules
if the referenced files changed or got removed. This is because we reuse
the existing logic from Clang implicit modules. It is helpful for clang
implicit modules since it is implicit and we want to be sure things
don't go wrong. But it is not necessary for C++20 modules. The C++20
modules is explicit and it is build systems' responsibility to maintain
the dependencies. So the check in the compiler side may be an overkill.

17 months agoFix a warning in D149117 [-Wunused-but-set-variable]
NAKAMURA Takumi [Sat, 6 May 2023 02:24:58 +0000 (11:24 +0900)]
Fix a warning in D149117 [-Wunused-but-set-variable]

17 months ago[gn] Move LoongArch target from llvm_all_experimental_targets to llvm_all_stable_targets
wanglei [Sat, 6 May 2023 02:20:29 +0000 (10:20 +0800)]
[gn] Move LoongArch target from llvm_all_experimental_targets to llvm_all_stable_targets

Reviewed By: SixWeining

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

17 months ago[NFC][Clang] Fix static analyzer tool remarks about large copies by values in Format...
Manna, Soumi [Sat, 6 May 2023 01:38:46 +0000 (18:38 -0700)]
[NFC][Clang] Fix static analyzer tool remarks about large copies by values in Format.cpp file

Reported by Static Analyzer Tool, Coverity:

Inside "Format.cpp" file, in clang::format::internal::reformat(clang::format::FormatStyle const &, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus *)::[lambda(clang::format::Environment const &) (instance 4)]::operator ()(clang::format::Environment const &): A very large function call parameter exceeding the high threshold is passed by value.

pass_by_value: Capturing variable S of type clang::format::FormatStyle (size 808 bytes) by value, which exceeds the high threshold of 512 bytes

This patch uses original code but with an init capture that does a move instead of a copy.

Reviewed By: tahonermann, erichkeane, MyDeveloperDay, owenpan, HazardyKnusperkeks

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

17 months ago[LLDB] Add minimal support for the new Mojo language
walter erquinigo [Thu, 4 May 2023 02:36:06 +0000 (21:36 -0500)]
[LLDB] Add minimal support for the new Mojo language

Modular just announced a new language called Mojo. This patch adds an entry in the language list in LLDB for minimal support (e.g. being able to create a TypeSystem for this language). We will later add debug info entries when the language matures.

17 months ago[MemProf] Create single version of helper function (NFC)
Teresa Johnson [Sat, 6 May 2023 00:48:13 +0000 (17:48 -0700)]
[MemProf] Create single version of helper function (NFC)

Small clean up to keep a single version of getAllocTypeAttributeString
which was duplicated locally.

17 months ago[libc][docs] Fix incorrect CMake argument in GPU documentation
Joseph Huber [Sat, 6 May 2023 01:15:55 +0000 (20:15 -0500)]
[libc][docs] Fix incorrect CMake argument in GPU documentation

Summary;
This was changed a long time ago to drop the `LLVM_` prefix.

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

17 months ago[llvm-profdata] ProfileReader cleanup - preparation for MD5 refactoring
William Huang [Thu, 4 May 2023 19:23:48 +0000 (19:23 +0000)]
[llvm-profdata] ProfileReader cleanup - preparation for MD5 refactoring

Cleanup profile reader classes to prepare for complex refactoring as propsed in D147740 (Use MD5 as key for profile map). Change is too complicated so I am cleaning up the reader implementation first with these goals.
-  Reduce duplicated/similar logic
-  Reduce virtual functions, changing them to non-virtual
-  Reduce unnecessry checks, indirections, and dead writes.

This is patch 1/n. This patch refactors NameTable

Explaining several decisions here

1. useMD5() means whether  names of the profiles (the ProfileMap) are represented as MD5. It is NOT whether the input profile format is MD5. This function is an interface for IPO passes to decide whether to match function names or function MD5. There are two motives here:
(a) Eventually we want to use MD5 to represent all function contexts because it is much faster to use it as a key for lookup tables (prototype implementation D147740), so in compilation mode we call setProfileUseMD5() to force use MD5. While in tools mode (llvm-profdata) we want to keep the function name info if it's in the input profile.
(b) We also propose to allow multiple name tables and profile sections in ExtBinary format, and it could consist of name tables with or without using MD5, in this case MD5 prevails and other name tables are converted to MD5.

2. MD5 handling logic is pushed up to BinaryReader base class, because this trades a non-devirtualized virtual function call with a predictable branch. ReadStringFromTable() accounts for >5% time when loading a full 1 GB profile, it should not be virtual.

Reviewed By: davidxl

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

17 months agoFix MLIR Linalg Python test after adopting properties in f6ac7e3c6d5b
Mehdi Amini [Sat, 6 May 2023 00:14:40 +0000 (17:14 -0700)]
Fix MLIR Linalg Python test after adopting properties in f6ac7e3c6d5b

17 months ago[test][sanitizer] Add feature for "any" GLIBC
Vitaly Buka [Sat, 6 May 2023 00:11:06 +0000 (17:11 -0700)]
[test][sanitizer] Add feature for "any" GLIBC

"any" is actualy any resonably recent GLIBC.

17 months ago[test][sanitizer] Add tests for join variants
Vitaly Buka [Fri, 5 May 2023 23:55:27 +0000 (16:55 -0700)]
[test][sanitizer] Add tests for join variants

17 months agoAdopt Properties to store operations inherent Attributes in the Linalg dialect
Mehdi Amini [Tue, 11 Apr 2023 03:53:13 +0000 (21:53 -0600)]
Adopt Properties to store operations inherent Attributes in the Linalg dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

17 months agoFix UB passing nullptr to an EmptyProperties class when building OpAdaptor
Mehdi Amini [Fri, 5 May 2023 22:10:21 +0000 (15:10 -0700)]
Fix UB passing nullptr to an EmptyProperties class when building OpAdaptor

A new forwarding constructor is introduced on the adaptor to take directly
an OpaqueProperties object and do the nullptr checking and casting to avoid
the boilerplate at callsites.

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

17 months agoAdd -misc-use-anonymous-namespace to .clang-tidy
Sergei Barannikov [Tue, 2 May 2023 17:12:32 +0000 (20:12 +0300)]
Add -misc-use-anonymous-namespace to .clang-tidy

This is at odds with the coding standard.
Quoting https://llvm.org/docs/CodingStandards.html#anonymous-namespaces
> Because of this, we have a simple guideline: make anonymous namespaces
> as small as possible, and only use them for class declarations.

Reviewed By: MaskRay

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

17 months ago[MemProf] Context disambiguation cloning pass [patch 4/4]
Teresa Johnson [Thu, 5 Jan 2023 17:55:33 +0000 (09:55 -0800)]
[MemProf] Context disambiguation cloning pass [patch 4/4]

Applies ThinLTO cloning decisions made during the thin link and
recorded in the summary index to the IR during the ThinLTO backend.

Depends on D141077.

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

17 months agoRemove unused basic_android_tree/mipsel-linux-android
AdityaK [Fri, 5 May 2023 21:29:24 +0000 (14:29 -0700)]
Remove unused basic_android_tree/mipsel-linux-android

Reviewers: danalbert, enh, pirama, srhines

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

17 months agoms inline asm: recognize case-insensitive JMP and CALL as TargetLowering::C_Address
Fangrui Song [Fri, 5 May 2023 22:32:32 +0000 (15:32 -0700)]
ms inline asm: recognize case-insensitive JMP and CALL as TargetLowering::C_Address

In a `__asm` block, a symbol reference is usually a memory constraint
(indirect TargetLowering::C_Memory) [LOOP]. CALL and JUMP instructions are special
that `__asm call k` can be an address constraint, if `k` is a function.

Clang always gives us indirect TargetLowering::C_Memory and need to convert it
to direct TargetLowering::C_Address. D133914 implements this conversion, but
does not consider JMP or case-insensitive CALL. This patch implements the missing
cases, so that `__asm jmp k` (`jmp ${0:P}`) will correctly lower to `jmp _k`
instead of `jmp dword ptr [_k]`.

(`__asm call k` lowered to `call dword ptr ${0:P}` and is fixed by D149695 to
lower to `call ${0:P}` instead.)

[LOOP]: Some instructions like LOOP{,E,NE} and Jcc always use an address
constraint (`loop _k` instead of `loop dword ptr [_k]`).

After this patch and D149579, all the following cases will be correct.
```
int k(int);
int (*kptr)(int);
...
__asm call k; // correct without this patch
__asm CALL k; // correct, but needs this patch to be compatible with D149579
__asm jmp k;  // correct, but needs this patch to be compatible with D149579
__asm call kptr; // will be fixed by D149579.  "Broken case" in clang/test/CodeGen/ms-inline-asm-functions.c
__asm jmp kptr;  // will be fixed by this patch and D149579
```

Reviewed By: pengfei

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

17 months ago[lldb] Fix fallout from e9eaf7b430ee
Alex Langford [Fri, 5 May 2023 21:55:07 +0000 (14:55 -0700)]
[lldb] Fix fallout from e9eaf7b430ee

Minor logic mistake. This caused TestObjCClassMethod to fail.

17 months ago[test][lsan] Remove std::vector from test
Vitaly Buka [Fri, 5 May 2023 21:48:57 +0000 (14:48 -0700)]
[test][lsan] Remove std::vector from test

17 months ago[test][lsan] For thread args/result leak
Vitaly Buka [Fri, 5 May 2023 21:34:19 +0000 (14:34 -0700)]
[test][lsan] For thread args/result leak

17 months ago[lldb] Migrate to GetPropertyAtIndexAs for ArchSpec (NFC)
Jonas Devlieghere [Fri, 5 May 2023 21:43:29 +0000 (14:43 -0700)]
[lldb] Migrate to GetPropertyAtIndexAs for ArchSpec (NFC)

Use the templated GetPropertyAtIndexAs helper for ArchSpec.

17 months ago[lldb] Migrate to GetPropertyAtIndexAs for LanguageType (NFC)
Jonas Devlieghere [Fri, 5 May 2023 06:15:28 +0000 (23:15 -0700)]
[lldb] Migrate to GetPropertyAtIndexAs for LanguageType (NFC)

Use the templated GetPropertyAtIndexAs helper for LanguageType.

17 months ago[NFC] ][CLANG] Fix static code analyzer concerns
Manna, Soumi [Fri, 5 May 2023 21:11:25 +0000 (14:11 -0700)]
[NFC] ][CLANG] Fix static code analyzer concerns

Reported by Coverity:

1. Inside "ASTReader.cpp" file,  in clang::ASTReader::FindExternalLexicalDecls(clang::DeclContext const *, llvm::function_ref<bool (clang::Decl::Kind)>, llvm::SmallVectorImpl<clang::Decl *> &): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type pair.

2. Inside "ASTReader.cpp" file, in clang::ASTReader::ReadAST(llvm::StringRef, clang::serialization::ModuleKind, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::ASTReader::ImportedSubmodule> *): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type DenseMapPair.

3. Inside "CGOpenMPRuntimeGPU.cpp" file, in clang::CodeGen::CGOpenMPRuntimeGPU::emitGenericVarsEpilog(clang::CodeGen::CodeGenFunction &, bool): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type pair.

4. Inside "ASTWriter.cpp" file, in clang::ASTWriter::WriteHeaderSearch(clang::HeaderSearch const &): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type UnresolvedHeaderDirective.

Reviewed By: tahonermann

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