platform/upstream/llvm.git
2 years ago[DAG] getFreeze()/getNode() - account for operand depth when calling isGuaranteedNotT...
Simon Pilgrim [Mon, 5 Sep 2022 10:46:38 +0000 (11:46 +0100)]
[DAG] getFreeze()/getNode() - account for operand depth when calling isGuaranteedNotToBeUndefOrPoison (PR57554)

Similar to #57402 - we were calling isGuaranteedNotToBeUndefOrPoison on the freeze operand (with Depth = 0), but wasn't accounting for the fact that a later isGuaranteedNotToBeUndefOrPoison assertion will call from the new node (with Depth = 0 as well) - which will then recursively call isGuaranteedNotToBeUndefOrPoison for its operands with Depth = 1

Fixes #57554

2 years agoAdd ArithBuilder::sub, make add, mul work with IndexTypes.
Johannes Reifferscheid [Mon, 5 Sep 2022 09:25:58 +0000 (11:25 +0200)]
Add ArithBuilder::sub, make add, mul work with IndexTypes.

sgt and slt already worked with IndexTypes, the others did not.

Reviewed By: pifon2a

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

2 years ago[gn build] Port d5e26775d089
LLVM GN Syncbot [Mon, 5 Sep 2022 10:39:22 +0000 (10:39 +0000)]
[gn build] Port d5e26775d089

2 years ago[libc++] Granularize the rest of memory
Nikolas Klauser [Sun, 4 Sep 2022 22:01:15 +0000 (00:01 +0200)]
[libc++] Granularize the rest of memory

Reviewed By: ldionne, #libc

Spies: vitalybuka, paulkirth, libcxx-commits, mgorny

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

2 years ago[clang-format] Concepts: allow identifiers after negation
Emilia Dreamer [Mon, 5 Sep 2022 10:33:59 +0000 (12:33 +0200)]
[clang-format] Concepts: allow identifiers after negation

Previously, the formatter would refuse to treat identifiers within a
compound concept definition as actually part of the definition, if
they were after the negation operator !. It is now made consistent
with the likes of && and ||.

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

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

2 years ago[clang-format] Allow `throw` to be a keyword in front of casts
Emilia Dreamer [Mon, 5 Sep 2022 10:32:40 +0000 (12:32 +0200)]
[clang-format] Allow `throw` to be a keyword in front of casts

This makes throw more similar to return. However, unlike return,
it has to more strict as to not remove spaces after usages of throw as
a (deprecated) exception specifier.

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

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

2 years ago[clang-format] Don't put `noexcept` on empty line following constructor
Emilia Dreamer [Mon, 5 Sep 2022 10:19:31 +0000 (12:19 +0200)]
[clang-format] Don't put `noexcept` on empty line following constructor

With the AlwaysBreakTemplateDeclarations option, having a constructor
template for a type consisting of all-uppercase letters with a
noexcept specifier would put said noexcept specifier on its own blank
line.

This is because the all-uppercase type is understood as a macro-like
attribute (such as DEPRECATED()), and noexcept is seen as the
declaration. However, noexcept is a keyword and cannot be an
identifier on its own.

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

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

2 years ago[ubsan-minimal] Report the address of an error
Igor Kudrin [Mon, 15 Aug 2022 18:24:08 +0000 (22:24 +0400)]
[ubsan-minimal] Report the address of an error

This implements a FIXME in the runtime library and adds printing the
address at the end of the message as "by 0x123abc". The buffer for the
message is allocated on the stack in a handler, so the stack memory
consumption is slightly increased. No additional external dependencies
are added.

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

2 years ago[VPlan] Move VPWidenCallRecipe to VPlanRecipes.cpp (NFC).
Florian Hahn [Mon, 5 Sep 2022 09:48:29 +0000 (10:48 +0100)]
[VPlan] Move VPWidenCallRecipe to VPlanRecipes.cpp (NFC).

Depends on D132585.

Reviewed By: Ayal

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

2 years ago[mlir][tensor] Add gather/scatter op definitions to the tensor dialect.
Nicolas Vasilache [Thu, 21 Jul 2022 11:38:46 +0000 (04:38 -0700)]
[mlir][tensor] Add gather/scatter op definitions to the tensor dialect.

Gather/Scatter are examined from first principles in light of our recent progress on tensor-based codegen
and in-place bufferization.

