platform/upstream/llvm.git
12 months ago[TableGen][NFC] Remove unreachable code
wangpc [Thu, 20 Jul 2023 07:16:21 +0000 (15:16 +0800)]
[TableGen][NFC] Remove unreachable code

The removed code assumed that we can define classes inside a multiclass,
so the name of outer multiclass is concatenated to the qualified name.
But for current TableGen grammar, we can't define classes in multiclass,
so it is unnecessary.

This commit is requested in D152998.

12 months ago[clang-tools-extra] the message in a static_assert is not always a string literal
Corentin Jabot [Thu, 20 Jul 2023 07:17:56 +0000 (09:17 +0200)]
[clang-tools-extra] the message in a static_assert is not always a string literal

Fixes build failure introduce by 47ccfd7.

12 months ago[InstCombineVectorOps] Use poison instead of undef as placeholder [NFC]
Nuno Lopes [Thu, 20 Jul 2023 07:14:43 +0000 (08:14 +0100)]
[InstCombineVectorOps] Use poison instead of undef as placeholder [NFC]
Undef was being used to populate unused vector lanes.
While at it, switch extractelement to use poison as the OOB value (per LangRef)

12 months ago[RISCV] Sink more common code from RVInst/RVInst16 into RVInstCommon. NFC
Craig Topper [Thu, 20 Jul 2023 07:03:44 +0000 (00:03 -0700)]
[RISCV] Sink more common code from RVInst/RVInst16 into RVInstCommon. NFC

Reviewed By: wangpc

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

12 months ago[WebAssembly] Use MapVector to stabilize iteration order after D150803
Fangrui Song [Thu, 20 Jul 2023 07:06:47 +0000 (00:06 -0700)]
[WebAssembly] Use MapVector to stabilize iteration order after D150803

StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).

12 months ago[WebAssembly] Use SetVector to stabilize iteration order after D120365
Fangrui Song [Thu, 20 Jul 2023 07:02:06 +0000 (00:02 -0700)]
[WebAssembly] Use SetVector to stabilize iteration order after D120365

StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).

12 months ago[Clang] Implement P2741R3 - user-generated static_assert messages
Corentin Jabot [Tue, 1 Nov 2022 12:37:12 +0000 (13:37 +0100)]
[Clang] Implement P2741R3 - user-generated static_assert messages

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

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

12 months ago[X86] Add AVX-VNNI-INT16 instructions.
Freddy Ye [Thu, 20 Jul 2023 06:30:46 +0000 (14:30 +0800)]
[X86] Add AVX-VNNI-INT16 instructions.

For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: pengfei, skan

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

12 months ago.debug_gnu_pub{names,types}: Stabilize iteration order
Fangrui Song [Thu, 20 Jul 2023 06:30:30 +0000 (23:30 -0700)]
.debug_gnu_pub{names,types}: Stabilize iteration order

StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
Sort by DIE offset (which looks like a pre-order traversal order).

12 months ago[X86] Recognize standalone `(1 << nbits) - 1` pattern as bzhi
Danila Malyutin [Wed, 19 Jul 2023 16:32:59 +0000 (19:32 +0300)]
[X86] Recognize standalone `(1 << nbits) - 1` pattern as bzhi

This can be thought as a subcase of `x & ((1 << nbits) - 1)` where x == -1

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

12 months ago[X86][AArch64] Add additional extract_lowbits test
Danila Malyutin [Wed, 19 Jul 2023 18:00:08 +0000 (21:00 +0300)]
[X86][AArch64] Add additional extract_lowbits test

Check that vreg_width-1 mask is only removed for shifts

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

12 months ago[clang][Interp][NFC] Add another assertion to InterpStack::peek()
Timm Bäder [Wed, 19 Jul 2023 13:58:40 +0000 (15:58 +0200)]
[clang][Interp][NFC] Add another assertion to InterpStack::peek()

12 months ago[clang][Interp][NFC] Fix a doc comment mixup
Timm Bäder [Wed, 19 Jul 2023 11:53:18 +0000 (13:53 +0200)]
[clang][Interp][NFC] Fix a doc comment mixup

12 months ago[clang][Interp][NFC] Clear InterpStack::ItemTypes in clear()
Timm Bäder [Wed, 19 Jul 2023 11:51:42 +0000 (13:51 +0200)]
[clang][Interp][NFC] Clear InterpStack::ItemTypes in clear()

12 months ago[RISCV] Use the opcodestr and argstr arguments of Pseudo to simplify tablegen code...
Craig Topper [Thu, 20 Jul 2023 05:36:16 +0000 (22:36 -0700)]
[RISCV] Use the opcodestr and argstr arguments of Pseudo to simplify tablegen code. NFC

We can replace several "let AsmString =".

12 months ago[X86] Add SM4 instructions.
Freddy Ye [Thu, 20 Jul 2023 05:34:47 +0000 (13:34 +0800)]
[X86] Add SM4 instructions.

For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: pengfei, skan

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

12 months ago[VirtualFileSystem] Use map to stabilize iteration order
Fangrui Song [Thu, 20 Jul 2023 05:25:40 +0000 (22:25 -0700)]
[VirtualFileSystem] Use map to stabilize iteration order

StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).

Tested by `TEST_F(InMemoryFileSystemTest, DirectoryIteration)`.

