Wael Yehia [Wed, 26 Jul 2023 20:48:13 +0000 (20:48 +0000)]
[XCOFF] Do not put MergeableCStrings in their own section
The current implementation generates a csect with a
".rodata.str.x.y" prefix for a MergeableCString variable definition.
However, a reference to such variable does not get the prefix in its
name because there's not enough information in the containing IR.
In particular, without seeing the initializer and absent of some other
indicators, we cannot tell that the referenced variable is a null-
terminated string.
When the AIX codegen in llvm was being developed, the prefixing was copied
from ELF without having the linker take advantage of the info.
Currently, the AIX linker does not have the capability to merge
MergeableCString variables. If such feature would ever get implemented,
the contract between the linker and compiler would have to be reconsidered.
Here's the before and after of this change:
```
@a = global i64
320255973571806, align 8
@strA = unnamed_addr constant [7 x i8] c"hello\0A\00", align 1 ;; Mergeable1ByteCString
@strB = unnamed_addr constant [8 x i8] c"Blahah\0A\00", align 1 ;; Mergeable1ByteCString
@strC = unnamed_addr constant [2 x i16] [i16 1, i16 0], align 2 ;; Mergeable2ByteCString
@strD = unnamed_addr constant [2 x i16] [i16 1, i16 1], align 2 ;; !isMergeableCString
@strE = external unnamed_addr constant [2 x i16], align 2
-fdata-sections:
.text extern .rodata.str1.1strA .text extern strA
0 SD RO 0 SD RO
.text extern .rodata.str1.1strB .text extern strB
0 SD RO 0 SD RO
.text extern .rodata.str2.2strC ===> .text extern strC
0 SD RO 0 SD RO
.text extern strD .text extern strD
0 SD RO 0 SD RO
.data extern a .data extern a
0 SD RW 0 SD RW
undef extern strE undef extern strE
0 ER UA 0 ER UA
-fno-data-sections:
.text unamex .rodata.str1.1 .text unamex .rodata
0 SD RO 0 SD RO
.text extern strA .text extern strA
0 LD RO 0 LD RO
.text extern strB .text extern strB
0 LD RO 0 LD RO
.text unamex .rodata.str2.2 ===> .text extern strC
0 SD RO 0 LD RO
.text extern strC .text extern strD
0 LD RO 0 LD RO
.text unamex .rodata .data unamex .data
0 SD RO 0 SD RW
.text extern strD .data extern a
0 LD RO 0 LD RW
.data unamex .data undef extern strE
0 SD RW 0 ER UA
.data extern a
0 LD RW
undef extern strE
0 ER UA
```
Reviewed by: David Tenty, Fangrui Song
Differential Revision: https://reviews.llvm.org/D156202
(cherry picked from commit
9d4e8c09f493280acc7637d904bdc84abc11fdc3)
Tobias Hieta [Mon, 31 Jul 2023 09:22:55 +0000 (11:22 +0200)]
[NFC] Fix version number in release tree
Martin Storsjö [Sat, 29 Jul 2023 21:40:03 +0000 (00:40 +0300)]
[docs] Add release notes for a Windows specific change in LLD
Ian Anderson [Fri, 28 Jul 2023 06:36:50 +0000 (23:36 -0700)]
[libc++][Modules] Fix a few module related warnings
I'm getting a few -Wundefined-inline warnings, and a -Wnon-modular-include-in-module too. Fix all of those.
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D156508
(cherry picked from commit
165841b681c146ae1e013a0aa4d69ef7c7c20fe2)
Nikita Popov [Fri, 28 Jul 2023 12:21:00 +0000 (14:21 +0200)]
[ThinLTO] Use module hash instead of module ID for cache key
This is a followup to D151165. Instead of using the module ID, use
the module hash for sorting the import list. The module hash is what
will actually be included in the hash.
This has the advantage of being independent of the module order,
which is something that Rust relies on.
A caveat here is that the test doesn't quite work for linkonce_odr
functions, because the function may be imported from two different
modules, and the first one on the llvm-lto2 command line gets picked
(rather than, say, the prevailing copy). This doesn't really matter
for Rust's purposes (because it does not use linkonce_odr linkage),
but may still be worth addressing. For now I'm using a variant of
the test using internal instead of linkonce_odr functions.
Differential Revision: https://reviews.llvm.org/D156525
(cherry picked from commit
279c2971951c2ea58a2bd1e6687ce61451f9d329)
eopXD [Wed, 26 Jul 2023 12:16:23 +0000 (05:16 -0700)]
[Clang][RISCV] Remove RVV intrinsics `vread_csr`,`vwrite_csr`
As proposed in riscv-non-isa/rvv-intrinsic-doc#249, removing the interface.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D156321
Joseph Huber [Wed, 26 Jul 2023 21:02:08 +0000 (16:02 -0500)]
[OpenMP] Do not always emit unused extern variables
Currently, the precense of the OpenMP target declare metadata requires
that we always codegen a global declaration. This is undesirable in the
case that we could defer or omit this declaration as is common with
unused extern variables. This is important as it allows us, in the
runtime, to rely on static linking semantics to omit unused symbols so
they are not included when the user links it in.
This patch changes the check for always emitting these variables.
Because of this we also need to extend this logic to the generation of
the offloading entries. This has the result of derring the offload entry
generation to the canonical definitoin. So we are effectively assuming
whoever owns the storage for this variable will perform that operation.
This makes an exception for `link` attributes as those require their own
special handling.
Let me know if this is sound in the implementation, I do not have the
largest view of the standards here.
Fixes: https://github.com/llvm/llvm-project/issues/64133
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D156368
(cherry picked from commit
141c4e7a9403fed46d84c7f0429295bd28c89368)
Shoaib Meenai [Thu, 27 Jul 2023 23:55:26 +0000 (16:55 -0700)]
[libunwind] Fix build with -Wunused-function
https://reviews.llvm.org/D144252 removed -Wno-unused-function from the
libunwind build, but we have an unused function when you're building for
armv7 without assertions. Mark that function as possibly unused to avoid
the warning, and mark the parameter as a const pointer while I'm here to
make it clear that nothing is modified by a debugging function.
Reviewed By: #libunwind, philnik
Differential Revision: https://reviews.llvm.org/D156496
(cherry picked from commit
3da76c2116179fdb3fff8feb4551209e4218746e)
Richard Smith [Thu, 27 Jul 2023 19:50:00 +0000 (12:50 -0700)]
Add release node for exact dynamic_cast optimization.
Matt Arsenault [Tue, 25 Jul 2023 12:42:51 +0000 (08:42 -0400)]
Add release note for assumes now recognizing class-like FP tests
Matt Arsenault [Tue, 25 Jul 2023 12:01:47 +0000 (08:01 -0400)]
AMDGPU: Add some release notes
Brian Cain [Wed, 26 Jul 2023 13:24:30 +0000 (06:24 -0700)]
[hexagon] restore library path arguments
Before applying this fix, clang would not include the specified library
path arguments:
$ ./bin/clang --target=hexagon-unknown-linux-musl -o tprog tprog.o -L/tmp -###
...
clang: warning: argument unused during compilation: '-L/tmp' [-Wunused-command-line-argument]
"/local/mnt/workspace/install/clang-latest/bin/ld.lld" "-z" "relro" "-o" "tprog" "-dynamic-linker=/lib/ld-musl-hexagon.so.1" "/usr/lib/crt1.o" "-L/usr/lib" "tprog.o" "-lclang_rt.builtins-hexagon" "-lc"
Differential Revision: https://reviews.llvm.org/D156330
(cherry picked from commit
96832a6bf7e0e7f1e8d634d38c44a1b32d512923)
Ian Anderson [Mon, 24 Jul 2023 22:35:00 +0000 (15:35 -0700)]
[libc++][Modules] Recreate the top level `std` clang module
lldb needs the `std` clang module to make all of libc++ available in the debugger. Make a new header to include the rest of the public headers and use to build a `std` module that just re-exports the rest of libc++.
Reviewed By: Mordante, JDevlieghere, #libc
Differential Revision: https://reviews.llvm.org/D156177
(cherry picked from commit
a800485a2deda0807cb9dc212b7d42ac916055fd)
Konstantin Varlamov [Thu, 27 Jul 2023 06:09:15 +0000 (23:09 -0700)]
[CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable the hardened mode in libc++.
Use the new libc++ hardened mode instead of the deprecated safe mode.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D156377
(cherry picked from commit
194e2ba1250c97926ed83b1ade1fbcbb49112a05)
eopXD [Thu, 27 Jul 2023 05:38:53 +0000 (22:38 -0700)]
[Clang][RISCV] Bump rvv intrinsics version to v0.12
The LLVM now supports v0.12 of the RVV intrinsics. Users can use the macro
riscv_v_intrinsic to distinguish what kind of intrinsics is supported in
the compiler.
Please refer to tag descriptions under
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tags
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D156394
(cherry picked from commit
20e87e2f794173deebd1cf8c86684452bb0c989b)
Rainer Orth [Thu, 27 Jul 2023 09:32:48 +0000 (11:32 +0200)]
[Driver] Link shared asan runtime lib with -z now on Solaris/x86
As detailed in Issue #64126, several asan tests `FAIL` due to a cycle in
`AsanInitInternal`. This can by avoided by disabling lazy binding with `ld
-z now`.
Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D156325
(cherry picked from commit
6b5149aa442efc10afa00e8864e58a24a9cf5c9f)
pvanhout [Wed, 26 Jul 2023 10:26:13 +0000 (12:26 +0200)]
[AMDGPU] Fix PromoteAlloca Subvector Stores for Single Elements
The previous condition was incorrect in some cases, like storing <2 x i32>
into a double. If IndexVal was >0, we ended up never storing anything.
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D156308
(cherry picked from commit
a8aabba5872aeaa57fbc71fdfde025d70d11deb0)
pvanhout [Wed, 26 Jul 2023 10:28:18 +0000 (12:28 +0200)]
[AMDGPU] Precommit tests for D156308
Also includes another testcase that's unrelated, it's just a sanity check.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D156309
(cherry picked from commit
6a767fbc36a37a8731a313b47208069b708dccf5)
Matt Arsenault [Thu, 27 Jul 2023 12:10:57 +0000 (08:10 -0400)]
AMDGPU: Always custom lower extract_subvector
The patterns were ripped out in
a4a3ac10cb1a40ccebed4e81cd7e94f1eb71602d so this always needs to be
custom lowered. I absolutely hate how difficult it is to write tests
for these, I have no doubt there are more of these hidden.
Fixes #64142
(cherry picked from commit
95e5a461f52f9046bc7a06d70812b2bec509a432)
Richard Smith [Tue, 25 Jul 2023 21:41:10 +0000 (14:41 -0700)]
For #64088: mark vtable as used if we might emit a reference to it.
(cherry picked from commit
b6847edfc235829b37dd6d734ef5bbfa0a58b6fc)
WANG Xuerui [Wed, 26 Jul 2023 14:16:49 +0000 (22:16 +0800)]
[lld][ELF][test] Fix excessive output file size in loongarch-add-sub.s
Initially the .rodata section came before .text, hence sharing its
segment with the program header sitting at a small offset, pushing the
output file size to ~72GiB (the file was sparse though, so not much is
really written). This breaks on 32-bit platforms and is irrelevant to
the feature being tested, so re-order the two sections so .text gets
processed first, and both sections get their own segment.
This addresses the issue found by the clang-armv8-lld-2stage builder:
https://lab.llvm.org/buildbot/#/builders/178/builds/5340
Reviewed By: SixWeining, xry111
Differential Revision: https://reviews.llvm.org/D156293
(cherry picked from commit
ffe2b6f75de55b665520669059c3d95240482d54)
Viktoriia Bakalova [Thu, 27 Jul 2023 08:43:54 +0000 (08:43 +0000)]
[clangd] Revert the symbol collector behavior to old pre-include-cleaner-library behavior due to a regression.
Differential Revision: https://reviews.llvm.org/D156403
(cherry picked from commit
3c6a7b0045afe9a230346e476bf07f88c145fdb5)
David Green [Thu, 27 Jul 2023 07:27:03 +0000 (08:27 +0100)]
[AArch64] Correct the regtype of indexed fmlal
The indexed fmlal should use a low numbered register for the index operand,
which this fixes by making it V128_lo.
Fixes 64104
Differential Revision: https://reviews.llvm.org/D156296
(cherry picked from commit
509cb334699a2360f2d87f184bc0f56f742c6fc3)
David Green [Thu, 27 Jul 2023 06:39:10 +0000 (07:39 +0100)]
[AArch64] Add test showing incorrect register usage of FMLAL. NFC
See D156296
(cherry picked from commit
e012c5cfac8542eb8164bab9891ea9b355e73517)
Fangrui Song [Wed, 26 Jul 2023 00:21:16 +0000 (17:21 -0700)]
[Support] Remove llvm::is_trivially_{copy/move}_constructible
This restores D132311, which was reverted in
29c841ce93e087fa4e0c5f3abae94edd460bc24a (Sep 2022) due to certain files
not buildable with GCC 7.3.0. The previous attempt was reverted by
6cd9608fb37ca2418fb44b57ec955bb5efe10689 (Dec 2020).
This time, GCC 7.3.0 has existing build errors for a long time due to
structured bindings for many files, e.g.
```
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9098:13: error: cannot decompose class type ‘std::pair<llvm::Value*, const llvm::SCEV*>’: both it and it
s base class ‘std::pair<llvm::Value*, const llvm::SCEV*>’ have non-static data members
for (auto [_, Stride] : Legal->getLAI()->getSymbolicStrides()) {
^~~~~~~~~~~
```
... and also some `error: duplicate initialization of` instances due to llvm/Transforms/IPO/Attributor.h.
---
GCC 7.5.0 has a bug that, without this change, certain `SmallVector` with a `std::pair` element type like `SmallVector<std::pair<Instruction * const, Info>, 0> X;` lead to spurious
```
/tmp/opt/gcc-7.5.0/include/c++/7.5.0/type_traits:878:48: error: constructor required before non-static data member for ‘...’ has been parsed
```
Switching to std::is_trivially_{copy/move}_constructible fixes the error.
(cherry picked from commit
6a684dbc4433a33e5f94fb15c9e378a2408021e0)
Matt Arsenault [Tue, 25 Jul 2023 12:20:16 +0000 (08:20 -0400)]
HIP: Fix broken version check for deprecated macro
Remove test hack that was accidentally pushed.
(cherry picked from commit
73105a54725ec11165dd8c90ca3b7a0b1b9cd6e3)
Alexandros Lamprineas [Wed, 26 Jul 2023 18:09:35 +0000 (19:09 +0100)]
Revert "[FuncSpec] Add Phi nodes to the InstCostVisitor."
This reverts commit
03f1d09fe484f6c924434bc9c888e022b3514455
because of a crash reported on https://reviews.llvm.org/D154852
Christian Trott [Tue, 25 Jul 2023 18:25:17 +0000 (12:25 -0600)]
[libc++][mdspan] Fix uglification, categorize asserts and move tests
Fixes uglification in mdspan deduction guides, which CI
did not test for until recently. The CI modification
and mdspan testing overlapped, so mdspan landed with green
CI, and the CI modification landed too.
Make most assertions in mdspan and its helper classes
trigger during a hardened build in order to catch
out of bounds access errors.
Also moves all mdspan assertions tests from libcxx/test/std
to libcxx/test/libcxx.
Differential Revision: https://reviews.llvm.org/156181
Christian Trott [Tue, 25 Jul 2023 04:35:15 +0000 (22:35 -0600)]
[libc++][mdspan] Implement std::mdspan class
This implements P0009 std::mdspan ((https://wg21.link/p0009)),
a multidimensional span with customization points for
layouts and data access.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/154367
Jacek Caban [Tue, 25 Jul 2023 22:09:34 +0000 (00:09 +0200)]
[lldb] Treat ARM64X images as ARM64.
With D149091, ARM64X binaries are no longer reported as ARM64. This broke
lldb tests as Windows 11 system DLLs are mostly ARM64X binaries and lldb
doesn't know how to handle them. Ideally lldb would understand a bit more
about ARM64X and handle them as AMD64 in x64 processes, but this is
enough to preserve previous behavior and fix tests.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D156268
(cherry picked from commit
48feef277a24b1b9c0ff33267a91e70d9584012e)
esmeyi [Wed, 26 Jul 2023 02:47:11 +0000 (22:47 -0400)]
[XCOFF] Enable available_externally linkage for functions.
Summary: D80642 added support for emitting AvailableExternally Linkage on AIX. However, an assertion of "Trying to get csect representation of this symbol but none was set." occurred when a function is declared as available_externally. This is due to we missing to generate a csect for the function. This patch fixes it.
Reviewed By: hubert.reinterpretcast, shchenz
Differential Revision: https://reviews.llvm.org/D156213
Signed-off-by: Esme Yi <esme.yi@ibm.com>
(cherry picked from commit
e83b8a5e711a663c44e80965da5c747e08dea497)
Michael Halkenhaeuser [Tue, 25 Jul 2023 12:14:59 +0000 (08:14 -0400)]
[OpenMP] [OMPT] [7/8] Invoke tool-supplied callbacks before and after target launch and data transfer operations
Implemented RAII objects, initialized at target entry points, that
invoke tool-supplied callbacks. Updated status of target callbacks as
implemented.
Depends on D127365
Patch from John Mellor-Crummey <johnmc@rice.edu>
With contributions from:
Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>
Jan-Patrick Lehr <janpatrick.lehr@amd.com>
Reviewed By: jdoerfert, dhruvachak, jplehr
Differential Revision: https://reviews.llvm.org/D127367
(cherry picked from commit
1dec417ac4a533e40f637cd1a7f0628803d9e634)
Weining Lu [Wed, 26 Jul 2023 01:56:49 +0000 (09:56 +0800)]
Reland "[LoongArch] Support -march=native and -mtune="
As described in [1][2], `-mtune=` is used to select the type of target
microarchitecture, defaults to the value of `-march`. The set of
possible values should be a superset of `-march` values. Currently
possible values of `-march=` and `-mtune=` are `native`, `loongarch64`
and `la464`.
D136146 has supported `-march={loongarch64,la464}` and this patch adds
support for `-march=native` and `-mtune=`.
A new ProcessorModel called `loongarch64` is defined in LoongArch.td
to support `-mtune=loongarch64`.
`llvm::sys::getHostCPUName()` returns `generic` on unknown or future
LoongArch CPUs, e.g. the not yet added `la664`, leading to
`llvm::LoongArch::isValidArchName()` failing to parse the arch name.
In this case, use `loongarch64` as the default arch name for 64-bit
CPUs.
And these two preprocessor macros are defined:
- __loongarch_arch
- __loongarch_tune
[1]: https://github.com/loongson/LoongArch-Documentation/blob/2023.04.20/docs/LoongArch-toolchain-conventions-EN.adoc
[2]: https://github.com/loongson/la-softdev-convention/blob/v0.1/la-softdev-convention.adoc
Reviewed By: xen0n, wangleiat
Differential Revision: https://reviews.llvm.org/D155824
Kai Stierand [Tue, 25 Jul 2023 11:47:46 +0000 (13:47 +0200)]
[Clang] use unsigned integer constants in unit-test | fixes build error on ppc64le-lld-multistage-test
Fixes:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: warning: comparison of integer expressions of different signedness: ‘const unsigned int’ and ‘const int’ [-Wsign-compare]
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: warning: comparison of integer expressions of different signedness: ‘const long unsigned int’ and ‘const int’ [-Wsign-compare]
Reviewed By: cor3ntin
Differential Revision: https://reviews.llvm.org/D156224
Aaron Ballman [Tue, 25 Jul 2023 11:55:28 +0000 (07:55 -0400)]
Revert "[OpenMP] Add the `ompx_attribute` clause for target directives"
This reverts commit
ef9ec4bbcca2fa4f64df47bc426f1d1c59ea47e2.
The changes broke several bots:
https://lab.llvm.org/buildbot/#/builders/176/builds/3408
https://lab.llvm.org/buildbot/#/builders/198/builds/4028
https://lab.llvm.org/buildbot/#/builders/197/builds/8491
https://lab.llvm.org/buildbot/#/builders/197/builds/8491
Matt Arsenault [Tue, 22 Nov 2022 04:37:15 +0000 (23:37 -0500)]
HIP: Directly call nearbyint builtins
Matt Arsenault [Tue, 25 Jul 2023 11:50:08 +0000 (07:50 -0400)]
AMDGPU: Remove trailing whitespace from documentation
Matt Arsenault [Sun, 20 Nov 2022 16:40:25 +0000 (08:40 -0800)]
AMDGPU: Correctly expand f64 sqrt intrinsic
rocm-device-libs and llpc were avoiding using f64 sqrt
intrinsics in favor of their own expansions. Port the
expansion into the backend. Both of these users should be
updated to call the intrinsic instead.
The library and llpc expansions are slightly different.
llpc uses an ldexp to do the scale; the library uses a multiply.
Use ldexp to do the scale instead of the multiply.
I believe v_ldexp_f64 and v_mul_f64 are always the same number of
cycles, but it's cheaper to materialize the 32-bit integer constant
than the 64-bit double constant.
The libraries have another fast version of sqrt which will
be handled separately.
I am tempted to do this in an IR expansion instead. In the IR
we could take advantage of computeKnownFPClass to avoid
the 0-or-inf argument check.
Matt Arsenault [Tue, 20 Jun 2023 10:19:08 +0000 (06:19 -0400)]
AMDGPU: Add more sqrt f64 lowering tests
Almost all permutations of the flags are potentially relevant.
Matt Arsenault [Sun, 20 Nov 2022 16:44:50 +0000 (08:44 -0800)]
HIP: Directly call rint builtins
John Brawn [Wed, 28 Jun 2023 09:31:38 +0000 (10:31 +0100)]
[Sema] Fix handling of functions that hide classes
When a function is declared in the same scope as a class with the same
name then the function hides that class. Currently this is done by a
single check after the main loop in LookupResult::resolveKind, but
this can give the wrong result when we have a using declaration in
multiple namespace scopes in two different ways:
* When the using declaration is hidden in one namespace but not the
other we can end up considering only the hidden one when deciding
if the result is ambiguous, causing an incorrect "not ambiguous"
result.
* When two classes with the same name in different namespace scopes
are both hidden by using declarations this can result in
incorrectly deciding the result is ambiguous. There's currently a
comment saying this is expected, but I don't think that's correct.
Solve this by checking each Decl to see if it's hidden by some other
Decl in the same scope. This means we have to delay removing anything
from Decls until after the main loop, in case a Decl is hidden by
another that is removed due to being non-unique.
Differential Revision: https://reviews.llvm.org/D154503
Matt Arsenault [Mon, 24 Jul 2023 13:34:52 +0000 (09:34 -0400)]
Attributor: Fix typo
Alexandros Lamprineas [Tue, 25 Jul 2023 10:09:52 +0000 (11:09 +0100)]
[FuncSpec][NFC] Leave a comment for future improvements.
Adds a TODO for checking inlinining opportunities while traversing
the users of the specialization arguments. This was brought up in
the review of D154852.
4vtomat [Wed, 19 Jul 2023 02:10:18 +0000 (19:10 -0700)]
[RISCV] Remove zvk uimm constraints
Since the spec doesn't describe these behaviors as invalid,
the llvm-mc should just make them take care by hardware.
Differential Revision: https://reviews.llvm.org/D155669
Michael Halkenhaeuser [Tue, 25 Jul 2023 10:21:51 +0000 (06:21 -0400)]
Revert "[OpenMP] [OMPT] [7/8] Invoke tool-supplied callbacks before and after target launch and data transfer operations"
This reverts commit
00ccfcf9a6ee61c56cbe01d1e01b074797465fa4.
Paul Walker [Fri, 21 Jul 2023 15:18:20 +0000 (15:18 +0000)]
[SVE] Add vselect(mla/mls) patterns for cases where a multiplicand is used for the false lanes.
Differential Revision: https://reviews.llvm.org/D155972
Alexandros Lamprineas [Thu, 6 Jul 2023 17:09:32 +0000 (18:09 +0100)]
[FuncSpec] Add Phi nodes to the InstCostVisitor.
This patch allows constant folding of PHIs when estimating the user
bonus. Phi nodes are a special case since some of their inputs may
remain unresolved until all the specialization arguments have been
processed by the InstCostVisitor. Therefore, we keep a list of dead
basic blocks and then lazily visit the Phi nodes once the user bonus
has been computed for all the specialization arguments.
Differential Revision: https://reviews.llvm.org/D154852
Dmitry Chernenkov [Tue, 25 Jul 2023 09:58:57 +0000 (09:58 +0000)]
Goran Flegar [Tue, 25 Jul 2023 09:38:35 +0000 (11:38 +0200)]
Podchishchaeva, Mariya [Tue, 25 Jul 2023 09:32:16 +0000 (02:32 -0700)]
[NFC][clang] Fix static analyzer concerns
EHScopeStack doesn't seem to be intended for copy. It frees memory in
the destructor and doesn't have user-written copy c'tor and assignment
operator, so delete them to avoid using default ones which would do
wrong.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D156133
Daniel Krupp [Tue, 28 Feb 2023 13:45:23 +0000 (14:45 +0100)]
[clang][analyzer] Improved documentation for TaintPropagation Checker
The usage of the taint analysis is described through a command injection attack example.
It is explained how to make a variable sanitized through configuration.
Differential Revision: https://reviews.llvm.org/D145229
Simon Pilgrim [Tue, 25 Jul 2023 09:21:58 +0000 (10:21 +0100)]
Revert rGfae7b98c221b5b28797f7b56b656b6b819d99f27 "[Support] Change SetVector's default template parameter to SmallVector<*, 0>"
This is failing on Windows MSVC builds:
llvm\unittests\Support\ThreadPool.cpp(380): error C2440: 'return': cannot convert from 'Vector' to 'std::vector<llvm::BitVector,std::allocator<llvm::BitVector>>'
with
[
Vector=llvm::SmallVector<llvm::BitVector,0>
]
LLVM GN Syncbot [Tue, 25 Jul 2023 09:16:39 +0000 (09:16 +0000)]
[gn build] Port
6084ee742064
Weining Lu [Tue, 25 Jul 2023 08:31:23 +0000 (16:31 +0800)]
[docs] Add llvm & clang release notes for LoongArch
Differential Revision: https://reviews.llvm.org/D156195
WANG Xuerui [Tue, 25 Jul 2023 09:03:28 +0000 (17:03 +0800)]
[lld][ELF] Support LoongArch
This adds support for the LoongArch ELF psABI v2.00 [1] relocation
model to LLD. The deprecated stack-machine-based psABI v1 relocs are not
supported.
The code is tested by successfully bootstrapping a Gentoo/LoongArch
stage3, complete with common GNU userland tools and both the LLVM and
GNU toolchains (GNU toolchain is present only for building glibc,
LLVM+Clang+LLD are used for the rest). Large programs like QEMU are
tested to work as well.
[1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
Reviewed By: MaskRay, SixWeining
Differential Revision: https://reviews.llvm.org/D138135
David Sherwood [Mon, 24 Jul 2023 12:34:42 +0000 (12:34 +0000)]
[Clang][SVE] Permit specific predicate-as-counter registers in inline assembly
This patch adds the predicate-as-counter registers pn0-pn15 to the
list of supported registers used when writing inline assembly.
Tests added to
clang/test/CodeGen/aarch64-sve-inline-asm.c
Differential Revision: https://reviews.llvm.org/D156115
Kai Stierand [Tue, 25 Jul 2023 08:36:53 +0000 (10:36 +0200)]
[Clang] Fix crash in CIndex, when visiting a static_assert without message
After implementation of "[Clang] Implement P2741R3 - user-generated static_assert messages" (
47ccfd7a89e2a9a747a7114db18db1376324799c) the c indexer crashes when handling a `static_assert` w/o any message.
This is caused by using `dyn_cast` to get the literal string, which isn't working on `nullptr`.
Reviewed By: cor3ntin
Differential Revision: https://reviews.llvm.org/D156053
Cullen Rhodes [Tue, 25 Jul 2023 08:28:36 +0000 (08:28 +0000)]
[mlir][ArmSME] Add tile load op and extend tile store tile size support
This extends the existing 'arm_sme.tile_store' op to support all tile
sizes and adds a new op 'arm_sme.tile_load', as well as lowerings from
vector -> custom ops and custom ops -> intrinsics. Currently there's no
lowering for i128.
Depends on D154867
Reviewed By: awarzynski, dcaballe
Differential Revision: https://reviews.llvm.org/D155306
Kai Luo [Tue, 25 Jul 2023 08:21:43 +0000 (08:21 +0000)]
[JITLink][PowerPC] Pre-commit test for D155925. NFC.
Simi Pallipurath [Thu, 20 Jul 2023 09:26:45 +0000 (10:26 +0100)]
[clang][driver][NFC] Call IsARMBigEndain function only for isARM and isThumb.
IsARMBIgEndian function returns true only if:
1. The triples are either arm or thumb and the
commandline has the option -mbig-endian
2. The triples are either armeb or thumbeb.
Missing the checking of arm or thumb triples in the
first case pass through the --be8 endian flag to
linker For AArch64 as well which is not expected.
This is the regression happened from the previous
patch https://reviews.llvm.org/D154786.
It is better to refactor to only call IsARMBigEndian
for isARM and isthumb satisfying conditions which
keeps ARM and AArch64 separate.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155808
Jim Lin [Tue, 25 Jul 2023 05:14:27 +0000 (13:14 +0800)]
[RISCV] Merge rv32/rv64 vector narrowing integer right shift intrinsic tests that have the same content. NFC.
Jie Fu [Tue, 25 Jul 2023 07:56:40 +0000 (15:56 +0800)]
[AMDGPU] Remove unused variable 'CNI' in /AMDGPUMachineCFGStructurizer.cpp (NFC)
/Users/jiefu/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp:2603:10: error: variable 'CNI' set but not used [-Werror,-Wunused-but-set-variable]
auto CNI = CI;
^
1 error generated.
Fangrui Song [Tue, 25 Jul 2023 07:39:17 +0000 (00:39 -0700)]
[Support] Change SetVector's default template parameter to SmallVector<*, 0>
Similar to D156016 for MapVector.
Martin Storsjö [Tue, 25 Jul 2023 07:27:56 +0000 (10:27 +0300)]
Revert "[LV] Re-use existing broadcast value for live-ins."
This reverts commit
eea9258648ce73507f6f85c395de978af659d498.
That commit triggered crashes in the following testcase:
$ cat reduced.c
typedef struct {
int a[8]
} b;
typedef struct {
b *c;
short d
} e;
void f() {
int g;
char *h;
e *i = f;
short j = i->d;
int a = i->c->a[0];
for (;;)
for (; g < a; g++) {
*h = j * i->d >> 8;
h++;
}
}
$ clang -target aarch64-linux-gnu -w -c -O2 reduced.c
Craig Topper [Tue, 25 Jul 2023 07:20:05 +0000 (00:20 -0700)]
[DAGCombiner] Minor improvements to foldAndOrOfSETCC. NFC
Reduce the scope of some variables.
Replace an if with an assertion.
Reviewed By: kmitropoulou
Differential Revision: https://reviews.llvm.org/D156140
Craig Topper [Tue, 25 Jul 2023 05:55:24 +0000 (22:55 -0700)]
[RISCV] Don't print a tab after mnemonics that don't have operands.
Reviewed By: wangpc
Differential Revision: https://reviews.llvm.org/D156200
LiaoChunyu [Tue, 25 Jul 2023 06:07:01 +0000 (14:07 +0800)]
[RISCV] Match ext_vl+sra_vl/srl_vl+trunc_vector_vl to vnsra.wv/vnsrl.wv
similar to D117454, try to add vl patterns and testcases.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155466
Freddy Ye [Tue, 25 Jul 2023 05:47:45 +0000 (13:47 +0800)]
[X86] Support -march=graniterapids-d and update -march=graniterapids
Reviewed By: pengfei, RKSimon, skan
Differential Revision: https://reviews.llvm.org/D155798
pvanhout [Wed, 19 Jul 2023 13:33:28 +0000 (15:33 +0200)]
[AMDGPU] Allow vector access types in PromoteAllocaToVector
Depends on D152706
Solves SWDEV-408279
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D155699
pvanhout [Wed, 28 Jun 2023 10:22:26 +0000 (12:22 +0200)]
[AMDGPU] Use SSAUpdater in PromoteAlloca
This allows PromoteAlloca to not be reliant on a second SROA run to remove the alloca completely. It just does the full transformation directly.
Note PromoteAlloca is still reliant on SROA running first to
canonicalize the IR. For instance, PromoteAlloca will no longer handle aggregate types because those should be simplified by SROA before reaching the pass.
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D152706
Richard Smith [Tue, 25 Jul 2023 05:21:49 +0000 (22:21 -0700)]
Don't perform dynamic_cast optimization at -O0.
It seems preferable to avoid this optimization under -O0, and we're not
set up to emit speculative references to vtables at -O0 in general
anyway.
For #64088.
Johannes Doerfert [Fri, 3 Mar 2023 02:35:15 +0000 (18:35 -0800)]
[OpenMP] Add the `ompx_attribute` clause for target directives
CUDA and HIP have kernel attributes to tune the code generation (in the
backend). To reuse this functionality for OpenMP target regions we
introduce the `ompx_attribute` clause that takes these kernel
attributes and emits code as if they had been attached to the kernel
fuction (which is implicitly generated).
To limit the impact, we only support three kernel attributes:
`amdgpu_waves_per_eu`, for AMDGPU
`amdgpu_flat_work_group_size`, for AMDGPU
`launch_bounds`, for NVPTX
The existing implementations of those attributes are used for error
checking and code generation. `ompx_attribute` can be attached to any
executable target region and it can hold more than one kernel attribute.
Differential Revision: https://reviews.llvm.org/D156184
Fangrui Song [Tue, 25 Jul 2023 05:04:03 +0000 (22:04 -0700)]
[Support] Change MapVector's default template parameter to SmallVector<*, 0>
SmallVector<*, 0> is often a better replacement for std::vector :
both the object size and the code size are smaller.
(SmallMapVector uses SmallVector as well, but it is not common.)
clang size decreases by 0.0226%.
instructions:u decreases 0.037% when compiling a sqlite3 amalgram.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D156016
Fangrui Song [Tue, 25 Jul 2023 04:50:29 +0000 (21:50 -0700)]
[mlir-tblgen] Fix IWYU
Right now std::vector is instantiated with an incomplete element type,
which is ok but best to avoid.
Amir Ayupov [Tue, 25 Jul 2023 04:32:44 +0000 (21:32 -0700)]
[BOLT] Add blocks order kind to YAML profile header
Specify blocks order used in YAML profile. Needed to ensure profile backwards
compatibility with pre-D155514 DFS order by default.
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D156176
Kevin Gleason [Tue, 25 Jul 2023 03:39:40 +0000 (20:39 -0700)]
[mlir] Fix for MSVC bool splat issue encountered.
When building MLIR using bazel on windows with MSVC2019, bool splats
were being created incorrectly:
```
dense<[true,true,true,true]> : tensor<4xi1>
-(parse with mlir-opt)-> dense<[true, false, false, false]> : tensor<4xi1>
```
Appears that a Windows bazel build produces a corrupt DenseIntOrFPElementsAttr.
Unable to repro using MSVC and cmake.
Issue first discovered here:
https://github.com/google/jax/issues/16394
Added test point for reproduction:
```
$ bazel test @llvm-project//mlir/unittests:ir_tests --test_arg=--gtest_filter=DenseSplatTest.BoolSplatSmall
```
Differential Revision: https://reviews.llvm.org/D155745
David Blaikie [Tue, 25 Jul 2023 02:32:04 +0000 (02:32 +0000)]
test/.../print-dot-dom.ll: Avoid writing to cwd of test by creating/cding into %t instead
The cwd of the test might not be writable.
David Blaikie [Wed, 19 Jul 2023 18:42:57 +0000 (18:42 +0000)]
ADT: ArrayRef: Assert that begin <= end
This came up in the context of #63169 - if this assert were in place it
would've been much easier to reduce the test case.
Chuanqi Xu [Tue, 25 Jul 2023 02:55:15 +0000 (10:55 +0800)]
Revert "[C++20] [Modules] Use CanonicalType for base classes"
Close https://github.com/llvm/llvm-project/issues/64091
This reverts commit
f82df0b285acd8a7115f0bfc55ce44474251c2d1 and add a
test from https://github.com/llvm/llvm-project/issues/64091
Freddy Ye [Tue, 25 Jul 2023 03:00:04 +0000 (11:00 +0800)]
[X86] Update features for sierraforest, grandridge
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D155784
Zheng Qian [Tue, 25 Jul 2023 02:49:58 +0000 (22:49 -0400)]
Add new option -fkeep-persistent-storage-variables to Clang release notes
This patch updates the Clang release notes with the new option
-fkeep-persistent-storage-variables added in
bb6ab91b1dcd.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D155501
Mehdi Amini [Tue, 25 Jul 2023 02:47:23 +0000 (19:47 -0700)]
Fix MLIR test pass crash
The pass tried to fold in reverse-post-order, but it cause an issue
when a parent is folded before the chilren as they will still be
present in the worklist.
Use reverse-preorder instead here.
Fixes #64089
Nikolas Klauser [Tue, 25 Jul 2023 02:53:39 +0000 (19:53 -0700)]
[libc++] Fix template parameter naming and enforce it through readability-identifier-naming
Reviewed By: #libc, Mordante
Spies: Mordante, aheejin, libcxx-commits
Differential Revision: https://reviews.llvm.org/D156059
Advenam Tacet [Mon, 24 Jul 2023 19:00:56 +0000 (21:00 +0200)]
[NFC] Fix release notes about ASan
Existing notes were not fully correct and were missing a detail:
- `std::vector` was annotated long time ago,
- `std::deque` annotations are new,
- now container annotations were extended to all allocators (support in ASan API exists since LLVM16).
Reviewed By: philnik, #libc
Differential Revision: https://reviews.llvm.org/D156162
Jordan Rupprecht [Tue, 25 Jul 2023 02:33:33 +0000 (19:33 -0700)]
[bazel] Add UPToSPIRV library/dep
Added in D156163
Gedare Bloom [Tue, 25 Jul 2023 02:13:33 +0000 (19:13 -0700)]
[clang-format] Add SpacesInParens with SpacesInParensOptions
This is a refactoring of:
- SpacesInConditionalStatement
- SpacesInCStyleCastParentheses
- SpaceInEmptyParentheses
- SpacesInParentheses
These are now options under the new Style Option: SpacesInParens. The
existing options are maintained for backward compatibility.
Within SpacesInParens, there are currently options for:
- Never
- Custom
The currently available options for Custom are:
- InConditionalStatements
- InCStyleCasts
- InEmptyParentheses
- Other
Setting InConditionalStatements and Other to true enables the same space
additions as SpacesInParentheses.
This refactoring does not add or remove any existing features, but it makes
it possible to more easily extend and maintain the addition of spaces within
parentheses.
Related to #55428.
Differential Revision: https://reviews.llvm.org/D155239
Jim Lin [Tue, 25 Jul 2023 00:31:04 +0000 (08:31 +0800)]
[RISCV] Add a common class for cm.push, cm.popret, cm.popretz and cm.pop.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D156092
WANG Rui [Tue, 25 Jul 2023 01:39:47 +0000 (09:39 +0800)]
[LoongArch] Implement isSExtCheaperThanZExt
Implement isSExtCheaperThanZExt.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Differential Revision: https://reviews.llvm.org/D154919
Galen Elias [Tue, 25 Jul 2023 01:05:51 +0000 (18:05 -0700)]
[clang-format] Add AlignConsecutiveShortCaseStatements
This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabelsOnASingleLine is enabled will align the tokens after the
case statement's colon. This also adds a AlignCaseColons option to allow
aligning the case label colon itself rather than the token after it.
Fixes #55475.
Differential Revision: https://reviews.llvm.org/D151761
Owen Pan [Tue, 25 Jul 2023 01:36:53 +0000 (18:36 -0700)]
Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"
This reverts commit
4ba00844174db562d2bd8b15dab6aac605eddf57.
WANG Rui [Tue, 25 Jul 2023 01:22:18 +0000 (09:22 +0800)]
[LoongArch] Add test case showing suboptimal codegen when zero extending
Add test case showing suboptimal codegen when zero extending.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed By: xen0n
Differential Revision: https://reviews.llvm.org/D154918
Owen Pan [Tue, 25 Jul 2023 01:24:30 +0000 (18:24 -0700)]
Revert "Revert "[clang-format] Add AlignConsecutiveShortCaseStatements""
This reverts commit
4f093b31669a4f8e417259583141159586a05b28.
Owen Pan [Tue, 25 Jul 2023 01:18:27 +0000 (18:18 -0700)]
Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"
This reverts commit
4ba00844174db562d2bd8b15dab6aac605eddf57 due to missing
authorship.
Weining Lu [Tue, 25 Jul 2023 01:16:28 +0000 (09:16 +0800)]
Revert "[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour"
This reverts commit
c299efbf284fae92bb8d7d29110f76912f089daf.
Reason to revert: D142327 has been reverted which is depended by this
change.
Mehdi Amini [Fri, 21 Jul 2023 05:51:35 +0000 (22:51 -0700)]
Update ODS variadic segments "magic" attributes to use native Properties
The operand_segment_sizes and result_segment_sizes Attributes are now inlined
in the operation as native propertie. We continue to support building an
Attribute on the fly for `getAttr("operand_segment_sizes")` and setting the
property from an attribute with `setAttr("operand_segment_sizes", attr)`.
A new bytecode version is introduced to support backward compatibility and
backdeployments.
Differential Revision: https://reviews.llvm.org/D155919
Owen Pan [Tue, 25 Jul 2023 01:05:51 +0000 (18:05 -0700)]
[clang-format] Add AlignConsecutiveShortCaseStatements
This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabelsOnASingleLine is enabled will align the tokens after the
case statement's colon. This also adds a AlignCaseColons option to allow
aligning the case label colon itself rather than the token after it.
Fixes #55475.
Differential Revision: https://reviews.llvm.org/D151761
chenli [Tue, 25 Jul 2023 01:02:14 +0000 (09:02 +0800)]
[LoongArch] Support InlineAsm for LSX and LASX
The author of the following files is licongtian <licongtian@loongson.cn>:
- clang/lib/Basic/Targets/LoongArch.cpp
- llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
- llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
The files mentioned above implement InlineAsm for LSX and LASX as follows:
- Enable clang parsing LSX/LASX register name, such as $vr0.
- Support the case which operand type is 128bit or 256bit when the
constraints is 'f'.
- Support the way of specifying LSX/LASX register by using constraint,
such as "={$xr0}".
- Support the operand modifiers 'u' and 'w'.
- Support and legalize the data types and register classes involved in
LSX/LASX in the lowering process.
Reviewed By: xen0n, SixWeining
Differential Revision: https://reviews.llvm.org/D154931
Weining Lu [Tue, 25 Jul 2023 00:58:41 +0000 (08:58 +0800)]
[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour
GCC doesn't ignore non-zero-length array of empty structures in C++
while clang does. What this patch did is to match GCC's behaviour
although this rule is not documented in psABI.
Similar to D142327 for RISCV.
Reviewed By: xry111, xen0n
Differential Revision: https://reviews.llvm.org/D156116
Weining Lu [Tue, 25 Jul 2023 00:58:32 +0000 (08:58 +0800)]
[Clang][LoongArch] Pre-commit test for D156116
Differential Revision: https://reviews.llvm.org/D156114
Mehdi Amini [Tue, 25 Jul 2023 00:57:55 +0000 (17:57 -0700)]
Cleanup CMake dependencies from unnecessary libraries in mlir/test/lib/Dialect/GPU/CMakeLists.txt (NFC)