In the future, lowering of these abstractions to operate **inplace** on buffers
will likely require a more powerful buffer representation than strided memref.

General context: https://discourse.llvm.org/t/rfc-structured-codegen-beyond-rectangular-arrays/64707
Relevant TL;DR parts of the proposal:
- gather: https://discourse.llvm.org/t/rfc-structured-codegen-beyond-rectangular-arrays/64707#proposal-gatherop-and-friends-10
- need for more expressive types: https://discourse.llvm.org/t/rfc-structured-codegen-beyond-rectangular-arrays/64707#proposal-bufferization-copy-view-and-the-need-for-more-expressive-types-12
- jagged buffer discussion: https://discourse.llvm.org/t/rfc-structured-codegen-beyond-rectangular-arrays/64707#proposal-first-class-jagged-buffer-13

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

2 years agoDriver tests: remove `REQUIRES: x86-registered-target` and set `--sysroot=""` to...
Ying Yi [Fri, 2 Sep 2022 09:25:34 +0000 (10:25 +0100)]
Driver tests: remove `REQUIRES: x86-registered-target` and set `--sysroot=""` to support clang with `DEFAULT_SYSROOT`.

When testing clang that has been compiled with -DDEFAULT_SYSROOT set to some path, ps4-ps5-header-search.c would fail.

The test needs to be updated.

    1. Remove unnecessary REQUIRES: x86-registered-target.
    2. Override sysroot to be empty string for the test to succeed when clang is configured with DEFAULT_SYSROOT.

2 years ago[clang] Fix crash when parsing scanf format string with missing arguments
serge-sans-paille [Fri, 2 Sep 2022 11:36:08 +0000 (13:36 +0200)]
[clang] Fix crash when parsing scanf format string with missing arguments

When parsing a format string with less argument than specified, one should check
argument access because there may be no such argument.

This fixes #57517

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

2 years ago[bazel] NFC: Move licenses declaration from package to function.
Christian Sigg [Mon, 5 Sep 2022 08:43:48 +0000 (10:43 +0200)]
[bazel] NFC: Move licenses declaration from package to function.

The `licences` attribute is deprecated, see https://docs.bazel.build/versions/4.0.0/be/common-definitions.html#common-attributes.

2 years ago[NFC][TypePromotion] Add test
Samuel Parker [Mon, 5 Sep 2022 07:58:16 +0000 (08:58 +0100)]
[NFC][TypePromotion] Add test

2 years agoFix build error in StmtPrinterTest.cpp
Nathan Ridge [Mon, 5 Sep 2022 07:48:17 +0000 (03:48 -0400)]
Fix build error in StmtPrinterTest.cpp

2 years ago[LICM] Separate check for writability and thread-safety (NFCI)
Nikita Popov [Mon, 5 Sep 2022 07:39:59 +0000 (09:39 +0200)]
[LICM] Separate check for writability and thread-safety (NFCI)

This used a single check to make sure that the object is both
writable and thread-local. Separate them out to make the
deficiencies in the current code more obvious.

2 years ago[clangd] Avoid crash when printing call to string literal operator template
Nathan Ridge [Mon, 29 Aug 2022 08:19:19 +0000 (04:19 -0400)]
[clangd] Avoid crash when printing call to string literal operator template

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

2 years ago[clang-format][docs] Fix incorrect 'clang-format 4' option markers
Krystian Kuzniarek [Sun, 4 Sep 2022 20:06:42 +0000 (22:06 +0200)]
[clang-format][docs] Fix incorrect 'clang-format 4' option markers

Introduced by 23a5090c6, some style option markers indicated
'clang-format 4', though their respective options were available in
earlier releases.

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

2 years ago[Coroutines] Use LookupAllocationFunction to find allocation functions for coroutines...
Chuanqi Xu [Mon, 5 Sep 2022 06:17:58 +0000 (14:17 +0800)]
[Coroutines] Use LookupAllocationFunction to find allocation functions for coroutines consistently

Previously we may call Sema::FindAllocationFunctions directly to lookup
allocation functions directly instead of using our wrapped lambda
LookupAllocationFunction, which is slightly incosnsistent. It will be
helpful to refactor this for further changes.

Also previously, when we lookup 'operator new(std::size_t, std::nothrow_t)' in
case we found `get_­return_­object_­on_­allocation_­failure` in the
promise_type, the compiler will try to look at the allocation function
in promise_type. However, this is not wanted actually. According to
[dcl.fct.def.coroutine]p10:

> if a global allocation function is selected, the
> ::operator new(size_­t, nothrow_­t) form is used.

So we should only lookup for `::operator (size_t, nothrow_t)` for the
global allocation function. For the allocation function in the
promise_type, the requirement is that it shouldn't throw, which has
already been checked.

Given users generally include headers from standard libs so it will
generally include the <new> header, so this change should be a trivial
one and shouldn't affect almost any user.

2 years ago[ELF][test] --gc-sections: test SHT_FINI_ARRAY is retained
Fangrui Song [Mon, 5 Sep 2022 07:03:40 +0000 (00:03 -0700)]
[ELF][test] --gc-sections: test SHT_FINI_ARRAY is retained

2 years ago[ELF] MarkLive: remove dead code from D24750. NFC
Fangrui Song [Mon, 5 Sep 2022 07:01:09 +0000 (00:01 -0700)]
[ELF] MarkLive: remove dead code from D24750. NFC

2 years ago[LoongArch] Add more fixups and relocations
wanglei [Mon, 5 Sep 2022 06:27:36 +0000 (14:27 +0800)]
[LoongArch] Add more fixups and relocations

This patch makes the assembler support all modifiers defined in gnu-as.
Also changes some diagnostic information.

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

2 years ago[ASTReader] Fix -Wunused-private-field in non-assertion builds after D128490. NFC
Fangrui Song [Mon, 5 Sep 2022 06:48:54 +0000 (23:48 -0700)]
[ASTReader] Fix -Wunused-private-field in non-assertion builds after D128490. NFC

2 years ago[ELF] Reuse one RelocationScanner to scan all sections. NFC
Fangrui Song [Mon, 5 Sep 2022 06:12:26 +0000 (23:12 -0700)]
[ELF] Reuse one RelocationScanner to scan all sections. NFC

2 years ago[TargetLowering] Use ComputeMaxSignificantBits instead of ComputeNumSignBits in expan...
Craig Topper [Mon, 5 Sep 2022 05:20:52 +0000 (22:20 -0700)]
[TargetLowering] Use ComputeMaxSignificantBits instead of ComputeNumSignBits in expandMUL_LOHI. NFC

The way ComputeNumSignBits was being used was only correct if
OuterBitSize is exactly 2x InnerBitSize. Which is always true,
but not obviously so. Comparing ComputeMaxSignificantBits to
InnerBitSize feels more correct.

2 years ago[ELF] Move scanRelocations into Relocations.cpp. NFC
Fangrui Song [Mon, 5 Sep 2022 04:31:18 +0000 (21:31 -0700)]
[ELF] Move scanRelocations into Relocations.cpp. NFC

2 years ago[ELF] Relocations: set hasDirectReloc only if not ifunc. NFC
Fangrui Song [Mon, 5 Sep 2022 04:30:19 +0000 (21:30 -0700)]
[ELF] Relocations: set hasDirectReloc only if not ifunc. NFC

2 years ago[X86] Pre-commit tests for D130862. NFC
Craig Topper [Mon, 5 Sep 2022 04:18:54 +0000 (21:18 -0700)]
[X86] Pre-commit tests for D130862. NFC

2 years ago[TargetLowering] Use getShiftAmountConstant. NFC
Craig Topper [Mon, 5 Sep 2022 02:42:14 +0000 (19:42 -0700)]
[TargetLowering] Use getShiftAmountConstant. NFC

2 years ago[NFC] fix incorrect indentation in docs
Chuanqi Xu [Mon, 5 Sep 2022 03:04:38 +0000 (11:04 +0800)]
[NFC] fix incorrect indentation in docs

2 years ago[LoongArch] Add codegen support for fcopysign
gonglingqin [Mon, 5 Sep 2022 02:27:54 +0000 (10:27 +0800)]
[LoongArch] Add codegen support for fcopysign

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

2 years ago[InstCombine] Precommit tests for smul_with_overflow. nfc
Chenbing Zheng [Mon, 5 Sep 2022 02:41:58 +0000 (10:41 +0800)]
[InstCombine] Precommit tests for smul_with_overflow. nfc

2 years ago[LLVM][docs] Update CMake.rst to follow the upgrade to C++ 17 [NFC]
ZHU Zijia [Mon, 5 Sep 2022 01:56:04 +0000 (09:56 +0800)]
[LLVM][docs] Update CMake.rst to follow the upgrade to C++ 17 [NFC]