12 months ago[RISCV] Introduce a common tablegen base class for RVInst and RVInst16.
Craig Topper [Thu, 20 Jul 2023 04:39:26 +0000 (21:39 -0700)]
[RISCV] Introduce a common tablegen base class for RVInst and RVInst16.

This gives us a common place to put the TSFlags and the Namespace.

Removes TSFlags declaration duplication for D155690.

Reviewed By: wangpc

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

12 months ago[TableGen][GlobalISel] Use MapVector to stabilize iteration order after D153757
Fangrui Song [Thu, 20 Jul 2023 04:21:26 +0000 (21:21 -0700)]
[TableGen][GlobalISel] Use MapVector to stabilize iteration order after D153757

StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).

12 months ago[dsymutil] Sort entries in YamlDMO to stabilize print order
Fangrui Song [Thu, 20 Jul 2023 04:02:01 +0000 (21:02 -0700)]
[dsymutil] Sort entries in YamlDMO to stabilize print order

Similar to the llvm::sort call in DebugMapObject::print.

12 months ago[dsymutil] Remove unused function. NFC
Fangrui Song [Thu, 20 Jul 2023 04:00:35 +0000 (21:00 -0700)]
[dsymutil] Remove unused function. NFC

12 months ago[CUDA][HIP] Use the same default language std as C++
Yaxun (Sam) Liu [Mon, 17 Jul 2023 21:50:12 +0000 (17:50 -0400)]
[CUDA][HIP] Use the same default language std as C++

Currently CUDA/HIP defines their own language standards in
LanguageStandards.def but they are redundant. They are the same as stdc++14.
The fact that CUDA/HIP uses c++* in option -std= indicates that they have the
same language standards as C++. The CUDA/HIP specific language features are
conveyed through language options, not language standards features. It makes
sense to let CUDA/HIP uses the same default language standard as C++.

Reviewed by: Siu Chi Chan, Artem Belevich

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

Fixes: SWDEV-407685

12 months agoRevert "[lld] Preliminary fat-lto-object support"
Paul Kirth [Thu, 20 Jul 2023 03:33:36 +0000 (03:33 +0000)]
Revert "[lld] Preliminary fat-lto-object support"

This reverts commit c9953d9891a6067549a78e7d07ca8eb6a7596792 and a
forward fix in 3a45b843dec1bca195884aa1c5bc56bd0e6755b4.

D14677 causes some failure on windows bots that the forward fix did not
address. Thus I'm reverting until the underlying cause can me triaged.

12 months ago[RuntimeDyldChecker][NFC] Add `section_addr` to BNF in the comment.
Kai Luo [Thu, 20 Jul 2023 03:18:05 +0000 (03:18 +0000)]
[RuntimeDyldChecker][NFC] Add `section_addr` to BNF in the comment.

12 months ago[LV] Add tests for select-cmp reduction pattern. (NFC)
Mel Chen [Tue, 27 Jun 2023 09:06:00 +0000 (02:06 -0700)]
[LV] Add tests for select-cmp reduction pattern. (NFC)

The test cases for selecting increasing integer induction variable.

Reviewed By: fhahn, shiva0217

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

12 months agoAppleAcceleratorTable: Use MapVector to stabilize iteration order after D153066
Fangrui Song [Thu, 20 Jul 2023 02:59:13 +0000 (19:59 -0700)]
AppleAcceleratorTable: Use MapVector to stabilize iteration order after D153066

Use a MapVector to stabilize the order and simplify future changes like
D142862 that change the StringMap hash function.

12 months agoAccelTable: Use MapVector to stabilize iteration order
Fangrui Song [Thu, 20 Jul 2023 02:50:36 +0000 (19:50 -0700)]
AccelTable: Use MapVector to stabilize iteration order

Entries of the same DJB hash are in the hash lookup table/name table are
ordered by the iteration order of `Entries` (a StringMap). Change
`Entries` to a MapVector to stabilize the order and simplify future
changes like D142862 that change the StringMap hash function.

12 months ago[gn build] Port c6f66de21af0
LLVM GN Syncbot [Thu, 20 Jul 2023 02:44:21 +0000 (02:44 +0000)]
[gn build] Port c6f66de21af0

12 months ago[flang] Add PowerPC vec_convert, vec_ctf and vec_cvf intrinsic
Kelvin Li [Tue, 11 Jul 2023 20:15:50 +0000 (16:15 -0400)]
[flang] Add PowerPC vec_convert, vec_ctf and vec_cvf intrinsic

Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>
Differential Revision: https://reviews.llvm.org/D155235

12 months ago[X86] Add SM3 instructions.
Freddy Ye [Thu, 20 Jul 2023 02:23:52 +0000 (10:23 +0800)]
[X86] Add SM3 instructions.

For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: pengfei

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

12 months ago[llvm-jitlink] Generalize statistics gathering / reporting.
Lang Hames [Thu, 20 Jul 2023 02:16:21 +0000 (19:16 -0700)]
[llvm-jitlink] Generalize statistics gathering / reporting.

Moves the llvm-jitlink tool statistics out of the Session struct and into a new
LLVMJITLinkStatistics class.

Also removes the `-show-sizes` option. Each statistic added will now have its
own option. The two previous stats (total size of all blocks before pruning and
after fixups) are now available as -pre-prune-total-block-size and
-post-fixup-total-block-size.

This change should make it easier to add new statistics.

12 months ago[gn build] Port fc3b7874b6c9
LLVM GN Syncbot [Thu, 20 Jul 2023 01:45:27 +0000 (01:45 +0000)]
[gn build] Port fc3b7874b6c9

