platform/upstream/llvm.git
18 months ago[clang][NFC] Make parameters to NoteOverloadCandidate const
Timm Bäder [Sat, 15 Apr 2023 08:14:59 +0000 (10:14 +0200)]
[clang][NFC] Make parameters to NoteOverloadCandidate const

18 months ago[Analysis] Remove DA & LegacyDA
pvanhout [Wed, 12 Apr 2023 11:28:45 +0000 (13:28 +0200)]
[Analysis] Remove DA & LegacyDA

UniformityAnalysis offers all of the same features and much more, there is no reason left to use the legacy DAs.
See RFC: https://discourse.llvm.org/t/rfc-deprecate-divergenceanalysis-legacydivergenceanalysis/69538

- Remove LegacyDivergenceAnalysis.h/.cpp
- Remove DivergenceAnalysis.h/.cpp + Unit tests
- Remove SyncDependenceAnalysis - it was not a real registered analysis and was only used by DAs
- Remove/adjust references to the passes in the docs where applicable
- Remove TTI hook associated with those passes.
- Move tests to UniformityAnalysis folder.
  - Remove RUN lines for the DA, leave only the UA ones.
- Some tests had to be adjusted/removed depending on how they used the legacy DAs.

Reviewed By: foad, sameerds

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

18 months ago[builtins] Fix -Wshift-count-overflow warnings for targets with 16-bit int
Mikael Holmen [Tue, 4 Apr 2023 06:45:53 +0000 (08:45 +0200)]
[builtins] Fix -Wshift-count-overflow warnings for targets with 16-bit int

Without this fix we got warnings like
 /repo/llvm/compiler-rt/lib/builtins/floattidf.c:67:29: warning: shift count >= width of type [-Wshift-count-overflow]
                 ((e + 1023) << 20) |              // exponent
                             ^  ~~
 1 warning generated.
when compiling for a target with 16-bit int.

In floatundisf.c the type of "e" was already changed to "si_int" in
4d41df6482, now we do the same in a couple of other files where "e" is
also left shifted 20/23 steps.

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

18 months ago[clang-tidy] Add alias cppcoreguidelines-use-default-member-init
Carlos Galvez [Sun, 16 Apr 2023 10:23:37 +0000 (10:23 +0000)]
[clang-tidy] Add alias cppcoreguidelines-use-default-member-init

And deprecate identical functionality from
cppcoreguidelines-prefer-member-initializer, which had too many
responsibilities and a tight coupling to the
modernize-use-default-member-init check.

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

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

18 months ago[flang][hlfir] Preserve hlfir.assign in the bufferize-hlfir pass
Jean Perier [Mon, 17 Apr 2023 05:47:35 +0000 (07:47 +0200)]
[flang][hlfir] Preserve hlfir.assign in the bufferize-hlfir pass

hlfir.assign must be rewritten in the bufferize pass since its operands,
that can be expressions, may have been updated. This is just
an operand update rewrite. The previous code was replacing the
operation, but it was dropping all hlfir.assign on the floor doing
so. This broke allocatable assignment semantics that use attributes.

Update the operands in place instead to preserve the attributes, if any.

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

18 months ago[flang][hlfir] Fix hlfir.set_length codegen
Jean Perier [Mon, 17 Apr 2023 05:46:13 +0000 (07:46 +0200)]
[flang][hlfir] Fix hlfir.set_length codegen

The bufferization pass was propagating the raw alloca storage
(which may not allow to later retrieve the length) instead of
the hlfir variable value (which is guaranteed to hold the
character length).

Fix this and makes packageBufferizedExpr "storage" argument and
getBufferizedExprStorage return an hlfir::Entity to avoid similar
error in the future (the caller of packageBufferizedExpr will have
to think a bit when adding the explicit hlfir::Entity{} cast).

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

18 months ago[libc][NFC] Remove use of StreamWrapper from math differential tests.
Siva Chandra Reddy [Sun, 16 Apr 2023 05:40:07 +0000 (05:40 +0000)]
[libc][NFC] Remove use of StreamWrapper from math differential tests.

Along the way, the utility Timer has been moved to the math differential
test directory.

Reviewed By: lntue

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

18 months agoRevert "[clang-rename] Exit gracefully when no input provided"
Shivam Gupta [Mon, 17 Apr 2023 05:01:40 +0000 (10:31 +0530)]
Revert "[clang-rename] Exit gracefully when no input provided"

This reverts commit 726199146a0bb53315ade042e759c65e6d96d556.

This broke the buildbot -
https://lab.llvm.org/buildbot#builders/139/builds/39267

18 months ago[clang-rename] Exit gracefully when no input provided
Shivam Gupta [Sat, 15 Apr 2023 18:23:56 +0000 (23:53 +0530)]
[clang-rename] Exit gracefully when no input provided

clang-rename on a non existing file segfaults

Command to run -
$ clang-rename -offset=0 -new-name=plop asdasd