Update `CMake.rst` to follow the upgrade to C++ 17 in LLVM.

Reviewed By: thieta, MaskRay

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

2 years ago[ELF] Change a DSO warning to errorOrWarn
Fangrui Song [Mon, 5 Sep 2022 00:43:39 +0000 (17:43 -0700)]
[ELF] Change a DSO warning to errorOrWarn

2 years ago[ELF] Use stOther to track visibility
Fangrui Song [Mon, 5 Sep 2022 00:27:35 +0000 (17:27 -0700)]
[ELF] Use stOther to track visibility

This simplifies SymbolTableSection<ELFT>::writeTo. Add dsoProtected to be used
in canDefineSymbolInExecutable and get the side benefit that the protected DSO
preemption diagnostic is clearer.

2 years ago[ELF] Simplify visibility computation. NFC
Fangrui Song [Sun, 4 Sep 2022 23:38:27 +0000 (16:38 -0700)]
[ELF] Simplify visibility computation. NFC

2 years ago[ELF] SharedFile::parse: make versym handling more precise
Fangrui Song [Sun, 4 Sep 2022 23:21:19 +0000 (16:21 -0700)]
[ELF] SharedFile::parse: make versym handling more precise

VER_NDX_LOCAL/VER_NDX_GLOBAL cannot be hidden, so we can compare them with
versyms[i] instead of versyms[i] & ~VERSYM_HIDDEN. In the presence of an error,
we can suppress addSymbol.

2 years ago[ELF] Clarify a workaround for mips GNU ld<2.31
Fangrui Song [Sun, 4 Sep 2022 22:38:52 +0000 (15:38 -0700)]
[ELF] Clarify a workaround for mips GNU ld<2.31

2 years agoRevert "[llvm] Use range-based for loops (NFC)"
Vitaly Buka [Sun, 4 Sep 2022 21:52:04 +0000 (14:52 -0700)]
Revert "[llvm] Use range-based for loops (NFC)"

range-based loop should not be used here, as
fixupImmediateBr push_backs into the container.

http://lab.llvm.org/buildbot/#/builders/168
http://lab.llvm.org/buildbot/#/builders/74
http://lab.llvm.org/buildbot/#/builders/5
http://lab.llvm.org/buildbot/#/builders/239
http://lab.llvm.org/buildbot/#/builders/237
http://lab.llvm.org/buildbot/#/builders/236

This reverts commit fedc59734a44ef7b62c5f389b0cdffd02264b2a9.

2 years ago[ELF] Remove unneeded @@ check. NFC
Fangrui Song [Sun, 4 Sep 2022 22:15:39 +0000 (15:15 -0700)]
[ELF] Remove unneeded @@ check. NFC

2 years ago[ELF] Remove a redundant identify_magic call. NFC
Fangrui Song [Sun, 4 Sep 2022 21:44:58 +0000 (14:44 -0700)]
[ELF] Remove a redundant identify_magic call. NFC

2 years ago[LCSSA] Update unreachable uses with poison.
Florian Hahn [Sun, 4 Sep 2022 21:22:36 +0000 (22:22 +0100)]
[LCSSA] Update unreachable uses with poison.

Users of LCSSA may not expect non-phi uses when checking the uses
outside a loop, which may cause crashes. This is due to the fact that we
do not update uses in unreachable blocks.

To ensure all reachable uses outside the loop are phis, update uses in
unreachable blocks to use poison in dead code.

Fixes #57508.

2 years ago[LV] Update test use opaque pointers, regenerate checks.
Florian Hahn [Sun, 4 Sep 2022 21:18:57 +0000 (22:18 +0100)]
[LV] Update test use opaque pointers, regenerate checks.

Modernize the test to make it easier to extend in a follow-up patch.

2 years ago[LCSSA] Update test use opaque pointers, regenerate checks.
Florian Hahn [Sun, 4 Sep 2022 21:07:19 +0000 (22:07 +0100)]
[LCSSA] Update test use opaque pointers, regenerate checks.

Modernize the test to make it easier to extend in a follow-up patch.

2 years ago[gn build] Port a46154cb1cd0
LLVM GN Syncbot [Sun, 4 Sep 2022 21:07:13 +0000 (21:07 +0000)]
[gn build] Port a46154cb1cd0