12 months ago[X86] Add SHA512 instructions.
Freddy Ye [Thu, 20 Jul 2023 01:44:21 +0000 (09:44 +0800)]
[X86] Add SHA512 instructions.

For more details about this instruction, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: RKSimon, skan

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

12 months ago[ELF][test] Add REQUIRES: x86 after D146778
Fangrui Song [Thu, 20 Jul 2023 01:17:46 +0000 (18:17 -0700)]
[ELF][test] Add REQUIRES: x86 after D146778

12 months ago[lld-macho] Use fixed chunk size for UUID
Fangrui Song [Thu, 20 Jul 2023 00:24:36 +0000 (17:24 -0700)]
[lld-macho] Use fixed chunk size for UUID

Chunk size decided by the thread count makes the UUID less deterministic
(e.g. across machines with different core counts.)
Follow ELF and just use a fixed chunksize.

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

Reviewed By: #lld-macho, keith

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

12 months ago[llvm-libtool-darwin] Use MapVector to avoid relying on StringMap iteration order
Fangrui Song [Thu, 20 Jul 2023 00:21:57 +0000 (17:21 -0700)]
[llvm-libtool-darwin] Use MapVector to avoid relying on StringMap iteration order

Simplify future changes like D142862 that change the hash function.

12 months agoFix PPCBE
Chris Bieneman [Thu, 20 Jul 2023 00:06:53 +0000 (19:06 -0500)]
Fix PPCBE

For real this time.

12 months agoFix big endian bot
Chris Bieneman [Wed, 19 Jul 2023 23:52:52 +0000 (18:52 -0500)]
Fix big endian bot

I have yet again broken ppcbe. This should fix it.

12 months ago[libcxx] Fix copy_move.pass test
Haowei Wu [Wed, 19 Jul 2023 23:22:29 +0000 (16:22 -0700)]
[libcxx] Fix copy_move.pass test

When LLVM is built under MSVC and libcxx ABI is set to 2, the
'copy_move.pass' test will unexpectedly pass. This patch mitigate
this issue by setting this test will only expecting FAIL when libcxx
ABI version is set to 1.

This is a re-land of be9f55f4fff47badcdca17be5bcc0a4a15894739

Differential Revision: https://reviews.llvm.org/D155760
Fixes: https://github.com/llvm/llvm-project/issues/63442

12 months ago[AArch64][GlobalISel] Widen (<2 x s16> = G_BUILD_VECTOR) to <2 x s32>.
Amara Emerson [Wed, 19 Jul 2023 23:47:38 +0000 (16:47 -0700)]
[AArch64][GlobalISel] Widen (<2 x s16> = G_BUILD_VECTOR) to <2 x s32>.

We don't support this as a argument or return type, it's always promoted to <2 x s32>.

Performing the widening prevents us from having selection failures due to unsupported
extends.

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

12 months ago[lld-macho] Implement -no_uuid
Keith Smiley [Wed, 19 Jul 2023 18:07:57 +0000 (11:07 -0700)]
[lld-macho] Implement -no_uuid

Since UUID generation in lld is fast this is rarely used but it can be
helpful to avoid temporary issues like https://github.com/llvm/llvm-project/issues/63961

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

12 months ago[libc++] Revert "[libcxx] Fix copy_move.pass test"
Louis Dionne [Wed, 19 Jul 2023 23:10:27 +0000 (19:10 -0400)]
[libc++] Revert "[libcxx] Fix copy_move.pass test"

This reverts commit be9f55f4fff47badcdca17be5bcc0a4a15894739.

The commit was both not approved by the libc++ review group, and also
the only change it contained was incorrect.

12 months ago[gold] Add preliminary FatLTO support to the Gold plugin
Paul Kirth [Tue, 13 Jun 2023 21:39:14 +0000 (21:39 +0000)]
[gold] Add preliminary FatLTO support to the Gold plugin

This changes the definition if `isSectionBitcode` to only be valid for the
`.llvm.lto` section, since this API is only called from LTO, and the
`.llvmbc` section was not intended to be used for LTO. This allows the
gold plugin to keep its existing behavior without introducing any
significant changes.

Depends on D146778

Reviewed By: MaskRay

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

12 months ago[lld] Preliminary fat-lto-object support
Paul Kirth [Fri, 24 Mar 2023 00:14:48 +0000 (00:14 +0000)]
[lld] Preliminary fat-lto-object support

This patch adds support to lld for --fat-lto-objects. We add a new
--fat-lto-objects flag to LLD, and slightly change how it chooses input
files in the driver when the flag is set.

Fat LTO objects contain both LTO compatible IR, as well as generated object
code. This allows users to defer the choice of whether to use LTO or not to
link-time. This is a feature available in GCC for some time, and makes the
existing -ffat-lto-objects flag functional in the same way as GCC's.

If the --fat-lto-objects option is passed to LLD and the input files are fat
object files, then the linker will chose the LTO compatible bitcode sections
embedded within the fat object and link them together using LTO. Otherwise,
standard object file linking is done using the assembly section in the object
files.

Original RFC: https://discourse.llvm.org/t/rfc-ffat-lto-objects-support/63977

Depends on D146777

Reviewed By: MaskRay

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

12 months ago[DX] Fix PSV resource serialization
Chris Bieneman [Tue, 18 Jul 2023 00:33:16 +0000 (19:33 -0500)]
[DX] Fix PSV resource serialization