Error while processing llvm-project/asdasd.
clang-rename: llvm-project/llvm/include/llvm/Support/ErrorOr.h:237:
llvm::ErrorOr<T>::storage_type* llvm::ErrorOr<T>::getStorage()
[with T = const clang::FileEntry*; llvm::ErrorOr<T>::storage_type = const clang::FileEntry*]:
Assertion `!HasError && "Cannot get value when an error exists!"' failed.

[1]    827497 IOT instruction  clang-rename -offset=0 -new-name=plop asdasd

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

18 months ago[LLDB] Fix broken Windows unittests build
Muhammad Omair Javaid [Mon, 17 Apr 2023 03:28:13 +0000 (08:28 +0500)]
[LLDB] Fix broken Windows unittests build

LLDB Windows tests were broken because SymbolFilePDBTests.cpp failed
to compile after 6cdfa295743729178ff6f15a8dcd36f8f7d27c2c.

This patch fixes the SymbolFilePDBTests.cpp. (Tested on Surface X Pro)

https://lab.llvm.org/buildbot/#/builders/219

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

18 months ago[TableGen] Use PointerUnion for Operator and Val in TreePatternNode.
Craig Topper [Mon, 17 Apr 2023 03:10:51 +0000 (20:10 -0700)]
[TableGen] Use PointerUnion for Operator and Val in TreePatternNode.

These fields are never set at the same time so we can store them
using a single PointerUnion.

18 months ago[m68k] Add basic support for floating point arithmetic instruction
Sheng [Mon, 17 Apr 2023 03:08:48 +0000 (11:08 +0800)]
[m68k] Add basic support for floating point arithmetic instruction

This patch adds support for fneg, fabs, fadd, fsub, fdiv, fmul.

Note that this only adds freg->freg addressing mode. memory->reg addressing mode will be introduced once the infrastructure is ready.

Reviewed By: myhsu

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

18 months ago[Support] Apply fixes from modernize-type-trait (NFC)
Kazu Hirata [Mon, 17 Apr 2023 02:20:21 +0000 (19:20 -0700)]
[Support] Apply fixes from modernize-type-trait (NFC)

18 months ago[TableGen] Avoid extra IntrusiveRefCntPtr when calling SimplifyTree. NFC
Craig Topper [Mon, 17 Apr 2023 01:07:10 +0000 (18:07 -0700)]
[TableGen] Avoid extra IntrusiveRefCntPtr when calling SimplifyTree. NFC

Add a helper to get modifiable access to the IntrusiveRefCntPtr
stored in the Children array. This avoids copying and overwriting the child.

18 months ago[clang-format] Fix regression with AlignTrailingComments set to true
Owen Pan [Sun, 16 Apr 2023 02:53:24 +0000 (19:53 -0700)]
[clang-format] Fix regression with AlignTrailingComments set to true

Fixes #62161.

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

18 months ago[JITLink][ELF][x86-64] Add support for R_X86_64_GOTPC32 relocation.
Lang Hames [Mon, 17 Apr 2023 01:22:52 +0000 (01:22 +0000)]
[JITLink][ELF][x86-64] Add support for R_X86_64_GOTPC32 relocation.

Adds support for the R_X86_64_GOTPC32 relocation, which is a 32-bit delta to
the global offset table.

Since the delta to the GOT doesn't actually require any GOT entries to exist
this commit adds an extra fallback path to the getOrCreateGOTSymbol function:
If the symbol is in the extenal symbols list but no entry exists then the
symbol is turned into an absolute symbol pointing to an arbitrary address in
the current graph's allocation (accessing this address via the symbol would be
illegal, but any access should have triggered creation of a GOT entry which
would prevent this fallback path from being taken in the first place).

This commit also updates the llvm-jitlink tool to scrape the addresses of the
absolute symbols in the graph so that the testcase can see the now-absolute
_GLOBAL_OFFSET_TABLE_ symbol.

18 months ago[Coverity] Add assert for assumption.
Luo, Yuanke [Mon, 17 Apr 2023 00:50:53 +0000 (08:50 +0800)]
[Coverity] Add assert for assumption.

18 months ago[clang-format][NFC] Output tokens on test assert
sstwcw [Sun, 16 Apr 2023 23:47:55 +0000 (23:47 +0000)]
[clang-format][NFC] Output tokens on test assert

Reviewed By: rymiel

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

18 months ago[ADT] Apply fixes from modernize-type-traits (NFC)
Kazu Hirata [Sun, 16 Apr 2023 23:24:34 +0000 (16:24 -0700)]
[ADT] Apply fixes from modernize-type-traits (NFC)

18 months ago[mlir][math] Properly disable ctlz conversion in MathToFuncs.
Slava Zakharin [Sun, 16 Apr 2023 20:07:55 +0000 (13:07 -0700)]
[mlir][math] Properly disable ctlz conversion in MathToFuncs.

This fixes issues caused by D146261.
Differential Revision: https://reviews.llvm.org/D148477

18 months ago[M68k] Fix printing of immediate in `M68kOperand::print`
Ian Douglas Scott [Sun, 16 Apr 2023 22:43:27 +0000 (15:43 -0700)]
[M68k] Fix printing of immediate in `M68kOperand::print`

The `Imm` union variant wasn't initialized anywhere. This fixes what is
printed by `llvm-mc -arch m68k --show-inst-operands`.

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

18 months ago[clang-format] Handle Verilog assertions and loops
sstwcw [Sun, 16 Apr 2023 21:55:50 +0000 (21:55 +0000)]
[clang-format] Handle Verilog assertions and loops

Assert statements in Verilog can optionally have an else part.  We
handle them like for `if` statements, except that an `if` statement in
the else part of an `assert` statement doesn't get merged with the
`else` keyword.  Like this:

    assert (x)
      $info();
    else
      if (y)
        $info();
      else if (z)
        $info();
      else
        $info();

`foreach` and `repeat` are now handled like for or while loops.

We used the type `TT_ConditionLParen` to mark the condition part so
they are handled in the same way as the condition part of an `if`
statement.  When the code being formatted is not in Verilog, it is
only set for `if` statements, not loops.  It's because loop conditions
are currently handled slightly differently, and existing behavior is
not supposed to change.  We formatted all files ending in `.cpp` and
`.h` in the repository with and without this change.  It showed that
setting the type for `if` statements doesn't change existing behavior.

And we noticed that we forgot to make the program print the list of
tokens when the number is not correct in `TokenAnnotatorTest`.  It's
fixed now.

Reviewed By: HazardyKnusperkeks

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

18 months ago[clang] Modernize ModuleDeclSeq (NFC)
Kazu Hirata [Sun, 16 Apr 2023 21:48:18 +0000 (14:48 -0700)]
[clang] Modernize ModuleDeclSeq (NFC)

Identified with modernize-use-default-member-init.

18 months ago[clang] Modernize ReturnAdjustment and ThisAdjustment (NFC)
Kazu Hirata [Sun, 16 Apr 2023 21:48:16 +0000 (14:48 -0700)]
[clang] Modernize ReturnAdjustment and ThisAdjustment (NFC)

Identified with modernize-use-default-member-init.

18 months ago[clang] Modernize OptRemark (NFC)
Kazu Hirata [Sun, 16 Apr 2023 21:24:22 +0000 (14:24 -0700)]
[clang] Modernize OptRemark (NFC)

Identified with modernize-use-default-member-init.

18 months ago[clang] Modernize EvalStatus (NFC)
Kazu Hirata [Sun, 16 Apr 2023 21:02:34 +0000 (14:02 -0700)]
[clang] Modernize EvalStatus (NFC)

Identified with modernize-use-default-member-init.

18 months ago[clang] Modernize ASTConsumer (NFC)
Kazu Hirata [Sun, 16 Apr 2023 20:46:11 +0000 (13:46 -0700)]
[clang] Modernize ASTConsumer (NFC)

Identified with modernize-use-default-member-init.

18 months ago[clang] Modernize Vec (NFC)
Kazu Hirata [Sun, 16 Apr 2023 20:46:09 +0000 (13:46 -0700)]
[clang] Modernize Vec (NFC)

Identified with modernize-use-default-member-init.

18 months ago[AMDGPU] Modernize Status and BlockData (NFC)
Kazu Hirata [Sun, 16 Apr 2023 20:03:02 +0000 (13:03 -0700)]
[AMDGPU] Modernize Status and BlockData (NFC)

Identified with modernize-use-default-member-init.

18 months ago[IPO] Modernize OpenMPOptPass and OpenMPOptCGSCCPass (NFC)
Kazu Hirata [Sun, 16 Apr 2023 19:48:14 +0000 (12:48 -0700)]
[IPO] Modernize OpenMPOptPass and OpenMPOptCGSCCPass (NFC)

Identified with readability-redundant-member-init.

18 months ago[InstCombine] Modernize InstCombineOptions (NFC)
Kazu Hirata [Sun, 16 Apr 2023 19:43:02 +0000 (12:43 -0700)]
[InstCombine] Modernize InstCombineOptions (NFC)

Identified with modernize-use-default-member-init.

18 months ago[ORC][LLJIT] Add LLJITBuilder convenience function to enable debugger support.
Lang Hames [Sun, 16 Apr 2023 19:14:15 +0000 (12:14 -0700)]
[ORC][LLJIT] Add LLJITBuilder convenience function to enable debugger support.

Clients can now call LLJITBuilder::setEnableDebuggerSupport to enable
registration of debug info via the GDB-JIT registration protocol for JIT'd
code.

Calling LLJITBuilder::setEnableDebuggerSupport(true) will cause LLJITBuilder to
add either a DebugObjectManagerPlugin (if the object format on the triple is
ELF), or a GDBJITDebugInfoRegistrationPlugin (if the object format on the
triple is MachO). At present there is no support for debugging when using COFF.

This debugger registration support will only work when JITLink is used as the
underlying JIT linker.

This patch only addresses registration of JIT'd code by the JIT. To debug JIT'd
code you may also need to enable JIT'd code debugging in your debugger. E.g.
when debugging MachO JIT'd code under LLDB you will currently need to run
(lldb) set set plugin.jit-loader.gdb.enable on
to tell LLDB to listen for JIT'd code registration.

18 months ago[Analysis] Modernize CallStackTrie (NFC)
Kazu Hirata [Sun, 16 Apr 2023 19:12:07 +0000 (12:12 -0700)]
[Analysis] Modernize CallStackTrie (NFC)

Identified with modernize-use-default-member-init.

18 months ago[AMDGPU] Don't assert that image intrinsics are supported
Jay Foad [Wed, 12 Apr 2023 17:33:01 +0000 (18:33 +0100)]
[AMDGPU] Don't assert that image intrinsics are supported

Unsupported intrinsics should give a regular "cannot select" error.

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

18 months ago[Support] Modernize TimeRecord (NFC)
Kazu Hirata [Sun, 16 Apr 2023 18:40:32 +0000 (11:40 -0700)]
[Support] Modernize TimeRecord (NFC)

Identified with modernize-use-default-member-init.

18 months ago[TargetParser] Expose Triple::getObjectFormatTypeName.
Lang Hames [Sun, 16 Apr 2023 18:10:09 +0000 (11:10 -0700)]
[TargetParser] Expose Triple::getObjectFormatTypeName.

This is useful for printing the object format of a triple in debug logs.

18 months ago[flang] Refine how Clang dependencies are expressed #58663
Ezike Ebuka [Sun, 16 Apr 2023 14:19:46 +0000 (14:19 +0000)]
[flang] Refine how Clang dependencies are expressed #58663

Fixes #58663

Reviewed By: awarzynski

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

18 months ago[MCParser] Modernize IntelExpr (NFC)
Kazu Hirata [Sun, 16 Apr 2023 17:18:57 +0000 (10:18 -0700)]
[MCParser] Modernize IntelExpr (NFC)

Identified with readability-redundant-member-init.

18 months ago[llvm] Remove redundant string initialization (NFC)
Kazu Hirata [Sun, 16 Apr 2023 16:42:34 +0000 (09:42 -0700)]
[llvm] Remove redundant string initialization (NFC)

Identified with readability-redundant-string-init.

18 months agollvm/module.modulemap: Exclude `CodeGenPassBuilder.h` out of `LLVM_Backend`
NAKAMURA Takumi [Sun, 16 Apr 2023 16:12:40 +0000 (01:12 +0900)]
llvm/module.modulemap: Exclude `CodeGenPassBuilder.h` out of `LLVM_Backend`

18 months agollvm/module.modulemap: Add `Demangle` in `LLVM_Utils`
NAKAMURA Takumi [Sun, 16 Apr 2023 16:12:40 +0000 (01:12 +0900)]
llvm/module.modulemap: Add `Demangle` in `LLVM_Utils`

18 months agollvm/module.modulemap: Exclude `Support/Host.h`
NAKAMURA Takumi [Sun, 16 Apr 2023 16:12:40 +0000 (01:12 +0900)]
llvm/module.modulemap: Exclude `Support/Host.h`

It is declared as `deprecated`.

18 months agoRevert "[FuzzMutate] RandomIRBuilder has more source and sink type now."
Peter Rong [Sun, 16 Apr 2023 16:07:19 +0000 (09:07 -0700)]
Revert "[FuzzMutate] RandomIRBuilder has more source and sink type now."

This reverts commit e0117a3efacf9620408393f162a7795b5e0965d2.

18 months ago[Scalar] Use range-based for loops (NFC)
Kazu Hirata [Sun, 16 Apr 2023 16:05:20 +0000 (09:05 -0700)]
[Scalar] Use range-based for loops (NFC)

18 months ago[clang-tidy] Prevent `llvmlibc-inline-function-decl` triggering on lambdas
Joseph Huber [Mon, 17 Apr 2023 20:08:59 +0000 (15:08 -0500)]
[clang-tidy] Prevent `llvmlibc-inline-function-decl` triggering on lambdas

The `llvmlibc-inline-function-decl` check is intended to be used to
allow declarations in the `libc` project's header to be changed per-TU.
However, it is impossible to place this macro in front of a lambda so
this is not helpful. Additionally, lambdas are always going to have
internal linkage so they will not differ accross TUs.

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

Reviewed By: lntue, PiotrZSL

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

18 months ago[CMake] Cleanup deps
NAKAMURA Takumi [Sun, 16 Apr 2023 15:38:49 +0000 (00:38 +0900)]
[CMake] Cleanup deps

18 months ago[CMake] Reorder and reformat deps
NAKAMURA Takumi [Sun, 16 Apr 2023 15:17:45 +0000 (00:17 +0900)]
[CMake] Reorder and reformat deps

18 months ago[flang] Apply fixes from readability-string-compare (NFC)
Kazu Hirata [Sun, 16 Apr 2023 15:31:23 +0000 (08:31 -0700)]
[flang] Apply fixes from readability-string-compare (NFC)

18 months ago[Transforms] Apply fixes from performance-for-range-copy (NFC)
Kazu Hirata [Sun, 16 Apr 2023 15:25:28 +0000 (08:25 -0700)]
[Transforms] Apply fixes from performance-for-range-copy (NFC)

18 months ago[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI).
Florian Hahn [Sun, 16 Apr 2023 14:38:31 +0000 (15:38 +0100)]
[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI).

Before this patch, a VPlan contained 2 mappings for Values -> VPValue:
1) Value2VPValue and 2) VPExternalDefs.

This duplication is unnecessary and there are already cases where
external defs are added to Value2VPValue. This patch replaces all uses
of VPExternalDefs with Value2VPValue.

It clarifies the naming of getOrAddVPValue (to getOrAddExternalVPValue)
and addVPValue (to addExternalVPValue).

At the moment, this is NFC, but will enable additional simplifications
in D147783.

Depends on D147891.

Reviewed By: Ayal

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

18 months ago[SROA] Remove UB-implying metadata when promoting speculative instruction.
DianQK [Sun, 16 Apr 2023 14:35:27 +0000 (22:35 +0800)]
[SROA] Remove UB-implying metadata when promoting speculative instruction.

After D138238 introduced the then/else blocks, we should remove UB-implying metadata for the promoted speculative instruction.

Reviewed By: nikic

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

18 months ago[VPlan] Check VPValue step in isCanonical (NFCI).
Florian Hahn [Sun, 16 Apr 2023 13:48:02 +0000 (14:48 +0100)]
[VPlan] Check VPValue step in isCanonical (NFCI).

Update the isCanonical() implementations to check the VPValue step
operand instead of the step in the induction descriptor.

At the moment this is NFC, but it enables further optimizations if the
step is replaced by a constant in D147783.

Reviewed By: Ayal

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

18 months ago[libc++] Add hide_from_abi check for classes
Nikolas Klauser [Mon, 23 Jan 2023 09:27:14 +0000 (10:27 +0100)]
[libc++] Add hide_from_abi check for classes

We already have a clang-tidy check for making sure that `_LIBCPP_HIDE_FROM_ABI` is on free functions. This patch extends this to class members. The places where we don't check for `_LIBCPP_HIDE_FROM_ABI` are classes for which we have an instantiation in the library.

Reviewed By: ldionne, Mordante, #libc

Spies: jplehr, mikhail.ramalho, sstefan1, libcxx-commits, krytarowski, miyuki, smeenai

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

18 months ago[clang-tidy] Fix handling of UseAssignment option in cppcoreguidelines-prefer-member...
Piotr Zegar [Sun, 16 Apr 2023 10:16:29 +0000 (10:16 +0000)]
[clang-tidy] Fix handling of UseAssignment option in cppcoreguidelines-prefer-member-initializer

From now on check will use value from cppcoreguidelines-prefer-member-initializer
and fallback to modernize-use-default-member-init.UseAssignment if not specified.

Fixes: #55616.

Reviewed By: carlosgalvezp

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

18 months ago[clang-format] Dont interpret variable named interface as keyword for C++
Jorge Pinto Sousa [Sun, 16 Apr 2023 10:17:40 +0000 (03:17 -0700)]
[clang-format] Dont interpret variable named interface as keyword for C++

Fixes #53173.

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

18 months ago[gn build] Port 3bf322e69d5c
LLVM GN Syncbot [Sun, 16 Apr 2023 08:51:39 +0000 (08:51 +0000)]
[gn build] Port 3bf322e69d5c

18 months ago[clang-tidy] Add bugprone-non-zero-enum-to-bool-conversion check
Piotr Zegar [Sun, 16 Apr 2023 05:58:34 +0000 (05:58 +0000)]
[clang-tidy] Add bugprone-non-zero-enum-to-bool-conversion check

Detect implicit and explicit conversions of enum to bool,
when enum doesn't have a enumerator with value equal to 0.
In theory such conversion should always return TRUE.

Reviewed By: carlosgalvezp

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

18 months agoApply fixes from performance-faster-string-find (NFC)
Kazu Hirata [Sun, 16 Apr 2023 07:51:27 +0000 (00:51 -0700)]
Apply fixes from performance-faster-string-find (NFC)

18 months agoRemove redundant initialization of std::optional (NFC)
Kazu Hirata [Sun, 16 Apr 2023 07:40:05 +0000 (00:40 -0700)]
Remove redundant initialization of std::optional (NFC)

18 months ago[IR] Drop unnecessary const from a return type (NFC)
Kazu Hirata [Sun, 16 Apr 2023 07:29:51 +0000 (00:29 -0700)]
[IR] Drop unnecessary const from a return type (NFC)

Identified with readability-const-return-type.

18 months ago[llvm] Apply fixes from readability-redundant-control-flow (NFC)
Kazu Hirata [Sun, 16 Apr 2023 07:13:46 +0000 (00:13 -0700)]
[llvm] Apply fixes from readability-redundant-control-flow (NFC)

18 months ago[clang-tools-extra] Use llvm::is_contained (NFC)
Kazu Hirata [Sun, 16 Apr 2023 05:39:17 +0000 (22:39 -0700)]
[clang-tools-extra] Use llvm::is_contained (NFC)

18 months ago[RISCV] Fix a crash in RISCVGatherScatterLowering
Philip Reames [Sun, 16 Apr 2023 04:26:07 +0000 (21:26 -0700)]
[RISCV] Fix a crash in RISCVGatherScatterLowering

We were assuming that the constant must always be fixed length when this is not required.  Such code is unlikely after optimization, which is why we didn't see this previously.

18 months ago[JITLink][ELF][x86-64] Implement ELF::R_X86_64_NONE.
Lang Hames [Sun, 16 Apr 2023 03:13:38 +0000 (03:13 +0000)]
[JITLink][ELF][x86-64] Implement ELF::R_X86_64_NONE.

R_X86_64_NONE is a no-op, so we just need to return from addSingleRelocation
early.

18 months ago[LoongArch] Use empty debug location for register spill/reload
Ben Shi [Sat, 15 Apr 2023 04:44:30 +0000 (12:44 +0800)]
[LoongArch] Use empty debug location for register spill/reload

Spill/reload instructions are automatically generated by the
compiler and have no relation to the original source code. So it
would be better to not attach any debug location to them.
The X86/AArch64/ARM/Thumb backends all follow this way.

Reviewed By: xen0n

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

18 months ago[JITLink][x86-64] Add x86_64::Pointer8 edge kind, ELF::R_X86_64_8 reloc support.
Lang Hames [Sun, 16 Apr 2023 02:35:36 +0000 (02:35 +0000)]
[JITLink][x86-64] Add x86_64::Pointer8 edge kind, ELF::R_X86_64_8 reloc support.

This commit adds an x86-64 Pointer8 edge kind (8-bit pointer), and uses it to
implement support for the ELF::R_X86_64_8 relocation kind.

18 months ago[JITLink][ELF][x86-64] Replace R_X86_64_32 yaml testcase with asm version.
Lang Hames [Sun, 16 Apr 2023 02:07:31 +0000 (02:07 +0000)]
[JITLink][ELF][x86-64] Replace R_X86_64_32 yaml testcase with asm version.

The assembly version of this testcase is shorter and easier to read.

18 months ago[JITLink][x86-64] Implement ELF::R_X86_64_16.
Lang Hames [Sun, 16 Apr 2023 01:59:00 +0000 (01:59 +0000)]
[JITLink][x86-64] Implement ELF::R_X86_64_16.

We already had an x86_64::Pointer16 edge kind courtesy of Sunho's COFF/x86-64
work, it just needed to be wired up.

18 months ago[JITLink][aarch64] Update aarch64 test names
Lang Hames [Sat, 15 Apr 2023 20:13:21 +0000 (20:13 +0000)]
[JITLink][aarch64] Update aarch64 test names

Tests in test/ExecutionEngine/JITLink/AArch64 are for aarch64 only, so we don't
need to repeat 'aarch64' / 'arm64' in the individual test names.

Commit 8ad75c10372 made a similar change for the x86-64 tests.

18 months ago[clang-repl] JITTargetAddress --> ExecutorAddr, NFC
Jun Zhang [Sat, 15 Apr 2023 16:38:38 +0000 (00:38 +0800)]
[clang-repl] JITTargetAddress --> ExecutorAddr, NFC

Most of Orc and JITLink are movinng away from JITTargetAddress and
use ExecutorAddr instead.

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D148434

18 months ago[mlir][tensor][bufferize] Fix dealloc placement in scf.forall op
Matthias Springer [Sat, 15 Apr 2023 03:18:56 +0000 (12:18 +0900)]
[mlir][tensor][bufferize] Fix dealloc placement in scf.forall op

The terminator of this op is special: it does not just yield a value,
but bufferizes to a memcpy. This requires special treatment to make sure
that deallocs are placed after the memcpy. (By default, deallocs are
placed right before the terminator.)

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

18 months ago[mlir][sparse][gpu] generate single module, unique kernel names
Aart Bik [Sat, 15 Apr 2023 01:30:29 +0000 (18:30 -0700)]
[mlir][sparse][gpu] generate single module, unique kernel names

This fixes a TODO in the first version.

Reviewed By: Peiming

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

18 months ago[FuzzMutate] Update unit testing
Peter Rong [Sat, 15 Apr 2023 23:39:01 +0000 (16:39 -0700)]
[FuzzMutate] Update unit testing

There are some typos in the previous patch e0117a3efacf that woulc break unit test and CI.
These typos are fixed now.

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
18 months ago[FuzzMutate] RandomIRBuilder has more source and sink type now.
Peter Rong [Tue, 13 Dec 2022 03:04:41 +0000 (19:04 -0800)]
[FuzzMutate] RandomIRBuilder has more source and sink type now.

Source and Sink are required when generating a new instruction.
(Term defined by previous author, in LLVM terms it's probably Use and User.)
Previously, only instructions in the same block is considered when taking source and sink.

In this patch, more source and sink types are considered.
For source, we have SrcFromInstInCurBlock, FunctionArgument, InstInDominator, SrcFromGlobalVariable, and NewConstOrStack.
For sink, we have SinkToInstInCurBlock, PointersInDominator, InstInDominatee, NewStore, and SinkToGlobalVariable.

A unit test to make sure source always dominates an instruction, and the instruction always dominates the sink is included.

Reviewed By: arsenm

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

18 months ago[clang-tidy] Fix crash in --dump-config
Nathan James [Sat, 15 Apr 2023 21:58:15 +0000 (22:58 +0100)]
[clang-tidy] Fix crash in --dump-config

Fixes a crash in dump-config when checks emit warnings trying to read the config

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

Co-authored-by: Piotr Zegar <me@piotrzegar.pl>
Reviewed By: PiotrZSL

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

18 months ago[InstCombine] Precommit a test
Kazu Hirata [Sat, 15 Apr 2023 21:34:40 +0000 (14:34 -0700)]
[InstCombine] Precommit a test

This patch precommits a test for:

https://github.com/llvm/llvm-project/issues/61650

18 months agoUse isNegative (NFC)
Kazu Hirata [Sat, 15 Apr 2023 21:26:24 +0000 (14:26 -0700)]
Use isNegative (NFC)

18 months ago[lldb] Use StringMap::contains (NFC)
Kazu Hirata [Sat, 15 Apr 2023 21:22:13 +0000 (14:22 -0700)]
[lldb] Use StringMap::contains (NFC)

18 months ago[Target] Use range-based for loops (NFC)
Kazu Hirata [Sat, 15 Apr 2023 21:14:56 +0000 (14:14 -0700)]
[Target] Use range-based for loops (NFC)

18 months ago[JITLink][X86] Rename X86 test directory to x86-64, update test names.
Lang Hames [Sat, 15 Apr 2023 18:35:11 +0000 (18:35 +0000)]
[JITLink][X86] Rename X86 test directory to x86-64, update test names.

Tests in test/ExecutionEngine/JITLink/X86 were for x86-64 only (never i386) so
it makes sense to name the test directory x86-64, and drop x86-64 from the
individual test names.

18 months ago[InstCombine] Generate better code for std::bit_floor from libstdc++
Kazu Hirata [Sat, 15 Apr 2023 18:32:33 +0000 (11:32 -0700)]
[InstCombine] Generate better code for std::bit_floor from libstdc++

Without this patch, std::bit_floor<uint32_t> in libstdc++ is compiled
as:

  %eq0 = icmp eq i32 %x, 0
  %lshr = lshr i32 %x, 1
  %ctlz = tail call i32 @llvm.ctlz.i32(i32 %lshr, i1 false)
  %sub = sub i32 32, %ctlz
  %shl = shl i32 1, %sub
  %sel = select i1 %eq0, i32 0, i32 %shl

With this patch:

  %eq0 = icmp eq i32 %x, 0
  %ctlz = call i32 @llvm.ctlz.i32(i32 %x, i1 false)
  %lshr = lshr i32 -2147483648, %1
  %sel = select i1 %eq0, i32 0, i32 %lshr

This patch recognizes the specific pattern emitted for std::bit_floor
in libstdc++.

https://alive2.llvm.org/ce/z/piMdFX

This patch fixes:

https://github.com/llvm/llvm-project/issues/61183

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

18 months agoRevert "Revert "Revert "[CMake] Bumps minimum version to 3.20.0."""
Mark de Wever [Sat, 15 Apr 2023 18:12:24 +0000 (20:12 +0200)]
Revert "Revert "Revert "[CMake] Bumps minimum version to 3.20.0."""

This reverts commit 1ef4c3c859728008cf707cad8d67f45ae5070ae1.

Two buildbots still haven't been updated.

18 months ago[JITLink][ELF][x86-64] Don't use intermediate edge-kinds in ELF/x86-64 backend.
Lang Hames [Sat, 15 Apr 2023 04:50:49 +0000 (04:50 +0000)]
[JITLink][ELF][x86-64] Don't use intermediate edge-kinds in ELF/x86-64 backend.

The mapping from ELF relocation types to JITLink x86-64 edge kinds is 1-1, so
we don't need the intermediate step.

18 months ago[clang][NFC] Fix DR test ordering
Vlad Serebrennikov [Sat, 15 Apr 2023 15:24:35 +0000 (18:24 +0300)]
[clang][NFC] Fix DR test ordering

Some C++ DR tests are disrupting the usual ascending order, introducing confusion, and making people put new tests in the wrong place (myself included). This change affects 15 tests out of roughly 700.

18 months ago[clang-tidy] Fix cppcoreguidelines-narrowing-conversions false positive
Nathan James [Sat, 15 Apr 2023 14:51:26 +0000 (14:51 +0000)]
[clang-tidy] Fix cppcoreguidelines-narrowing-conversions false positive

Fix https://llvm.org/PR49498.
The check notices 2 sides of a conditional operator have types with a different constness and so tries to examine the implicit cast.
As one side is infinity, the float narrowing detection sees when its casted to a double(which it already was) it thinks the result is out of range.

I've fixed this by just disregarding expressions where the builtin type(without quals) match as no conversion would take place.

However this has opened a can of worms. Currenty `float a = std::numeric_limits<double>::infinity();` is marked as narrowing.
Whats more suspicious is `double a = std::numeric_limits<float>::infinity();` is also marked as narrowing.
It could be argued `double inf -> float inf` is narrowing, but `float inf -> double inf` definitely isnt.

Reviewed By: carlosgalvezp

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

18 months ago[NFC][libc++] Removes incorrect sliceExpr friend.
Mark de Wever [Sat, 15 Apr 2023 15:01:38 +0000 (17:01 +0200)]
[NFC][libc++] Removes incorrect sliceExpr friend.

There is no type named sliceExpr, so it's likely a misspelling of
either slice_array or __slice_expr. Neither of which appear to
need the friend declaration.

This may indicate a unimplemented bit of `<valarray`, but ¯\_(ツ)_/¯
Nobody uses it anyway.

(Commit message provided by @EricWF.)

This reverts commit e13c43b229527234ec99f7f03aff3e1560c259c8.

18 months agoRevert "[NFC][libc++] Removes sliceExpr friend."
Mark de Wever [Sat, 15 Apr 2023 14:56:50 +0000 (16:56 +0200)]
Revert "[NFC][libc++] Removes sliceExpr friend."

This reverts commit d5193e34b81fb3e9c27aea541516112d8a5f708d.

Reverted at @EricWF's request so it can be relanded with a better commit
message.

18 months ago[clang-tidy][NFC] Fix format of header file comment in MisleadingCaptureDefaultByValu...
Carlos Galvez [Sat, 15 Apr 2023 14:49:01 +0000 (14:49 +0000)]
[clang-tidy][NFC] Fix format of header file comment in MisleadingCaptureDefaultByValueCheck.h

18 months agoRevert "[clang-tidy] Add misc-header-include-cycle check"
Piotr Zegar [Sat, 15 Apr 2023 13:16:35 +0000 (13:16 +0000)]
Revert "[clang-tidy] Add misc-header-include-cycle check"

This reverts commit 9ece8753d5e6f49c31c2d988ef69225c036b25e0.

18 months ago[Matrix] Split off transpose + dot product tests.
Florian Hahn [Sat, 15 Apr 2023 13:06:46 +0000 (14:06 +0100)]
[Matrix] Split off transpose + dot product tests.

18 months ago[clang-tidy] Add misc-header-include-cycle check
Piotr Zegar [Sat, 15 Apr 2023 12:39:25 +0000 (12:39 +0000)]
[clang-tidy] Add misc-header-include-cycle check

Check detects cyclic #include dependencies between user-defined headers.

Reviewed By: njames93

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

18 months ago[libc] Add `fetch_or` to the atomic interface
Joseph Huber [Tue, 11 Apr 2023 20:08:59 +0000 (15:08 -0500)]
[libc] Add `fetch_or` to the atomic interface

Summary:
This patch adds `fetch_or`. It is mainly useful for querying and set a
bit's status without using the more expensive `exchange` functions.

18 months ago[clang-tidy][NFC] Improve doc of cppcoreguidelines-misleading-capture-default-by...
Carlos Galvez [Sat, 15 Apr 2023 10:16:49 +0000 (10:16 +0000)]
[clang-tidy][NFC] Improve doc of cppcoreguidelines-misleading-capture-default-by-value

Also fix ordering in Release Notes.

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

18 months ago[NFC][libc++] Removes sliceExpr friend.
Mark de Wever [Fri, 14 Apr 2023 18:00:51 +0000 (20:00 +0200)]
[NFC][libc++] Removes sliceExpr friend.

The class is never defined. This was discovered while validating modules
in libc++.

Reviewed By: #libc, philnik

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

18 months agoRevert "Revert "[CMake] Bumps minimum version to 3.20.0.""
Mark de Wever [Sat, 15 Apr 2023 11:12:04 +0000 (13:12 +0200)]
Revert "Revert "[CMake] Bumps minimum version to 3.20.0.""

This reverts commit 92523a35a827539db8557bbc3ecab7f9ea3f6ade.

Reland to see whether CIs are updated.

18 months ago[libc++] Removes Clang 14 support.
Mark de Wever [Fri, 14 Apr 2023 18:12:27 +0000 (20:12 +0200)]
[libc++] Removes Clang 14 support.

Per our policy we only support the last two releases.

Reviewed By: #libc, EricWF, philnik

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

18 months ago[clang-tidy] Fix typedefs handling in bugprone-dangling-handle
Piotr Zegar [Sat, 15 Apr 2023 10:29:38 +0000 (10:29 +0000)]
[clang-tidy] Fix typedefs handling in bugprone-dangling-handle

Using 'hasUnqualifiedDesugaredType' to skip all type aliases when
checking for handle.

Fixes #38779

Reviewed By: carlosgalvezp

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

18 months ago[gn build] Port eedbe81b1c6d
LLVM GN Syncbot [Sat, 15 Apr 2023 10:21:07 +0000 (10:21 +0000)]
[gn build] Port eedbe81b1c6d

18 months ago[clang-tidy] Exclude template instantiations in modernize-use-override
Piotr Zegar [Sat, 15 Apr 2023 10:07:45 +0000 (10:07 +0000)]
[clang-tidy] Exclude template instantiations in modernize-use-override

Added IgnoreTemplateInstantiations option to modernize-use-override
check. Allows to ignore virtual function overrides that are part of
template instantiations. This can be useful in cases where the use
of the "override" keyword is not appropriate or causes issues with
template specialization.

Fixes #38276.

Reviewed By: carlosgalvezp

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

18 months ago[clang] Mark CWG2331 as N/A
Vlad Serebrennikov [Sat, 15 Apr 2023 10:15:05 +0000 (13:15 +0300)]
[clang] Mark CWG2331 as N/A

[[https://wg21.link/p1787 | P1787]]: CWG2331 is resolved by defining lookup from complete-class contexts and out-of-line member definitions.
Wording: The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise. ([class.member.lookup]/4)

Reviewed By: #clang-language-wg, shafik

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