2 years ago[analyzer] Warn if the size of the array in `new[]` is undefined
isuckatcs [Tue, 23 Aug 2022 07:21:16 +0000 (09:21 +0200)]
[analyzer] Warn if the size of the array in `new[]` is undefined

This patch introduces a new checker, called NewArraySize checker,
which detects if the expression that yields the element count of
the array in new[], results in an Undefined value.

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

2 years ago[lld-macho] Change constant std::vector to std::array (NFC)
Daniel Bertalan [Sun, 4 Sep 2022 20:43:02 +0000 (22:43 +0200)]
[lld-macho] Change constant std::vector to std::array (NFC)

2 years ago[CostModel][X86] Add CostKinds handling for sqrt intrinsicc
Simon Pilgrim [Sun, 4 Sep 2022 17:39:21 +0000 (18:39 +0100)]
[CostModel][X86] Add CostKinds handling for sqrt intrinsicc

This was achieved using the 'cost-tables vs llvm-mca' script from D103695

Some of the znver1/znver2 latency/throughput numbers were really weird (some copy+paste afaict) - I've used the numbers from the AMD SoG, which roughly match the 'worst case' range value from Agner

2 years ago[CostModel][X86] getTypeBasedIntrinsicInstrCost - convert to CostKindTblEntry
Simon Pilgrim [Sun, 4 Sep 2022 16:59:08 +0000 (17:59 +0100)]
[CostModel][X86] getTypeBasedIntrinsicInstrCost - convert to CostKindTblEntry

Begin the refactoring to use CostKindTblEntry and return real latency/codesize/sizelatency costs instead of reusing the throughput numbers

2 years ago[PhaseOrdering] Move X86 unsigned-multiply-overflow-check.ll test under X86
Simon Pilgrim [Sun, 4 Sep 2022 16:54:32 +0000 (17:54 +0100)]
[PhaseOrdering] Move X86 unsigned-multiply-overflow-check.ll test under X86

2 years agoRevert rG06e73626cf0fc33b025a0f98f1eee4a302279982 "[CostModel][X86] getTypeBasedIntri...
Simon Pilgrim [Sun, 4 Sep 2022 16:51:11 +0000 (17:51 +0100)]
Revert rG06e73626cf0fc33b025a0f98f1eee4a302279982 "[CostModel][X86] getTypeBasedIntrinsicInstrCost - convert to CostKindTblEntry"

Some arm buildbots are complaining about a phase ordering test failure in unsigned-multiply-overflow-check.ll - I guess this test needs making x86 specific first

2 years ago[Libfuzzer] Include signal.h for SIGINT
Krzysztof Parzyszek [Sun, 4 Sep 2022 16:28:15 +0000 (11:28 -0500)]
[Libfuzzer] Include signal.h for SIGINT

Or else compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp fails to compile
on FreeBSD.

2 years ago[CostModel][X86] getTypeBasedIntrinsicInstrCost - convert to CostKindTblEntry
Simon Pilgrim [Sun, 4 Sep 2022 16:28:41 +0000 (17:28 +0100)]
[CostModel][X86] getTypeBasedIntrinsicInstrCost - convert to CostKindTblEntry

Begin the refactoring to use CostKindTblEntry and return real latency/codesize/sizelatency costs instead of reusing the throughput numbers

2 years ago[test] pre-submission for the following SimpleLoopUnswitch update
Ruobing Han [Sun, 4 Sep 2022 15:49:51 +0000 (11:49 -0400)]
[test] pre-submission for the following SimpleLoopUnswitch update

2 years ago[flang][OpenMP] Handle private/firstprivate clauses on sections construct
Nimish Mishra [Sun, 4 Sep 2022 20:15:54 +0000 (01:45 +0530)]
[flang][OpenMP] Handle private/firstprivate clauses on sections construct

This patch adds private/firstprivate support for sections construct. For
a source like the following:

```
!$omp sections private(x) firstprivate(y)
    !$omp section
        <block of code>
    !$omp section
        <block of code>
!$omp end sections
```
...privatization proceeds to privatize `x` and `y` accordingly
inside each of the generated `omp.section` operations.

Reviewed By: peixin

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

2 years ago[OpenMP] Silence unused variable warning in release builds
Benjamin Kramer [Sun, 4 Sep 2022 13:19:48 +0000 (15:19 +0200)]
[OpenMP] Silence unused variable warning in release builds

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:3397:27: warning: unused variable 'SV' [-Werror]
  for (const llvm::Value *SV : StoreValues)
                            ^