When writing this initially I missed including the resource stride.
This change adds the resources stride to the serialized value.

I've also extended the testing and error reporting around parsing PSV
information. This adds tests to verify that the reader produces
meaningful error messages for malformed DXContainer files, and a test
that verifies the resource stride is respected in the reader even if
the stride isn't an expected or known value (as would happen if the
format changes in the future).

This is part of #59479.

Reviewed By: bogner, bob80905

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

12 months ago[Clang][CodeGen] Follow-up for `vtable`, `typeinfo` et al. are globals
Alex Voicu [Wed, 19 Jul 2023 22:57:12 +0000 (23:57 +0100)]
[Clang][CodeGen] Follow-up for `vtable`, `typeinfo` et al. are globals

https://reviews.llvm.org/rG8acdcf4016876d122733991561be706b64026e73 didn't include handling for the fact that `throw`'s implementation takes a pointer to a type's `typeinfo` struct, which implies that its signature needs to change as well. This corrects that and adds a test.

Reviewed By: rjmccall

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

12 months ago[libcxx] Fix copy_move.pass test
Haowei Wu [Wed, 19 Jul 2023 22:37:40 +0000 (15:37 -0700)]
[libcxx] Fix copy_move.pass test

When LLVM is built under MSVC and libcxx ABI is set to 2, the
'copy_move.pass' test will unexpectedly pass. This patch mitigate this
issue by setting this test will only expecting FAIL when libcxx ABI
version is set to 1.

Differential Revision: https://reviews.llvm.org/D155760
Fixes: https://github.com/llvm/llvm-project/issues/63442

12 months agoRevert "[OptTable] Make explicitly included options override excluded ones"
Justin Bogner [Wed, 19 Jul 2023 22:43:50 +0000 (15:43 -0700)]
Revert "[OptTable] Make explicitly included options override excluded ones"

Looks like a couple of flang bots are broken by this change. Reverting
to investigate.

This reverts commit b2eda85f047f27788ccd7b9af9bd59c5d44b2051.

12 months agoPDBFileBuilder: Switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 22:31:51 +0000 (15:31 -0700)]
PDBFileBuilder: Switch to xxh3_64bits

Following recent changes switching from xxh64 to xxh32 for better
hashing performance (e.g., D154813). I am not familiar with this use
case, but this change will ensure that the lld executable doesn't need
xxHash64 after wasm-ld migrates.

12 months ago[OptTable] Make explicitly included options override excluded ones
Justin Bogner [Wed, 19 Jul 2023 17:38:40 +0000 (10:38 -0700)]
[OptTable] Make explicitly included options override excluded ones

When we have both explicitly included and excluded option sets, we
were excluding anything from the latter set regardless of what was in
the former. This doesn't compose well and led to an overly complicated
design around DXC options where a third flag was introduced to handle
options that overlapped between DXC and CL.

With this change we check the included options before excluding
anything from the exclude list, which allows for options that are in
multiple categories to be handled in a sensible way. This allows us to
remove CLDXCOption but should otherwise be NFC.

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

12 months ago-fsanitize=function,MicrosoftMangle: Switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 22:20:50 +0000 (15:20 -0700)]
-fsanitize=function,MicrosoftMangle: Switch to xxh3_64bits

Following recent changes switching from xxh64 to xxh32 for better
hashing performance (e.g., D154813). These particular instances likely
have negligible time, but this change moves us toward removing xxHash64.

The type hash for -fsanitize=function will change, following a recent
change D148785 (not in any release yet) to the type hash scheme, though
sanitizers don't sign up for cross-version compatibility anyway.

The MicrosoftMangle instance is for internal symbols that need no
compatibility guarantee, as emphasized by the comment.

