platform/upstream/llvm.git
21 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

21 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

21 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

21 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

21 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`

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

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

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

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

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

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

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

21 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

21 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

21 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

21 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

21 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

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

21 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

21 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

21 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

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

21 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

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

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

21 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

21 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

21 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

21 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

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

21 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

21 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

21 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

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

21 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

21 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

21 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

21 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

21 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

21 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

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

21 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

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

21 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

21 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

21 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

21 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

21 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

21 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

21 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

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

21 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

21 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

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

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

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

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

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

21 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

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

21 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

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

21 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]

21 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

21 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

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

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

21 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

21 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

21 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

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

21 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

21 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

21 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

21 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

21 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

21 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

21 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

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

21 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

21 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

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

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

21 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

21 months ago[bazel] Add missing dependency for b8e878da5c2ee65cc7a357890d83445625b59c79
Benjamin Kramer [Fri, 5 May 2023 21:33:41 +0000 (23:33 +0200)]
[bazel] Add missing dependency for b8e878da5c2ee65cc7a357890d83445625b59c79

21 months agoRevert "[ArgumentPromotion] Bail if any callers are minsize"
Shoaib Meenai [Fri, 5 May 2023 21:19:18 +0000 (14:19 -0700)]
Revert "[ArgumentPromotion] Bail if any callers are minsize"

This reverts commit 8b8466fd31e5a194fd8ba7a73a0f23d32f164318.

This is causing size regressions with -Oz and FullLTO. Revert while I
come up with a repro.

21 months agoRevert "Reland [Pipeline] Don't limit ArgumentPromotion to -O3"
Shoaib Meenai [Fri, 5 May 2023 21:18:12 +0000 (14:18 -0700)]
Revert "Reland [Pipeline] Don't limit ArgumentPromotion to -O3"

This reverts commit 6f29d1adf29820daae9ea7a01ae2588b67735b9e.

https://reviews.llvm.org/D149768 is causing size regressions for -Oz
with FullLTO, and I'm reverting that one while investigating. This
commit depends on that one, so it needs to be reverted as well.

21 months agoAdd myself as a code owner of SLP vectorizer + credits, NFC.
Alexey Bataev [Fri, 5 May 2023 21:18:26 +0000 (14:18 -0700)]
Add myself as a code owner of SLP vectorizer + credits, NFC.

21 months ago[libc++][PSTL] Make the PSTL available by default under -fexperimental-library
Nikolas Klauser [Fri, 5 May 2023 15:41:13 +0000 (08:41 -0700)]
[libc++][PSTL] Make the PSTL available by default under -fexperimental-library

This removes the need for a custom libc++ build to have a basic set of PSTL algorithms.

Reviewed By: ldionne, #libc

Spies: miyuki, libcxx-commits, arichardson

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

21 months ago[flang] OpenMP allocate directive parse tree fix
Ethan Luis McDonough [Fri, 5 May 2023 20:50:18 +0000 (15:50 -0500)]
[flang] OpenMP allocate directive parse tree fix

Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate

After rewriting:
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate

Reviewed By: kiranchandramohan

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

Co-authored-by: Isaac Perry <isaac.perry@arm.com>
21 months agoRevert "[flang] OpenMP allocate directive parse tree fix"
Ethan Luis McDonough [Fri, 5 May 2023 20:47:00 +0000 (15:47 -0500)]
Revert "[flang] OpenMP allocate directive parse tree fix"

This reverts commit 597d8563cd66f23d857196bf135a0c513115ece2.

21 months agoRestore again "[MemProf] Context disambiguation cloning pass [patch 3/4]"
Teresa Johnson [Thu, 4 May 2023 17:30:29 +0000 (10:30 -0700)]
Restore again "[MemProf] Context disambiguation cloning pass [patch 3/4]"

This reverts commit f09807ca9dda2f588298d8733e89a81105c88120, restoring
bfe7205975a63a605ff3faacd97fe4c1bf4c19b3 and follow on fix
e3e6bc699574550f2ed1de07f4e5bcdddaa65557, now that the nondeterminism
has been addressed by D149924.

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

21 months ago[flang] OpenMP allocate directive parse tree fix
Ethan Luis McDonough [Fri, 5 May 2023 19:53:08 +0000 (14:53 -0500)]
[flang] OpenMP allocate directive parse tree fix

Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
```
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate
```

After rewriting:
```
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
```

Co-authored-by: Isaac Perry <isaac.perry@arm.com>
Reviewed By: kiranchandramohan

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

21 months agoRevert "[flang] OpenMP allocate directive parse tree fix"
Ethan Luis McDonough [Fri, 5 May 2023 19:50:14 +0000 (14:50 -0500)]
Revert "[flang] OpenMP allocate directive parse tree fix"

This reverts commit 5faf45a3d24e603cbc8fe4eb45da386653dae5e5.
Once again arcanist stripped the co-author metadata.  I'm going to add it to the revision description and try one last time.

21 months ago[clang][ci] Upload artifacts in a tarball to reduce size and avoid symlink issues
Louis Dionne [Fri, 5 May 2023 19:45:33 +0000 (15:45 -0400)]
[clang][ci] Upload artifacts in a tarball to reduce size and avoid symlink issues

21 months ago[flang] OpenMP allocate directive parse tree fix
Ethan Luis McDonough [Fri, 5 May 2023 19:32:45 +0000 (14:32 -0500)]
[flang] OpenMP allocate directive parse tree fix

Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
```
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate
```

After rewriting:
```
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
```

Reviewed By: kiranchandramohan

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

21 months agoRevert "[flang] OpenMP allocate directive parse tree fix"
Ethan Luis McDonough [Fri, 5 May 2023 19:31:01 +0000 (14:31 -0500)]
Revert "[flang] OpenMP allocate directive parse tree fix"

This reverts commit eaf7d97865140a17f13ad77e5dc0216438127094.
Arcanist stripped co-author data from initial commit.

21 months ago[RISCV][TTI] Model shuffle mask materialization with correct index type
Philip Reames [Fri, 5 May 2023 19:23:13 +0000 (12:23 -0700)]
[RISCV][TTI] Model shuffle mask materialization with correct index type

We were modeling these as if the index type was always e8, but the actual
lowering uses the data type width if legal.  We also weren't accounting for
i64 on xlen32 correctly.

Noticed via inspection while working on the shuffle/buildvec lowering.  Note
that this costing is also wrong in a more major way - we don't actually use
a constant pool load in many cases.  But that's a separate issue.

21 months ago[MC] Simplify flushPendingLabels. NFC
Fangrui Song [Fri, 5 May 2023 19:12:45 +0000 (12:12 -0700)]
[MC] Simplify flushPendingLabels. NFC

21 months ago[flang][openacc] Lower host and device clauses to data operand ops
Valentin Clement [Fri, 5 May 2023 19:01:44 +0000 (12:01 -0700)]
[flang][openacc] Lower host and device clauses to data operand ops

Update OpenACC update construct lowering to create
the data operand operations for host and device clauses.

Depends on D149909

Reviewed By: razvanlupusoru, jeanPerier

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