2 years ago[CostModel][X86] Remove redundant AVX512 v64i8 shift costs
Simon Pilgrim [Sun, 4 Sep 2022 13:06:26 +0000 (14:06 +0100)]
[CostModel][X86] Remove redundant AVX512 v64i8 shift costs

These are handled earlier (and more accurately) in AVX512BWShiftCostTable

2 years ago[CostModel][X86] Add CostKinds handling for mul ops
Simon Pilgrim [Sun, 4 Sep 2022 10:58:53 +0000 (11:58 +0100)]
[CostModel][X86] Add CostKinds handling for mul ops

This was achieved using the 'cost-tables vs llvm-mca' script D103695

Also fix a missing pmullw v16i16 half-rate throughput as znver1 double-pumps - matches numbers from AMD SoG + Agner

2 years agoApply clang-tidy fixes for performance-for-range-copy in TilingInterfaceImpl.cpp...
Mehdi Amini [Mon, 29 Aug 2022 10:54:38 +0000 (10:54 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in TilingInterfaceImpl.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in Tiling.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 10:53:42 +0000 (10:53 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in Tiling.cpp (NFC)

2 years ago[CostModel][X86] Add vector shift test coverage for codesize/latency/size-latency...
Simon Pilgrim [Sat, 3 Sep 2022 18:47:39 +0000 (19:47 +0100)]
[CostModel][X86] Add vector shift test coverage for codesize/latency/size-latency cost kinds

2 years ago[mlir:vscode] Fix bazel build after commit f7b8a70
Christian Sigg [Sun, 4 Sep 2022 09:37:06 +0000 (11:37 +0200)]
[mlir:vscode] Fix bazel build after commit f7b8a70

2 years ago[lld-macho][test] Correct a mismatched adrp-add pair
Daniel Bertalan [Sun, 4 Sep 2022 07:52:32 +0000 (09:52 +0200)]
[lld-macho][test] Correct a mismatched adrp-add pair

2 years ago[clang] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:27 +0000 (23:27 -0700)]
[clang] Qualify auto in range-based for loops (NFC)

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:25 +0000 (23:27 -0700)]
[llvm] Use range-based for loops (NFC)

Identified with modernize-loop-convert.

2 years ago[ADT] Use std::tuple_element_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:23 +0000 (23:27 -0700)]
[ADT] Use std::tuple_element_t (NFC)

2 years ago[llvm] Use std::remove_reference_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:22 +0000 (23:27 -0700)]
[llvm] Use std::remove_reference_t (NFC)

2 years ago[mlir] Use std::enable_if_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:20 +0000 (23:27 -0700)]
[mlir] Use std::enable_if_t (NFC)

2 years ago[ADT] Use std::add_pointer_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:18 +0000 (23:27 -0700)]
[ADT] Use std::add_pointer_t (NFC)

2 years ago[ADT] Use std::add_lvalue_reference_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:16 +0000 (23:27 -0700)]
[ADT] Use std::add_lvalue_reference_t (NFC)

2 years ago[Support] Simplify reverseBits with constexpr if (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:15 +0000 (23:27 -0700)]
[Support] Simplify reverseBits with constexpr if (NFC)

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

2 years ago[Support] Simplify isInt and isUInt with constexpr if (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:13 +0000 (23:27 -0700)]
[Support] Simplify isInt and isUInt with constexpr if (NFC)

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

2 years ago[test] Make tests pass regardless of gnu++14/gnu++17 default
Fangrui Song [Sun, 4 Sep 2022 05:29:32 +0000 (05:29 +0000)]
[test] Make tests pass regardless of gnu++14/gnu++17 default

GCC from 11 onwards defaults to -std=gnu++17 for C++ source files. We want to do the same
(https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-dialect/64360).
Split RUN lines, adjust `-verify`, or add `__cplusplus < 201703L` or `-Wno-dynamic-exception-spec`,
so that tests will pass regardless of gnu++14/gnu++17 default.

We have a desire to mark a test compatible with multiple language standards.
There are ongoing discussions how to add markers in the long term:

* https://discourse.llvm.org/t/iterating-lit-run-lines/62596
* https://discourse.llvm.org/t/lit-run-a-run-line-multiple-times-with-different-replacements/64932