12 months ago[-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s
ziqingluo-90 [Wed, 19 Jul 2023 22:00:10 +0000 (15:00 -0700)]
[-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s

The safe-buffer analysis analyzes TypeLocs of types of variable
declarations in order to get source locations of them.

However, in some cases, the source locations of a TypeLoc are not
valid. Using invalid source locations results in assertion violation
or incorrect analysis or fix-its.

It is still not clear to me in what circumstances a TypeLoc does not
have valid source locations (it looks like a bug in Clang to me, but
it is not our responsibility to fix it). So we will conservatively
give up the analysis when required source locations are not valid.

Reviewed By: NoQ (Artem Dergachev)

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

12 months ago[libc++] Temporarily disable back-deployment testing on arm64 until we figure out...
Louis Dionne [Wed, 19 Jul 2023 21:58:29 +0000 (17:58 -0400)]
[libc++] Temporarily disable back-deployment testing on arm64 until we figure out ongoing issues

12 months ago[BOLT][test] Fix dwarf5-dwarf4-monolithic.test after D154813
Amir Ayupov [Wed, 19 Jul 2023 21:48:23 +0000 (14:48 -0700)]
[BOLT][test] Fix dwarf5-dwarf4-monolithic.test after D154813

Capture debug_line_str offsets into FileCheck variables.

Reviewed By: #bolt, maksfb, ayermolo

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

12 months ago[clangd] enable unused-include warnings for standard library headers
Sam McCall [Sat, 15 Jul 2023 23:52:43 +0000 (01:52 +0200)]
[clangd] enable unused-include warnings for standard library headers

Other <angle-quoted> headers are still excluded.

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

12 months ago[Driver][test] Add -no-canonical-prefixes after D154357
Fangrui Song [Wed, 19 Jul 2023 21:39:52 +0000 (14:39 -0700)]
[Driver][test] Add -no-canonical-prefixes after D154357

If the path components of %clang contain a symlink, e.g.

```
% cd /tmp; ln -s Rel xxx
% /tmp/xxx/bin/clang --target=powerpc-unknown-eabi -xc /dev/null '-###'
InstalledDir: /tmp/xxx/bin
...
"-internal-isystem" "/tmp/Rel/bin/../lib/clang-runtimes/powerpc-unknown-eabi/include"
```

the test will fail. Such commands should use -no-canonical-prefixes, or
derive the include and library paths from cc1 -isysroot using driver
--sysroot.

12 months ago[libc++][NFC] Fix annoying line break in test synopsis comment
Louis Dionne [Wed, 19 Jul 2023 21:39:22 +0000 (17:39 -0400)]
[libc++][NFC] Fix annoying line break in test synopsis comment

12 months ago[flang][hlfir] Removed incorrect clean-up in the implied-do lowering.
Slava Zakharin [Wed, 19 Jul 2023 17:03:27 +0000 (10:03 -0700)]
[flang][hlfir] Removed incorrect clean-up in the implied-do lowering.

The lowering of calls/expressions unconditionally inserts DestroyOp
clean-up for hlfir.expr values, which is wrong in the case where
the value is used as a result of the elemental operation created
during the implied-do lowering. A cleaner fix could be to avoid
DestroyOp insertion at all, but I have not figure out an easy
way to do it. The DestroyOp look-up I used seems to be quite
reliable, so it should just work.

Reviewed By: clementval

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

12 months ago[flang][hlfir] Fixed finalization in hlfir.assign codegen.
Slava Zakharin [Wed, 19 Jul 2023 16:10:54 +0000 (09:10 -0700)]
[flang][hlfir] Fixed finalization in hlfir.assign codegen.

When hlfir.assign is lowered into simple load/store,
we may still need to finalize the LHS.
The patch passes `needFinalization` to `genScalarAssignment`
for LHS of any derived type, so some `Destroy` calls
might be redundant. They can be removed later by propagating/deducing
IsFinalizable information about the LHS type.

Reviewed By: clementval

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

12 months ago[libc++] Add basic runtime assertions to <semaphore>
Edoardo Sanguineti [Wed, 19 Jul 2023 21:29:25 +0000 (17:29 -0400)]
[libc++] Add basic runtime assertions to <semaphore>

Adding assertions will aid users that have bugs or logic mistakes in
their code to receive error messages when debugging.

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

12 months ago[DirectX] Remove uses of isOpaquePointerTy(). NFC
Justin Bogner [Wed, 19 Jul 2023 19:04:38 +0000 (12:04 -0700)]
[DirectX] Remove uses of isOpaquePointerTy(). NFC

isOpaquePointerTy now returns true for all pointers, so we can replace
these with isPointerTy().

12 months ago[FSAFDO] Switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 21:23:28 +0000 (14:23 -0700)]
[FSAFDO] Switch to xxh3_64bits

Following recent changes switching from xxh64 to xxh32 for better
hashing performance. This particular instance may or may not have
noticeable performance difference, but this change makes us toward
removing xxHash64.

12 months ago[-Wunsafe-buffer-usage] Do not assert that function parameters have names
Ziqing Luo [Wed, 19 Jul 2023 21:02:06 +0000 (14:02 -0700)]
[-Wunsafe-buffer-usage] Do not assert that function parameters have names

It is possible that a function parameter does not have a name even in
a function definition.  This patch deals with such cases in generating
function overload fix-its for safe buffers.

Reviewed by: NoQ (Artem Dergachev)

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

12 months ago[lldb] Make frame var --regex always search globals
Felipe de Azevedo Piovezan [Fri, 14 Jul 2023 19:59:24 +0000 (15:59 -0400)]
[lldb] Make frame var --regex always search globals

Currently frame var --regex sometimes searches globals, sometimes it doesn't.
This happens because `StackFrame::GetVariableList` always returns the biggest
list it has, regardless of whether only globals were requested or not. In other
words, if a previous call to `GetVariableList` requested globals, all subsequent
calls will see them.

The implication here is that users of `StackFrame::GetVariableList` are expected
to filter the results of this function. This is what we do for a vanilla
`frame var` command. But it is not what we do when `--regex` is used. This
commit solves the issue by:

1. Making `--regex` imply `--globals`. This matches the behavior of `frame var
<some_name>`, which will also search the global scope.
2. Making the `--regex` search respect the command object options.

See the added test for an example of the oddities this patch addresses. Without
the patch, the test fails. However it could be made to pass by calling a plain
`frame var` before calling `frame var --regex A::`.

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

12 months ago[COFF] Switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 21:08:13 +0000 (14:08 -0700)]
[COFF] Switch to xxh3_64bits

Similar to recent changes to ELF (e.g., commit
f4b4bc2f18dc0e44afde05735fb673d3de4d5c39) and Mach-O to improve hashing
performance.

12 months ago[lldb-vscode] Creating a new flag for adjusting the behavior of evaluation repl expre...
John Harrison [Thu, 13 Jul 2023 22:50:06 +0000 (15:50 -0700)]
[lldb-vscode] Creating a new flag for adjusting the behavior of evaluation repl expressions to allow users to more easily invoke lldb commands.

