platform/upstream/llvm.git
21 months agoRevert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary"
Christopher Di Bella [Mon, 21 Nov 2022 04:34:56 +0000 (04:34 +0000)]
Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary"

This reverts commit eb3f7880a272b818940e2bd2510ae04b0e32873f.

21 months ago[ELF] Add InputSectionBase::{addRelocs,relocs} and GotSection::addConstant to add...
Fangrui Song [Mon, 21 Nov 2022 04:12:03 +0000 (04:12 +0000)]
[ELF] Add InputSectionBase::{addRelocs,relocs} and GotSection::addConstant to add/access relocations

to prepare for changing `relocations` from a SmallVector to a pointer.

Also change the `isec` parameter in `addAddendOnlyRelocIfNonPreemptible` to `GotSection &`.

21 months agoApply clang-tidy fixes for readability-identifier-naming in TosaValidation.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 09:43:07 +0000 (09:43 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TosaValidation.cpp (NFC)

21 months agoApply clang-tidy fixes for modernize-use-equals-default in TosaValidation.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 09:42:32 +0000 (09:42 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in TosaValidation.cpp (NFC)

21 months ago[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary
Christopher Di Bella [Mon, 21 Nov 2022 03:44:11 +0000 (03:44 +0000)]
[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary

The [Improving Clang's Diagnostics RFC][1] identifies eight broad fields
for Clang to surface, two of which are text-based. Since the current
diagnostics more closely map to the diagnostic summary (or headline), we
should rename them to ensure that there's no confusion when
Diagnostic.Reason is introduced in the near future.

[1]: https://discourse.llvm.org/t/rfc-improving-clang-s-diagnostics/62584

Reviewed By: aaron.ballman, erichkeane

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

21 months ago[LoongArch] Make function name in error message consistent with the user input. NFC
gonglingqin [Mon, 21 Nov 2022 02:51:58 +0000 (10:51 +0800)]
[LoongArch] Make function name in error message consistent with the user input. NFC

21 months ago[CSKY] Lower ISD::ConstantPool node to support getting the address of ConstantPool...
Zi Xuan Wu (Zeson) [Mon, 21 Nov 2022 01:33:09 +0000 (09:33 +0800)]
[CSKY] Lower ISD::ConstantPool node to support getting the address of ConstantPool entry

When there is not GRS or MOVIH/ORI instruction, we can not get the address of
ConstantPool entry directly. So we need put the address into ConstantPool to leverage CSKY::LRW instruction.

21 months ago[LoongArch] Add intrinsics for ibar, break and syscall
gonglingqin [Mon, 21 Nov 2022 01:12:18 +0000 (09:12 +0800)]
[LoongArch] Add intrinsics for ibar, break and syscall

Diagnostics for intrinsic input parameters have also been added.

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

21 months ago[ELF] Don't ignore --detect-odr-violations
Fangrui Song [Mon, 21 Nov 2022 00:52:03 +0000 (00:52 +0000)]
[ELF] Don't ignore --detect-odr-violations

We don't implement the gold specific feature and it's inappropriate to ignore it.
The option is used by some projects under gold configure checks.

21 months ago[CMake][OpenMP] Remove -Wl,--warn-shared-textrel
Fangrui Song [Mon, 21 Nov 2022 00:37:32 +0000 (00:37 +0000)]
[CMake][OpenMP] Remove -Wl,--warn-shared-textrel

This option is legacy and is removed from GNU ld's doc (many binutils
distributions are configured with --enable-textrel-check=). lld ignores the
option.

21 months ago[ELF] Simplify InputSectionBase::getSize
Fangrui Song [Mon, 21 Nov 2022 00:02:36 +0000 (00:02 +0000)]
[ELF] Simplify InputSectionBase::getSize

21 months ago[ELF] Replace rawData+size with content_+size+compressedSize
Fangrui Song [Sun, 20 Nov 2022 23:22:32 +0000 (23:22 +0000)]
[ELF] Replace rawData+size with content_+size+compressedSize

compressedSize resides in an existing union. sizeof(InputSection) decreases from
160 to 152 on ELF64 systems.

21 months ago[ELF] Change rawData to content() and data() to contentMaybeDecompress()
Fangrui Song [Sun, 20 Nov 2022 22:43:22 +0000 (22:43 +0000)]
[ELF] Change rawData to content() and data() to contentMaybeDecompress()

Clarify data() which may trigger decompression and make it feasible to refactor
the member variable rawData.

21 months ago[clang] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 20 Nov 2022 22:32:17 +0000 (14:32 -0800)]
[clang] Remove unused forward declarations (NFC)

21 months ago[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer
Adrian Vogelsgesang [Fri, 26 Aug 2022 13:00:43 +0000 (06:00 -0700)]
[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer

So far, the pretty printer for `std::coroutine_handle` internally
dereferenced the contained frame pointer displayed the `promise`
as a sub-value. As noticed in https://reviews.llvm.org/D132624
by @labath, this can lead to an endless loop in lldb during printing
if the coroutine frame pointers form a cycle.

This commit breaks the cycle by exposing the `promise` as a pointer
type instead of a value type. The depth to which the `frame variable`
and the `expression` commands dereference those pointers can be
controlled using the `--ptr-depth` argument.

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

21 months ago[ELF] InputSectionBase: add bool compressed to avoid overloading size with compressed...
Fangrui Song [Sun, 20 Nov 2022 21:56:13 +0000 (21:56 +0000)]
[ELF] InputSectionBase: add bool compressed to avoid overloading size with compressed semantics

Rename uncompressedSize to size, to prepare for shrinking rawData+size from 3 words to 2 words.

21 months ago[Analysis] Remove getInverseMinMaxPred
Kazu Hirata [Sun, 20 Nov 2022 21:30:19 +0000 (13:30 -0800)]
[Analysis] Remove getInverseMinMaxPred

The last uses of getInverseMinMaxPred were removed on February 24,
2022 in commit 5423b0a52567b2fba8cbae3afee760f53c3f14d2.

21 months ago[ELF] Shuffle SectionBase fields. NFC
Fangrui Song [Sun, 20 Nov 2022 21:23:30 +0000 (21:23 +0000)]
[ELF] Shuffle SectionBase fields. NFC

Move frequently used fields (e.g. sectionKind, partition) to the top. My x86-64 lld executable is 600+B smaller.

21 months agoAdd version to all LLVM cmake package
Thomas Preud'homme [Thu, 17 Nov 2022 23:35:18 +0000 (23:35 +0000)]
Add version to all LLVM cmake package

Add a version to non-LLVM cmake package so that users needing an exact
version match can use the version parameter to find_package. Also adjust
the find_package(LLVM) to use an exact version match as well.

Reviewed By: arsenm, stellaraccident

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

21 months agoAdd a new top level statistic that tracks how many modules have variable errors.
Greg Clayton [Sun, 20 Nov 2022 17:40:23 +0000 (09:40 -0800)]
Add a new top level statistic that tracks how many modules have variable errors.

We have a statistic on each module named "debugInfoHadVariableErrors" which tracks when we have debug info, but an error prevented the variables from being displayed. This patch adds a new top level statistic named "totalModuleCountWithVariableErrors" which is a count of the modules that have "debugInfoHadVariableErrors" set to true.

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

21 months ago[ADT] Remove deperecated methods in OptionalStorage
Kazu Hirata [Sun, 20 Nov 2022 20:24:16 +0000 (12:24 -0800)]
[ADT] Remove deperecated methods in OptionalStorage

Note that I deprecated these methods on August 7, 2022 in commit
commit b5f8d42efe3e246d582d4a1a328fac915e4ce8dc.

21 months ago[ADT] Remove llvm::empty
Kazu Hirata [Sun, 20 Nov 2022 20:06:19 +0000 (12:06 -0800)]
[ADT] Remove llvm::empty

Note that I deprecated llvm::empty on September 18, 2022 in commit
6b49f30fca04ea3e4d57aef40e4bb6716a378870.

21 months ago[LV] Clean up LoopVectorizationCostModel::calculateRegisterUsage. NFC
Bjorn Pettersson [Sat, 19 Nov 2022 00:40:37 +0000 (01:40 +0100)]
[LV] Clean up LoopVectorizationCostModel::calculateRegisterUsage. NFC

Minor refactoring in LoopVectorizationCostModel::calculateRegisterUsage.

Also adding some FIXME:s related to what appears to be some short
comings related to how the register usage is calculated.

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

21 months ago[TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown size
Bjorn Pettersson [Sat, 19 Nov 2022 00:16:11 +0000 (01:16 +0100)]
[TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown size

When calculating the size of concatenated subregisters, and at least
one of the subregisters involved has an unknown size (-1), then the
concatenated size should be set to -1 as well.

This bug was found for an out-of-tree target.

Looking at lib/Target the only in-tree target that has a subregister
with unknown size is X86:
  X86RegisterInfo.td:  def sub_mask_0   : SubRegIndex<-1>;

But it looks like sub_mask_0 don't result in any concatenated subreg
index with faulty size if looking at X86SubRegIdxRanges[].

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

21 months ago[TableGen] Let -register-info-debug dump Offset/Size for each SubRegIndex
Bjorn Pettersson [Sat, 19 Nov 2022 00:00:57 +0000 (01:00 +0100)]
[TableGen] Let -register-info-debug dump Offset/Size for each SubRegIndex

This patch adds dumping of the Offset and Size info for each
SubRegIndex printed when using
  llvm-tblgen -gen-register-info -register-info-debug

It also updates the ConcatenatedSubregs.td to check those printouts,
including some new subreg definitions that show short-comings in
how the size is calculated when concatenating subregisters and at
least one has an incomplete size (-1). Today TableGen will just add
sizes together, resulting in MCRegisterInfo::getSubRegIdxSize()
returning a value that isn't -1 even if the combined subregister size
is unknown.

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

21 months ago[Support] Use std::is_convertible_v (NFC)
Kazu Hirata [Sun, 20 Nov 2022 19:52:04 +0000 (11:52 -0800)]
[Support] Use std::is_convertible_v (NFC)

21 months ago[ADT] Use std::is_copy_constructible_v (NFC)
Kazu Hirata [Sun, 20 Nov 2022 19:32:31 +0000 (11:32 -0800)]
[ADT] Use std::is_copy_constructible_v (NFC)

21 months ago[X86] IceLakeServer - PACKS instructions take latency 3cy
Simon Pilgrim [Sun, 20 Nov 2022 19:28:27 +0000 (19:28 +0000)]
[X86] IceLakeServer - PACKS instructions take latency 3cy

This appears to be a slow down vs Skylake (which the model was copied off) - confirmed with uops.info / instlatx64

Noticed as D138359 was reporting that many of the PACKS overrides were redundant, but were in fact incorrect

21 months ago[LLDB] Recognize `std::noop_coroutine()` in `std::coroutine_handle` pretty printer
Adrian Vogelsgesang [Thu, 25 Aug 2022 01:12:08 +0000 (18:12 -0700)]
[LLDB] Recognize `std::noop_coroutine()` in `std::coroutine_handle` pretty printer

With this commit, the `std::coroutine_handle` pretty printer now
recognizes `std::noop_coroutine()` handles. For noop coroutine handles,
we identify use the summary string `noop_coroutine` and we don't print
children

Instead of
```
(std::coroutine_handle<void>) $3 = coro frame = 0x555555559058 {
  resume = 0x00005555555564f0 (a.out`std::__1::coroutine_handle<std::__1::noop_coroutine_promise>::__noop_coroutine_frame_ty_::__dummy_resume_destroy_func() at noop_coroutine_handle.h:79)
  destroy = 0x00005555555564f0 (a.out`std::__1::coroutine_handle<std::__1::noop_coroutine_promise>::__noop_coroutine_frame_ty_::__dummy_resume_destroy_func() at noop_coroutine_handle.h:79)
}
```

we now print

```
(std::coroutine_handle<void>) $3 = noop_coroutine
```

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

21 months ago[libc++][NFC] Refactor run-buildbot to make it closer to our buildkite pipeline
Louis Dionne [Fri, 18 Nov 2022 21:17:10 +0000 (16:17 -0500)]
[libc++][NFC] Refactor run-buildbot to make it closer to our buildkite pipeline

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

21 months ago[ADT] Remove deprecated `llvm::array_lengthof`
Joe Loser [Sun, 20 Nov 2022 05:01:29 +0000 (22:01 -0700)]
[ADT] Remove deprecated `llvm::array_lengthof`

`llvm::array_lengthof` was marked deprecated a bit over two months ago in
5758c824dab4851fd061201483987b338c051417.  Now, finally remove it.  Since this
function was the only one in `STLArrayExtras.h`, get rid of the whole header.

D118342 (2022-01) moved the function to `STLArrayExtras.h`. This function should
have very few users now (MaskRay made some downstream inspection in
https://reviews.llvm.org/D133502#3777981). D133502 deprecated the function.

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

21 months ago[ADT] Simplify determining size for joining items
Joe Loser [Sun, 20 Nov 2022 05:11:18 +0000 (22:11 -0700)]
[ADT] Simplify determining size for joining items

`join_items_size` uses recursive function templates for determining the total
items size.  Instead, use fold expressions since we have C++17 available now.

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

21 months ago[lldb] Fix test expectation in `TestCoroutineHandle.py` for 32-bit systems
Adrian Vogelsgesang [Sun, 20 Nov 2022 14:52:15 +0000 (06:52 -0800)]
[lldb] Fix test expectation in `TestCoroutineHandle.py` for 32-bit systems

21 months ago[llvm] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 20 Nov 2022 17:59:36 +0000 (09:59 -0800)]
[llvm] Remove unused forward declarations (NFC)

21 months ago[Clang] Add papers approved in Kona by WG21 to the C++ status page
Corentin Jabot [Sun, 20 Nov 2022 17:51:52 +0000 (18:51 +0100)]
[Clang] Add papers approved in Kona by WG21 to the C++ status page

Approved core issues will be updated separately through an update
of the defect report list when a new core issue list is
published.

21 months ago[MCA][X86] Add missing test coverage for BWI instructions
Simon Pilgrim [Sun, 20 Nov 2022 17:19:50 +0000 (17:19 +0000)]
[MCA][X86] Add missing test coverage for BWI instructions

21 months ago[MCA][X86] Add test coverage for IFMA instructions
Simon Pilgrim [Sun, 20 Nov 2022 16:00:26 +0000 (16:00 +0000)]
[MCA][X86] Add test coverage for IFMA instructions

21 months ago[gn build] port af8c49dc1ec4
Nico Weber [Sun, 20 Nov 2022 17:02:33 +0000 (12:02 -0500)]
[gn build] port af8c49dc1ec4

21 months ago[libc++] Introduce a setting to remove fstream from the library
Louis Dionne [Fri, 18 Nov 2022 20:01:33 +0000 (15:01 -0500)]
[libc++] Introduce a setting to remove fstream from the library

This allows porting the library to platforms that are able to support
<iostream> but that do not have a notion of a filesystem, and where it
hence doesn't make sense to support std::fstream (and never will).

Also, remove reliance on <fstream> in various tests that didn't
actually need it.

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

21 months ago[LLD][COFF] Survive empty and invalid PCH signature
Alexandre Ganea [Sun, 20 Nov 2022 15:24:02 +0000 (10:24 -0500)]
[LLD][COFF] Survive empty and invalid PCH signature

Solve two issues that showed up when using LLD with Unreal Engine & FASTBuild:
1. It seems the S_OBJNAME record doesn't always record the "precomp signature". We were relying on that to match the PCH.OBJ with their dependent-OBJ.
2. MSVC link.exe is able to link a PCH.OBJ when the "precomp signatureƈ doesn't match, but LLD was failing. This was occuring since the Unreal Engine Build Tool was compiling the PCH.OBJ, but the dependent-OBJ were compiled & cached through FASTBuild. Upon a clean rebuild, the PCH.OBJs were recompiled by the Unreal Build Tool, thus the "precomp signatures" were changing; however the OBJs were already cached by FASTBuild, thus having an old "precomp signatures".

We now ignore "precomp signatures" and properly fallback to cmd-line name lookup, like MSVC link.exe does, and only fail if the PCH.OBJ type stream doesn't match the count expected by the dependent-OBJ.

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

21 months ago[X86] Fix atomic rmw intrinsic expansion for non-opaque pointers
Benjamin Kramer [Sun, 20 Nov 2022 14:24:14 +0000 (15:24 +0100)]
[X86] Fix atomic rmw intrinsic expansion for non-opaque pointers

This is a bit annoying, but there are still users out there that got
broken by this (this time it was numba). We need to keep some barebones
support around until non-opaque pointers are completely gone.

21 months agoReapply "[LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`"
Adrian Vogelsgesang [Wed, 24 Aug 2022 03:53:00 +0000 (20:53 -0700)]
Reapply "[LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`"

The original commit was missing a `ClangASTImporter::CopyType` call.
Original commit message:

This commit teaches the `std::coroutine_handle` pretty-printer to
devirtualize type-erased promise types. This is particularly useful to
resonstruct call stacks, either of asynchronous control flow or of
recursive invocations of `std::generator`. For the example recently
introduced by https://reviews.llvm.org/D132451, printing the `__promise`
variable now shows

```
(std::__coroutine_traits_sfinae<task, void>::promise_type) __promise = {
  continuation = coro frame = 0x555555562430 {
    resume = 0x0000555555556310 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
    destroy = 0x0000555555556700 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
    promise = {
      continuation = coro frame = 0x5555555623e0 {
        resume = 0x0000555555557070 (a.out`task detail::chain_fn<2>() at llvm-nested-example.cpp:66)
        destroy = 0x0000555555557460 (a.out`task detail::chain_fn<2>() at llvm-nested-example.cpp:66)
        promise = {
          ...
        }
      }
      result = 0
    }
  }
  result = 0
}
```

(shortened to keep the commit message readable) instead of

```
(std::__coroutine_traits_sfinae<task, void>::promise_type) __promise = {
  continuation = coro frame = 0x555555562430 {
    resume = 0x0000555555556310 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
    destroy = 0x0000555555556700 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
  }
  result = 0
}
```

Note how the new debug output reveals the complete asynchronous call
stack: our own function resumes `chain_fn<1>` which in turn will resume
`chain_fn<2>` and so on. Thereby this change allows users of lldb to
inspect the logical coroutine call stack without using any custom debug
scripts (although the display is still a bit clumsy. It would be nicer
to also integrate this into lldb's backtrace feature, but I don't know
how to do so)

The devirtualization currently works by introspecting the function
pointed to by the `destroy` pointer. (The `resume` pointer is not worth
much, given that for the final suspend point `resume` is set to a
nullptr. We have to use the `destroy` pointer instead.) We then look
for a `__promise` variable inside the `destroy` function. This
`__promise` variable is synthetically generated by LLVM, and looking at
its type reveals the type-erased promise_type.

This approach only works for clang-generated code, though. While gcc
also adds a `_Coro_promise` variable to the `resume` function, it does
not do so for the `destroy` function. However, we can't use the `resume`
function, as it will be reset to a nullptr at the final suspension
point. For the time being, I am happy with de-virtualization only working
for clang. A follow-up commit will further improve devirtualization and
also expose the variables spilled to the coroutine frame. As part of
this, I will also revisit gcc support.

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

21 months ago[X86] Remove unnecessary SHLD32rri8/SHRD16rri8 instruction override from bdver2 model
Simon Pilgrim [Sun, 20 Nov 2022 14:17:44 +0000 (14:17 +0000)]
[X86] Remove unnecessary SHLD32rri8/SHRD16rri8 instruction override from bdver2 model

Reported by D138359 - the override matches the WriteSHDrri base sched def

21 months ago[X86] Remove unnecessary XGETBV instruction overrides from znver1/znver2 models
Simon Pilgrim [Sun, 20 Nov 2022 14:05:05 +0000 (14:05 +0000)]
[X86] Remove unnecessary XGETBV instruction overrides from znver1/znver2 models

Reported by D138359 - znver models already treats all WriteSystem sched instructions as microcoded

21 months ago[MCA][X86] Add test coverage for XSAVE instructions
Simon Pilgrim [Sun, 20 Nov 2022 13:56:04 +0000 (13:56 +0000)]
[MCA][X86] Add test coverage for XSAVE instructions

21 months ago[X86] Remove unnecessary RDPMC/RDTSC instruction overrides from znver1/znver2 models
Simon Pilgrim [Sun, 20 Nov 2022 13:19:49 +0000 (13:19 +0000)]
[X86] Remove unnecessary RDPMC/RDTSC instruction overrides from znver1/znver2 models

Reported by D138359

21 months ago[X86] Remove unnecessary string instruction overrides from znver1/znver2 models
Simon Pilgrim [Sun, 20 Nov 2022 12:57:44 +0000 (12:57 +0000)]
[X86] Remove unnecessary string instruction overrides from znver1/znver2 models

Reported by D138359 - they were being overridden as WriteMicrocoded despite already being declared WriteMicrocoded

It also fixes a rather funny instregex mismatch that was matching the movsldup shuffle by mistake

21 months ago[X86] Remove unnecessary bit test instruction overrides from znver2 model
Simon Pilgrim [Sun, 20 Nov 2022 12:22:11 +0000 (12:22 +0000)]
[X86] Remove unnecessary bit test instruction overrides from znver2 model

Reported by D138359 and confirmed with AMD SoG - matches znver1 model

21 months ago[X86] Improve LOOP/LOOPE/LOOPNE schedule on SandyBridge model
Simon Pilgrim [Sun, 20 Nov 2022 12:13:02 +0000 (12:13 +0000)]
[X86] Improve LOOP/LOOPE/LOOPNE schedule on SandyBridge model

D138359 was reporting that this override was superfluous, but it had never been setup - I took the numbers from uops.info (I couldn't find an estimate in Intel docs).

21 months ago[MCA][X86] Add test coverage for LOOP/LOOPE/LOOPNE instructions
Simon Pilgrim [Sun, 20 Nov 2022 11:35:21 +0000 (11:35 +0000)]
[MCA][X86] Add test coverage for LOOP/LOOPE/LOOPNE instructions

These were missed for some reason - only noticed this while investigating a FIXME in the SandyBridge model

Also sync the znver2/znver3 tests which had been missed when LOCK test coverage was added

21 months ago[X86] Remove unnecessary zmm shuffle instruction overrides from IceLake model
Simon Pilgrim [Sun, 20 Nov 2022 10:48:27 +0000 (10:48 +0000)]
[X86] Remove unnecessary zmm shuffle instruction overrides from IceLake model

Reported by D138359 and confirmed with Intel AoM, Agner + uops.info

21 months ago[X86] znver2 - (V)EXTRACTPSrr takes 2 uops
Simon Pilgrim [Sat, 19 Nov 2022 18:53:02 +0000 (18:53 +0000)]
[X86] znver2 - (V)EXTRACTPSrr takes 2 uops

D138359 was reporting that the EXTRACTPSrr override was unnecessary, however the AMD SoG and Agner both confirm that both the rr and rm versions take 2uops (matching znver1)

21 months ago[ADT] Remove None=1 MSVC workaround
Fangrui Song [Sun, 20 Nov 2022 09:07:03 +0000 (09:07 +0000)]
[ADT] Remove None=1 MSVC workaround

This workaround from 0cd22f9540c0591132ec991c51103cf800cf4e24 (2017-01) is very
likely unneeded.

21 months agoUse None consistently (NFC)
Kazu Hirata [Sun, 20 Nov 2022 08:24:40 +0000 (00:24 -0800)]
Use None consistently (NFC)

This patch replaces NoneType() and NoneType::None with None in
preparation for migration from llvm::Optional to std::optional.

In the std::optional world, we are not guranteed to be able to
default-construct std::nullopt_t or peek what's inside it, so neither
NoneType() nor NoneType::None has a corresponding expression in the
std::optional world.

Once we consistently use None, we should even be able to replace the
contents of llvm/include/llvm/ADT/None.h with something like:

  using NoneType = std::nullopt_t;
  inline constexpr std::nullopt_t None = std::nullopt;

to ease the migration from llvm::Optional to std::optional.

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

21 months ago[clang-format] Don't use PPIndentWidth inside multi-line macros
Noah Goldstein [Sat, 19 Nov 2022 09:06:37 +0000 (01:06 -0800)]
[clang-format] Don't use PPIndentWidth inside multi-line macros

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

21 months ago[lldb] Use Optional::has_value instead of Optional::hasValue (NFC)
Kazu Hirata [Sun, 20 Nov 2022 07:22:48 +0000 (23:22 -0800)]
[lldb] Use Optional::has_value instead of Optional::hasValue (NFC)

21 months ago[Analysis] Use llvm::Optional::value_or (NFC)
Kazu Hirata [Sun, 20 Nov 2022 05:11:10 +0000 (21:11 -0800)]
[Analysis] Use llvm::Optional::value_or (NFC)

21 months ago[X86] Use lock or/and/xor for cases that we only care about the EFLAGS
Phoebe Wang [Sun, 20 Nov 2022 02:42:26 +0000 (10:42 +0800)]
[X86] Use lock or/and/xor for cases that we only care about the EFLAGS

This is a follow up of D137711 to fix the reset of #58685.

Reviewed By: RKSimon

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

21 months ago[test][asan] Rename variables for less confusion
Vitaly Buka [Sun, 20 Nov 2022 01:12:32 +0000 (17:12 -0800)]
[test][asan] Rename variables for less confusion

21 months ago[Analysis] Teach getOptionalIntLoopAttribute to return std::optional (NFC)
Kazu Hirata [Sat, 19 Nov 2022 23:36:50 +0000 (15:36 -0800)]
[Analysis] Teach getOptionalIntLoopAttribute to return std::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[SelectionDAG] Teach getRegistersForValue to return std::optional (NFC)
Kazu Hirata [Sat, 19 Nov 2022 23:00:19 +0000 (15:00 -0800)]
[SelectionDAG] Teach getRegistersForValue to return std::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/11

21 months agoRemove unused llvm/IRPrinter/IRPrintingPasses.h or reorder #include after D137768
Fangrui Song [Sat, 19 Nov 2022 22:09:05 +0000 (22:09 +0000)]
Remove unused llvm/IRPrinter/IRPrintingPasses.h or reorder #include after D137768

21 months ago[MCA][X86] Add test coverage for BF16 instructions
Simon Pilgrim [Sat, 19 Nov 2022 21:46:14 +0000 (21:46 +0000)]
[MCA][X86] Add test coverage for BF16 instructions

21 months ago[MCA][X86] Add test coverage for VP2INTERSECT instructions
Simon Pilgrim [Sat, 19 Nov 2022 21:20:31 +0000 (21:20 +0000)]
[MCA][X86] Add test coverage for VP2INTERSECT instructions

NOTE: For IceLakeServer we actually test TigerLake as that's the only target that supports it (we do something similar for F16C on IvyBridge in the SandyBridge tests).

21 months ago[ADT] Remove deprecated Any::hasValue
Kazu Hirata [Sat, 19 Nov 2022 21:45:27 +0000 (13:45 -0800)]
[ADT] Remove deprecated Any::hasValue

Note that I deprecated Any::hasValue on August 20, 2022 in commit
abb6271d809b37d3c3318894d697d5820032bec8.

21 months ago[AArch64] Disable aarch64-enable-gep-opt
David Green [Sat, 19 Nov 2022 21:25:18 +0000 (21:25 +0000)]
[AArch64] Disable aarch64-enable-gep-opt

This option was enabled in D128582, and whilst it seems to be a net
improvement in many cases, at least a couple of issues have been
reported from D135957 and from the CSE added to the backend causing more
instructions in executed blocks. Revert for the time being, until we can
improve the precision.

21 months ago[lldb/Plugins] Fix build failure with GCC in ScriptedPythonInterface::Dispatch
Med Ismail Bennani [Sat, 19 Nov 2022 21:20:11 +0000 (13:20 -0800)]
[lldb/Plugins] Fix build failure with GCC in ScriptedPythonInterface::Dispatch

This patch should fix the build failures following 7e01924 when building
with GCC. These failures were mostly caused by GCC's poor support of C++
templates (namely, partial template specialization).

To work around that problem, this patch makes use of overloading and get
rid of the templated structs and specialized structs.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
21 months ago[ADT] Remove deperecated methods in OptionalStorage
Kazu Hirata [Sat, 19 Nov 2022 21:21:27 +0000 (13:21 -0800)]
[ADT] Remove deperecated methods in OptionalStorage

Note that I deprecated these methods on August 7, 2022 in commit
commit b5f8d42efe3e246d582d4a1a328fac915e4ce8dc.

21 months ago[libc][math] Remove UInt<128>::operation* specialization.
Tue Ly [Thu, 17 Nov 2022 22:49:16 +0000 (17:49 -0500)]
[libc][math] Remove UInt<128>::operation* specialization.

Remove UInt<128>::operation* specialization since the generic implementation
works well enough:
https://quick-bench.com/q/Bz_J5HgAsz5m5V5Ze-X1fI77hPo

Reviewed By: michaelrj, sivachandra

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

21 months ago[libc] Add sub_with_borrow to builtin_wrapper.h
Tue Ly [Thu, 17 Nov 2022 05:56:56 +0000 (00:56 -0500)]
[libc] Add sub_with_borrow to builtin_wrapper.h

Add sub_with_borrow to builtin_wrapper.h to be used in UInt.

Reviewed By: sivachandra

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

21 months ago[MCA][X86] Add test coverage for VAES instructions
Simon Pilgrim [Sat, 19 Nov 2022 21:02:10 +0000 (21:02 +0000)]
[MCA][X86] Add test coverage for VAES instructions

21 months ago[mlir] Remove deprecated methods in OptionalParseResult
Kazu Hirata [Sat, 19 Nov 2022 20:54:05 +0000 (12:54 -0800)]
[mlir] Remove deprecated methods in OptionalParseResult

Note that I deprecated these methods on August 12, 2022 in commit
commit 5c4674d67b06c5b4a845f26a614fc453a6bfb1f6.

21 months ago[Basic] Remove deprecated methods in MapEntryOptionalStorage
Kazu Hirata [Sat, 19 Nov 2022 20:33:31 +0000 (12:33 -0800)]
[Basic] Remove deprecated methods in MapEntryOptionalStorage

Note that I deprecated these methods on August 8, 2022 in commit
commit 8e207e4c096e89fa5410b519715aba8c20701061.

21 months ago[CodeView] Replace GHASH hasher by BLAKE3
Alexandre Ganea [Sat, 19 Nov 2022 17:34:58 +0000 (12:34 -0500)]
[CodeView] Replace GHASH hasher by BLAKE3

Previously, we used SHA-1 for hashing the CodeView type records.
SHA-1 in `GloballyHashedType::hashType()` is coming top in the profiles. By simply replacing with BLAKE3, the link time is reduced in our case from 15 sec to 13 sec. I am only using MSVC .OBJs in this case. As a reference, the resulting .PDB is approx 2.1GiB and .EXE is approx 250MiB.

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

21 months ago[ConstraintElim] Add add nsw tests with negative constant.
Florian Hahn [Sat, 19 Nov 2022 19:17:42 +0000 (19:17 +0000)]
[ConstraintElim] Add add nsw tests with negative constant.

21 months ago[ELF][test] Clean up PT_OPENBSD tests
Fangrui Song [Sat, 19 Nov 2022 18:51:35 +0000 (18:51 +0000)]
[ELF][test] Clean up PT_OPENBSD tests

21 months ago[X86] Remove unnecessary STC instruction overrides
Simon Pilgrim [Sat, 19 Nov 2022 18:15:32 +0000 (18:15 +0000)]
[X86] Remove unnecessary STC instruction overrides

Reported by D138359

21 months ago[X86] Remove unnecessary STD + CLD instruction overrides
Simon Pilgrim [Sat, 19 Nov 2022 18:15:08 +0000 (18:15 +0000)]
[X86] Remove unnecessary STD + CLD instruction overrides

Reported by D138359

21 months agoRevert "[XCOFF] llvvm-readobj support display symbol table of loader section of xcoff...
Vitaly Buka [Sat, 19 Nov 2022 17:58:14 +0000 (09:58 -0800)]
Revert "[XCOFF] llvvm-readobj support display symbol table of loader section of xcoff object file."

Use of uninitialized value.

This reverts commit 037f5c283a2278ef156189be48db0738323206bd.

21 months ago[gn build] Reformat all build files
Nico Weber [Sat, 19 Nov 2022 16:54:34 +0000 (11:54 -0500)]
[gn build] Reformat all build files

Ran:

    git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format

21 months ago[ConstraintElim] Split up large gep-arithmetic.ll test.
Florian Hahn [Sat, 19 Nov 2022 16:53:39 +0000 (16:53 +0000)]
[ConstraintElim] Split up large gep-arithmetic.ll test.

This should help avoid getting a single test file too large with future
additions.

21 months ago[TableGen] SubtargetEmitter.cpp - clang-format includes sorting. NFC.
Simon Pilgrim [Sat, 19 Nov 2022 16:49:06 +0000 (16:49 +0000)]
[TableGen] SubtargetEmitter.cpp - clang-format includes sorting. NFC.

21 months ago[ConstraintElim] Rename test file to match contents.
Florian Hahn [Sat, 19 Nov 2022 16:15:48 +0000 (16:15 +0000)]
[ConstraintElim] Rename test file to match contents.

The test file contains tests with chained/nested GEPs. Reflect that in
the name.

21 months ago[X86] Remove some unnecessary cvt overrides
Simon Pilgrim [Sat, 19 Nov 2022 15:37:52 +0000 (15:37 +0000)]
[X86] Remove some unnecessary cvt overrides

All of these match the default WriteCvtI2PS class defs

21 months ago[X86] Ensure we're testing the misched-matrix.ll tests with the generic cpu
Simon Pilgrim [Sat, 19 Nov 2022 14:38:53 +0000 (14:38 +0000)]
[X86] Ensure we're testing the misched-matrix.ll tests with the generic cpu

Noticed when experimenting with using tuning parameters to control ILP mode

21 months ago[X86] Regenerate memcpy-2.ll test checks
Simon Pilgrim [Sat, 19 Nov 2022 14:30:00 +0000 (14:30 +0000)]
[X86] Regenerate memcpy-2.ll test checks

21 months ago[MCA][X86] Add test coverage for BITALG instructions
Simon Pilgrim [Sat, 19 Nov 2022 11:35:31 +0000 (11:35 +0000)]
[MCA][X86] Add test coverage for BITALG instructions

21 months agoFix incorrect cast in VisitSYCLUniqueStableNameExpr
Alex Richardson [Fri, 18 Nov 2022 21:15:01 +0000 (21:15 +0000)]
Fix incorrect cast in VisitSYCLUniqueStableNameExpr

Clang language-level address spaces and LLVM pointer address spaces are
not the same thing (even though they will both have a numeric value of
zero in many cases). LangAS is a enum class to avoid implicit conversions,
but eba69b59d1a30dead07da2c279c8ecfd2b62ba9f avoided the compiler error by
adding a `static_cast<>`. While touching this code, simplify it by using
CreatePointerBitCastOrAddrSpaceCast() which is already a no-op if the types
match.

This changes the code generation for spir64 to place the globals in
the sycl_global addreds space, which maps to `addrspace(1)`.

Reviewed By: bader

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

21 months ago[flang] Support lowering of intrinsic GET_COMMAND
Peixin Qiao [Sat, 19 Nov 2022 11:26:17 +0000 (19:26 +0800)]
[flang] Support lowering of intrinsic GET_COMMAND

As Fortran 2018 16.9.82, all the arguments of GET_COMMAND are optional.
When they are all absent, do nothing so to be consistent with gfortran
and ifort. The semantic analysis and runtime have been supported.

This intrinsic was introduced from F2003, and this supports the lowering
of it.

Reviewed By: PeteSteinfeld, jeanPerier

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

21 months ago[test][asan] Simplify __sanitizer_verify_contiguous_container test
Vitaly Buka [Sat, 19 Nov 2022 09:51:52 +0000 (01:51 -0800)]
[test][asan] Simplify __sanitizer_verify_contiguous_container test

21 months ago[llvm-objdump] Left justify display of OpenBSD headers
Brad Smith [Sat, 19 Nov 2022 09:34:25 +0000 (04:34 -0500)]
[llvm-objdump] Left justify display of OpenBSD headers

This looks the same as OpenBSD's GNU objdump.

21 months ago[LoongArch] Add support for tail call optimization
wanglei [Sat, 19 Nov 2022 06:55:25 +0000 (14:55 +0800)]
[LoongArch] Add support for tail call optimization

This patch adds tail call support to the LoongArch backend.  When
appropriate, use the `b` or `jr` instruction for tail calls (the
`pcalau12i+jirl` instruction pair when use medium codemodel).

This patch also modifies the inappropriate operand name:
simm26_bl -> simm26_symbol

This has been modeled after RISCV's tail call opt.

Reviewed By: SixWeining

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

21 months ago[test][asan] Simplify loops in test
Vitaly Buka [Sat, 19 Nov 2022 08:35:27 +0000 (00:35 -0800)]
[test][asan] Simplify loops in test

21 months ago[test][asan] Simplify test
Vitaly Buka [Sat, 19 Nov 2022 08:23:08 +0000 (00:23 -0800)]
[test][asan] Simplify test

We don't need to iterate off_end, just need to check a granule after the
end.

21 months ago[CodeGen][ARM] Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg
yronglin [Thu, 17 Nov 2022 15:06:21 +0000 (23:06 +0800)]
[CodeGen][ARM] Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg

Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg

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

Reviewed By: rjmccall

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

21 months ago[MLIR] Fix incorrect assertion in memref replacement utility
Uday Bondhugula [Thu, 17 Nov 2022 10:18:25 +0000 (15:48 +0530)]
[MLIR] Fix incorrect assertion in memref replacement utility

The assertion had an unchecked use of getDefiningOp. The condition
itself is stale and not needed. This is a trivial/obvious fix - the
buggy path wasn't exercised since the current passes/users of this
utility always passed the result of an op as an "extra index".

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

21 months ago[LoongArch] Add emergency spill slot for CFR spill/reload
wanglei [Sat, 19 Nov 2022 06:35:14 +0000 (14:35 +0800)]
[LoongArch] Add emergency spill slot for CFR spill/reload

When all registers have been allocated and CFR needs to be saved on the
stack, an emergency spill slot is required. Because CFR's spill and
reload require a general purpose register to transfer.

The attached test case was bugpoint-reduced down from
`MultiSource/Benchmarks/mafft/Lalignmm.c` in the test-suite.
Without this patch, llc will crash and report the following errors:

```
LLVM ERROR: Error while trying to spill R4 from class GPR: Cannot scavenge register without an emergency spill slot!
```

Reviewed By: SixWeining

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

21 months agoRevert "[flang] Use proper attributes for runtime calls with 'i1' arguments/returns."
Slava Zakharin [Sat, 19 Nov 2022 04:12:33 +0000 (20:12 -0800)]
Revert "[flang] Use proper attributes for runtime calls with 'i1' arguments/returns."

Buildbot might be failing because of this:
https://lab.llvm.org/buildbot/#/builders/65/builds/7283

This reverts commit 396ead93e3cead59727947afdea1fc2b49f0fc34.

21 months agoRevert "[flang] Support lowering of intrinsic GET_COMMAND"
Peixin Qiao [Sat, 19 Nov 2022 03:51:25 +0000 (11:51 +0800)]
Revert "[flang] Support lowering of intrinsic GET_COMMAND"

This reverts commit 86ea67ed4e89cc042818bd8e53066fdd96ff96e4.

21 months ago[MLIR] Add FieldParser implementation for Optional<> integer types.
Nick Kreeger [Sat, 19 Nov 2022 03:22:27 +0000 (21:22 -0600)]
[MLIR] Add FieldParser implementation for Optional<> integer types.

This patch introduces a templated FieldParser to handle optional signed and unsigned integer types - NFC. Additionally, I've added an extra test to ensure that both signed and unsigned integers are properly tested in the templated integer types for FieldParser as well.