As a workaround in the short term, add lit substitutions `%std_cxx98-`,
`%std_cxx11-14`, etc. They can be used for tests which work across multiple
language standards. If a range has `n` standards, run lit multiple times, with
`LIT_CLANG_STD_GROUP=0`, `LIT_CLANG_STD_GROUP=1`, etc to cover all `n` standards.

Reviewed By: #clang-language-wg, aaron.ballman

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

2 years ago[mlir][sparse] Expose SparseTensor passes as enums instead of opaque numbers for...
Nick Kreeger [Sun, 4 Sep 2022 01:39:35 +0000 (01:39 +0000)]
[mlir][sparse] Expose SparseTensor passes as enums instead of opaque numbers for vectorization and parallelization options.

The SparseTensor passes currently use opaque numbers for the CLI, despite using an enum internally. This patch exposes the enums instead of numbered items that are matched back to the enum.

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

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

Please also see:
https://reviews.llvm.org/D118379
https://reviews.llvm.org/D117919

2 years ago[SanitizerCoverage] Simplify pc-table and improve test. NFC
Fangrui Song [Sat, 3 Sep 2022 21:29:21 +0000 (14:29 -0700)]
[SanitizerCoverage] Simplify pc-table and improve test. NFC

2 years ago[test][mlir] Restore used attributes deleted by D132726
Vitaly Buka [Sat, 3 Sep 2022 21:07:28 +0000 (14:07 -0700)]
[test][mlir] Restore used attributes deleted by D132726

2 years agoRevert "[mlir][sparse] Expose SparseTensor passes as enums instead of opaque"
Nick Kreeger [Sat, 3 Sep 2022 20:47:40 +0000 (15:47 -0500)]
Revert "[mlir][sparse] Expose SparseTensor passes as enums instead of opaque"

This reverts commit ef25b5d93d0b5621eb5d0482abd30a4e127e9223.

2 years ago[mlir][sparse] Expose SparseTensor passes as enums instead of opaque
Nick Kreeger [Sat, 3 Sep 2022 20:45:49 +0000 (15:45 -0500)]
[mlir][sparse] Expose SparseTensor passes as enums instead of opaque
numbers for vectorization and parallelization options.

The SparseTensor passes currently use opaque numbers for the CLI,
despite using an enum internally. This patch exposes the enums instead
of numbered items that are matched back to the enum.

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

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

Please also see:
https://reviews.llvm.org/D118379
https://reviews.llvm.org/D117919

2 years agoRevert "[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is...
Vitaly Buka [Sat, 3 Sep 2022 20:12:49 +0000 (13:12 -0700)]
Revert "[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type"

Breakes windows bot.

This reverts commit 3ad2fe913ae08ca062105731ad2da2eae825c731.

2 years ago[OpenMP] add a offload test involving std::complex
Ye Luo [Sat, 3 Sep 2022 18:27:33 +0000 (13:27 -0500)]
[OpenMP] add a offload test involving std::complex

Taken from the https://github.com/llvm/llvm-project/issues/57064 reproducer.

Reviewed By: jdoerfert

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

2 years ago[llvm] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:49 +0000 (11:17 -0700)]
[llvm] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

2 years agoDrop empty string literals from static_assert (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:47 +0000 (11:17 -0700)]
Drop empty string literals from static_assert (NFC)

Identified with modernize-unary-static-assert.

2 years ago[llvm] Use std::remove_const_t (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:45 +0000 (11:17 -0700)]
[llvm] Use std::remove_const_t (NFC)

2 years ago[llvm] Use std::enable_if_t (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:44 +0000 (11:17 -0700)]
[llvm] Use std::enable_if_t (NFC)

2 years ago[ADT] Use std::add_const_t (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:42 +0000 (11:17 -0700)]
[ADT] Use std::add_const_t (NFC)

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:40 +0000 (11:17 -0700)]
[llvm] Use range-based for loops (NFC)

2 years agoUse llvm::upper_bound (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:38 +0000 (11:17 -0700)]
Use llvm::upper_bound (NFC)

2 years agoUse llvm::lower_bound (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:37 +0000 (11:17 -0700)]
Use llvm::lower_bound (NFC)

2 years agoUse llvm::count_if (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:35 +0000 (11:17 -0700)]
Use llvm::count_if (NFC)