This adds a new flag and lldb runtime command to allow users to manage the behavior of the lldb-vscode evaluate repl request.

When evaluating a repl context this now has runtime managed flag for control how the repl behaviors with the follow values:

* `variable` - the existing behavior, with this mode requests are evaluted in the current frame context as variable expressions. To trigger a lldb command prefix an expression with ` and it will be evaluted as an lldb command.
* `command` - all expressions are evaluated as lldb commands.
* `auto` - An alternative mode that will attempt to determine if the expression is an lldb command or a variable expression. Based off the intepreted results the expression will be evaluted either as a command or an expression.

Additionally, I enabled completions and ensured they work with the new repl expression behavior to provide auto-completes.

This commit includes updates to the tests to verify the new behavior after the previous failures from submitting https://reviews.llvm.org/D154030.

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

12 months ago[mlir][spirv] Add D155747 to `.git-blame-ignore-revs`
Jakub Kuderski [Wed, 19 Jul 2023 20:52:36 +0000 (16:52 -0400)]
[mlir][spirv] Add D155747 to `.git-blame-ignore-revs`

12 months ago[mlir][spirv] Split op implementation file into subfiles. NFC.
Jakub Kuderski [Wed, 19 Jul 2023 20:48:46 +0000 (16:48 -0400)]
[mlir][spirv] Split op implementation file into subfiles. NFC.

The main op implementation file for SPIR-V grew past 5k LOC. This makes it
take a long time to compile and index with LSPs like clangd.

Pull out the first few SPIR-V extension ops into their own `.cpp` files,
just like we do with `.td` op definitions. This includes the
KHR/NV/Intel coop matrix and the integer dot prod extensions.

I plan to further split this in future revisions.

Reviewed By: antiagainst

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

12 months ago[clang-tidy][NFC] Fixes in release notes
Piotr Zegar [Wed, 19 Jul 2023 19:11:24 +0000 (19:11 +0000)]
[clang-tidy][NFC] Fixes in release notes

Correct link in release notes and format of some notes.

12 months ago[flang] Fix complex libm use logic problems
Razvan Lupusoru [Wed, 19 Jul 2023 18:29:46 +0000 (11:29 -0700)]
[flang] Fix complex libm use logic problems

Fix the various complex libm selection logic issues from D155310:
- disableMlirComplex is set to false. This means that using mlir complex
is enabled. Yet, the current code still selects libm.
- If we enable mlir complex, we should not check if use approx is
enabled. Namely, we should use mlir complex either if we enable mlir
complex OR use approx is enabled.

To fix the issues, we flip the logic of `disableMlirComplex` to enable
instead. We set it to false by default since the intention from D155310
is to use libm by default. Then we use a logical `&&` with use approx
so that we select libm when BOTH mlir complex and use approx are
disabled.

Reviewed By: vzakhari

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

12 months ago[libc][NFC] Move the RPC types to the `rpc_client.h` header
Joseph Huber [Wed, 19 Jul 2023 20:23:25 +0000 (15:23 -0500)]
[libc][NFC] Move the RPC types to the `rpc_client.h` header

Summary:
Simple cleanup of the interface so we do not depend on the installed
headers and get everything we need just including rpc_client.h.

12 months ago[llvm][utils] Add DenseMap data formatters
Dave Lee [Sat, 29 Oct 2022 22:07:49 +0000 (15:07 -0700)]
[llvm][utils] Add DenseMap data formatters

Add summary and synthetic data formatters for `llvm::DenseMap`.

This implementation avoids expression evaluation by using a heuristic. However, as
heuristics go, there is a corner case: A single deleted entry (a single "tombstone"),
will result in a child value with an invalid key but a valid value.

Instead of calling `getEmptyKey()` and `getTombstoneKey()` to determine which buckets
are empty, and which contain real key-values, the heuristic scans all buckets to
identify keys that exist only once. These singleton keys are considered valid.

The empty key will always exist multiple times. However the tombstone key may exist
zero, one, or many times. The heuristic has no problems when there are zero or many
tombstones, but when there is exactly one deleted entry (one tombstone), then the
heuristic will incorrectly identify it as valid.

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

12 months ago[RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is...
Craig Topper [Wed, 19 Jul 2023 19:33:08 +0000 (12:33 -0700)]
[RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1.

This is an alternative to D155288 that can handle other sources of
xori like FP compares. Unfortunately, it misses the i64 setge case
on RV32 in condops.ll.

Reviewed By: asb

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

12 months ago[mlir][Linalg] Fix warnings/errors on D155518.
Mahesh Ravishankar [Wed, 19 Jul 2023 18:45:10 +0000 (18:45 +0000)]
[mlir][Linalg] Fix warnings/errors on D155518.

This fixes some warnings (that were caught as errors) in https://reviews.llvm.org/D155518/.

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

12 months ago[gn] add include dir for 1f7c7d4bdd7b
Nico Weber [Wed, 19 Jul 2023 19:17:50 +0000 (15:17 -0400)]
[gn] add include dir for 1f7c7d4bdd7b

12 months ago[mlir][sparse] Renaming `CreationPolicy` to `Policy`
wren romano [Tue, 18 Jul 2023 01:02:04 +0000 (18:02 -0700)]
[mlir][sparse] Renaming `CreationPolicy` to `Policy`

This change is mostly for brevity's sake; but it also paves the way for the `Policy` enum to be reuseable for other situations that require the same three-way semantics.

Reviewed By: Peiming

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

12 months ago[libc++][print] Disables tests with msan.
Mark de Wever [Wed, 19 Jul 2023 18:56:51 +0000 (20:56 +0200)]
[libc++][print] Disables tests with msan.

These tests break with msan on the sanitizer-aarch64-linux-bootstrap-msan
builder. Note the x86_64 builder is not affected. To unbreak the CI
temporary disable the tests completely with msan.

The breakage was introduced by D150044.

12 months agoDefine llvm::thread::DefaultStackSize to 4 megabytes on AIX
Wael Yehia [Thu, 1 Jun 2023 19:56:07 +0000 (15:56 -0400)]
Define llvm::thread::DefaultStackSize to 4 megabytes on AIX

Link time thinLTO spawns pthreads to parallelize optimization and
codegen of the input bitcode files. On AIX, the default pthread
stack size limit is ~192k for 64-bit programs; insufficient for a
normal LLVM compilation.

Reviewed By: ZarkoCA, MaskRay

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

12 months ago[SLP]Fix a crash when trying to cast scalable vector type to fixed.
Alexey Bataev [Wed, 19 Jul 2023 18:20:39 +0000 (11:20 -0700)]
[SLP]Fix a crash when trying to cast scalable vector type to fixed.

Need to check for FixedVectorType, not a vector type, since later
compiler performs unconditional cast to FixedVectorType and gets the
number of elements in this type.

12 months ago[ELF] --build-id=fast: switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 18:37:42 +0000 (11:37 -0700)]
[ELF] --build-id=fast: switch to xxh3_64bits

12 months ago[ELF] splitNonStrings: switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 18:28:47 +0000 (11:28 -0700)]
[ELF] splitNonStrings: switch to xxh3_64bits

This is primarily used for .rodata.cst* duplicate elimination. The
sections are usually much smaller than .debug_str (D154813), so the
speedup is negligible. We do this switch for consistency as we want to
eliminate xxh64 in lld.

12 months ago[lld-macho]Use install_name as Identifier for code-sign, if available.
Vy Nguyen [Mon, 17 Jul 2023 19:37:51 +0000 (15:37 -0400)]
[lld-macho]Use install_name  as Identifier for code-sign, if available.

Detail:
LD64 uses the name provided via  -[dylib]install_name as "Identifier", when available.
For compatiblity, LLD should do that too.

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

12 months ago[OpenMP][Docs] Add some things to the OpenMP support
Joseph Huber [Wed, 19 Jul 2023 17:32:19 +0000 (12:32 -0500)]
[OpenMP][Docs] Add some things to the OpenMP support

This patch adds some information that we have support for in the OpenMP
clang support page.

Reviewed By: jdoerfert

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

12 months ago[ELF][test] Refactor merge.s
Fangrui Song [Wed, 19 Jul 2023 18:13:26 +0000 (11:13 -0700)]
[ELF][test] Refactor merge.s

12 months ago[sanitizer-common] Run module msan init before early sigaction test
Daniel Thornburgh [Tue, 18 Jul 2023 21:51:10 +0000 (14:51 -0700)]
[sanitizer-common] Run module msan init before early sigaction test

MSAN wrappers can be inserted for e.g. the access to stderr in the
constructor of the test, which can segfault if the constructor function
runs before these data structures have been initialized.

Reviewed By: dvyukov

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

12 months ago[X86] matchBinaryShuffle - relax PACKSS for v2i64 -> v4i32 shuffle truncation pattern...
Simon Pilgrim [Wed, 19 Jul 2023 17:58:12 +0000 (18:58 +0100)]
[X86] matchBinaryShuffle - relax PACKSS for v2i64 -> v4i32 shuffle truncation pattern match.

Similar to combineVectorSignBitsTruncation, we don't require all-signbits source inputs, just enough signbits to reach into the lowest i16 to safely use PACKSSDW.

12 months ago[CodeGenPrepare] Refactor optimizeSelectInst (NFC)
Momchil Velikov [Wed, 19 Jul 2023 17:31:25 +0000 (18:31 +0100)]
[CodeGenPrepare] Refactor optimizeSelectInst (NFC)

Refactor to use BasicBlockUtils functions and make life easier for
a subsequent patch for updating the dominator tree.

Reviewed By: dmgreen

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

12 months agoFix MSVC "'GetVMSetForLMul': not all control paths return a value" warning. NFC.
Simon Pilgrim [Wed, 19 Jul 2023 17:55:37 +0000 (18:55 +0100)]
Fix MSVC "'GetVMSetForLMul': not all control paths return a value" warning. NFC.

12 months ago[InstrProf][NFC] Ignore -Wcast-qual after D153911 to fix build failure on AIX
Jake Egan [Wed, 19 Jul 2023 17:50:33 +0000 (13:50 -0400)]
[InstrProf][NFC] Ignore -Wcast-qual after D153911 to fix build failure on AIX

/scratch/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c:202:40: error: cast from 'const int (*)[0]' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
                               (void *)&dummy_name, (void *)&dummy_vnds};
                                       ^
1 error generated.

12 months ago[mlir][Linalg] Cleanup the drop unit dims pass in Linalg.
Mahesh Ravishankar [Wed, 19 Jul 2023 04:58:26 +0000 (04:58 +0000)]
[mlir][Linalg] Cleanup the drop unit dims pass in Linalg.

TL;DR the following API functions have been merged

```
void populateFoldUnitExtentDimsViaReshapesPatterns(RewritePatternSet &patterns);
void populateFoldUnitExtentDimsViaSlicesPatterns(RewritePatternSet &patterns);
```

into

```
void populateFoldUnitExtentDimsPatterns(RewritePatternSet &patterns,
                                        ControlDropUnitDims &options);
```

To use the previous functionality use

```
ControlDropUnitDims options;
// By default options.rankReductionStrategy is
// ControlDropUnitDims::RankReductionStrategy::ReassociativeReshape.
populateFoldUnitExtentDimsPatterns(patterns, options);
```

and

```
ControlDropUnitDims options;
options.rankReductionStrategy = ControlDropUnitDims::RankReductionStrategy::ExtractInsertSlice
populateFoldUnitExtentDimsPatterns(patterns, options);

```

This pass is quite old and needed to be updated based on the current
approach to transformations in Linalg

- Instead of two patterns, one to just remove loop dimensions that are
  unit extent (and using 0 in the indexing maps), and another to drop
  the unit-extents in the operand shapes, combine into a single
  transformation. This avoid creating an intermediate step with
  indexing maps having 0's in the domains exp ressions.

- Expose the core transformation as a utility function and add a
  pattern that calls this transformation.

This is a mostly NFC change, apart from the API change and dropping
the patterns/test that only dropped the loops that are unit extents.

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

12 months ago[ThinLTO][AIX] Enable thinlto on AIX
Wael Yehia [Wed, 19 Jul 2023 01:48:03 +0000 (21:48 -0400)]
[ThinLTO][AIX] Enable thinlto on AIX

Starting from AIX 7.2 TL5 SP6 and AIX 7.3 TL2 the system linker supports thinLTO.

Reviewed By: ZarkoCA, MaskRay

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

12 months ago[mlir][openacc] Relax verifier for the acc.reduction.recipe
Valentin Clement [Wed, 19 Jul 2023 17:30:42 +0000 (10:30 -0700)]
[mlir][openacc] Relax verifier for the acc.reduction.recipe

Allow the init and combiner regions to have more
arguments to pass information.

Reviewed By: razvanlupusoru

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

12 months ago[RISCV] Run mem2reg on the scalar C builtin tests to remove allocas and simplify...
Craig Topper [Wed, 19 Jul 2023 17:30:42 +0000 (10:30 -0700)]
[RISCV] Run mem2reg on the scalar C builtin tests to remove allocas and simplify checks. NFC

As requested on D155647.

12 months ago[AMDGPUAttributor][FIX] No endless recursion for recursive initializers
Johannes Doerfert [Wed, 19 Jul 2023 17:11:29 +0000 (10:11 -0700)]
[AMDGPUAttributor][FIX] No endless recursion for recursive initializers

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

12 months ago[Attributor][NFCI] Add a shortcut for constants
Johannes Doerfert [Wed, 19 Jul 2023 17:13:03 +0000 (10:13 -0700)]
[Attributor][NFCI] Add a shortcut for constants

12 months ago[Attributor][NFCI] Avoid updating AAs that depend on missing callees
Johannes Doerfert [Wed, 19 Jul 2023 06:27:16 +0000 (23:27 -0700)]
[Attributor][NFCI] Avoid updating AAs that depend on missing callees

12 months agoRefactor some BasicBlockUtils functions (NFC)
Momchil Velikov [Wed, 19 Jul 2023 16:27:56 +0000 (17:27 +0100)]
Refactor some BasicBlockUtils functions (NFC)

Add a more "flexible" `SplitBlockAndInsertIfThenElse` function
and re-implement some others on top of it.

Reviewed By: dmgreen

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

12 months ago[Clang][CodeGen]`vtable`, `typeinfo` et al. are globals
Alex Voicu [Wed, 19 Jul 2023 17:04:31 +0000 (18:04 +0100)]
[Clang][CodeGen]`vtable`, `typeinfo` et al. are globals

All data structures and values associated with handling virtual functions / inheritance, as well as RTTI, are globals and thus can only reside in the global address space. This was not taken fully taken into account because for most targets, global & generic appear to coincide. However, on targets where global & generic ASes differ (e.g. AMDGPU), this was problematic, since it led to the generation of invalid bitcasts (which would trigger asserts in Debug) and less than optimal code. This patch does two things:

ensures that vtables, vptrs, vtts, typeinfo are generated in the right AS, and populated accordingly;
removes a bunch of bitcasts which look like left-overs from the typed ptr era.

Reviewed By: yxsamliu

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

12 months ago[RISCV] Upgrade Zvfh version to 1.0 and move out of experimental state.
Craig Topper [Wed, 19 Jul 2023 17:03:57 +0000 (10:03 -0700)]
[RISCV] Upgrade Zvfh version to 1.0 and move out of experimental state.

This has been ratified according to https://wiki.riscv.org/display/HOME/Recently+Ratified+Extensions

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

12 months ago[lld-macho] Switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 16:58:43 +0000 (09:58 -0700)]
[lld-macho] Switch to xxh3_64bits

xxh3 is substantially faster than xxh64.
For lld/ELF, there is substantial speedup in `.debug_str` duplicate
elimination (D154813). Use xxh3 for lld-macho as well.

Reviewed By: #lld-macho, oontvoo

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