2 years ago[CodeGen] Use std::lcm (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:33 +0000 (11:17 -0700)]
[CodeGen] Use std::lcm (NFC)

2 years ago[BOLT] Use range-based for loops (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:32 +0000 (11:17 -0700)]
[BOLT] Use range-based for loops (NFC)

LLVM Coding Standards discourage for_each unless callable objects
already exist.

2 years ago[Driver] Remove unused -Ttext -Tdata -Tbss
Fangrui Song [Sat, 3 Sep 2022 17:57:29 +0000 (10:57 -0700)]
[Driver] Remove unused -Ttext -Tdata -Tbss

They lead to -Wunused-command-line-argument and should be written as -Ttext=
instead, but the driver options end with a space. -Ttext=0 can be accepted by
the JoinedOrSeparate -T, so the JoinedOrSeparate -Ttext/etc are unneeded.

2 years ago[Driver] Change some cc1 only JoinedOrSeparate long options to Separate
Fangrui Song [Sat, 3 Sep 2022 17:45:30 +0000 (10:45 -0700)]
[Driver] Change some cc1 only JoinedOrSeparate long options to Separate

They are error-prone as they do not end with `=`.
Note: for driver -isystem/etc, we have to support the Joined form.

2 years ago[CostModel][X86] Adjust mul v4i32/v8i32 throughput cost
Simon Pilgrim [Sat, 3 Sep 2022 17:45:04 +0000 (18:45 +0100)]
[CostModel][X86] Adjust mul v4i32/v8i32 throughput cost

Based off the numbers from AMD SoG + Agner - vXi32 are both half-rate, and znver1 double-pumps the v8i32 op

We should have caught this earlier as many Intel models have half-rate pmulld already :-(

2 years ago[CostModel][X86] Add CostKinds handling for add/sub ops
Simon Pilgrim [Sat, 3 Sep 2022 16:18:26 +0000 (17:18 +0100)]
[CostModel][X86] Add CostKinds handling for add/sub ops

This was achieved using the 'cost-tables vs llvm-mca' script D103695

2 years ago[lldb][bindings] Fix module_access handling of regex
Dave Lee [Thu, 1 Sep 2022 17:30:38 +0000 (10:30 -0700)]
[lldb][bindings] Fix module_access handling of regex

Fixes broken support for: `target.module[re.compile("libFoo")]`

There were two issues:
1. The type check was expecting `re.SRE_Pattern`
2. The expression to search the module path had a typo

In the first case, `re.SRE_Pattern` does not exist in Python 3, and is replaced
with `re.Pattern`.

While editing this code, I changed the type checks to us `isinstance`, which is
the conventional way of type checking.

From the docs on `type()`:

> The `isinstance()` built-in function is recommended for testing the type of an object, because it takes subclasses into account.

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

2 years ago[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type
yronglin [Sat, 3 Sep 2022 15:24:37 +0000 (23:24 +0800)]
[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

Avoid __builtin_assume_aligned crash when the 1st arg is array type(or string literal).

Open issue: https://github.com/llvm/llvm-project/issues/57169

Reviewed By: rjmccall

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

2 years ago[CostModel][X86] Add CostKinds handling for fdiv ops
Simon Pilgrim [Sat, 3 Sep 2022 14:48:33 +0000 (15:48 +0100)]
[CostModel][X86] Add CostKinds handling for fdiv ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'

As the uop count (used for TCK_SizeAndLatency) for divss/divps is typically so low, we need to override isExpensiveToSpeculativelyExecute to ensure we keep fdiv calls behind branches - although for some very recent cpu targets it might not be necessary any more and could be relaxed.

2 years ago[SCCP] add helper function for replacing signed operations; NFC
Sanjay Patel [Sat, 3 Sep 2022 14:12:13 +0000 (10:12 -0400)]
[SCCP] add helper function for replacing signed operations; NFC

Preliminary refactoring for planned enhancement in D133198.

2 years ago[X86] Fix fdiv throughput/latency/uops counts
Simon Pilgrim [Sat, 3 Sep 2022 14:23:41 +0000 (15:23 +0100)]
[X86] Fix fdiv throughput/latency/uops counts

Matches znver1/2 numbers from AMD SoG + Agner - no additional uops for folded instructions and znver1 double pumps 256-bit vectors

Matches skylake/icelake throughput numbers from Intel AoM + Agner/instlatx64

Noticed while adding fdiv CostKinds support