470192 Commits

Author SHA1 Message Date
Nikolas Klauser
3537338d1a [libc++][libunwind] Fixes to allow GCC 13 to compile libunwind/libc++abi/libc++
These are changes to allow GCC 13 to successfully compile the runtimes stack.

Reviewed By: ldionne, #libc, #libunwind, MaskRay

Spies: MaskRay, zibi, SeanP, power-llvm-team, mstorsjo, arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D151387
2023-08-04 00:51:43 -07:00
Piyou Chen
2df05cd01c [RISCV] Support overloaded version ntlh intrinsic function
Here is the proposal https://github.com/riscv-non-isa/riscv-c-api-doc/pull/47.

The version that omit the domain argument imply domain=__RISCV_NTLH_ALL.

```
type __riscv_ntl_load (type *ptr);
void __riscv_ntl_store (type *ptr, type val);
```

Reviewed By: kito-cheng, craig.topper

Differential Revision: https://reviews.llvm.org/D156221
2023-08-04 00:39:25 -07:00
ManuelJBrito
b80ff2fec6 [NewGVN] Only perform symbolic evaluation on instructions (NFC)
This patch restricts the argument of performSymbolicEvaluation to an Instruction
and simplifies the code accordingly.

Differential Revision: https://reviews.llvm.org/D156994
2023-08-04 08:27:09 +01:00
Konstantin Varlamov
1cf970db4e [libc++][print] Make <print> tests require file system support.
`print` functions require `FILE` and `stdout` to be available and cause
compilation errors on platforms that don't support the file system.

Differential Revision: https://reviews.llvm.org/D156585
2023-08-04 00:23:49 -07:00
Konstantin Varlamov
000d2b8582 [libc++][hardening][NFC] Rework the Lit feature for detecting the hardening mode.
Make it a multichoice string to closer mirror the CMake variable. This
allows writing `UNSUPPORTED: libcpp-hardening-mode=unchecked` rather
than `UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode`.

Differential Revision: https://reviews.llvm.org/D155906
2023-08-04 00:21:55 -07:00
Yi Kong
b82c2b9ac2 Reland "Fix __cfi_check not aligned to 4k on relocatable files with no executable code"
This reverts commit a093598e50e7b252205f1164751ac9c74874e254.

Fixed test breakage.
2023-08-04 16:02:27 +09:00
Adrian Kuegel
50665511c7 [mlir] Apply ClangTidy fixes (NFC)
Remove redundant returns at end of function.
2023-08-04 08:44:20 +02:00
Kazu Hirata
26474391aa [Transforms] Remove unused forward declaration PostDominatorTree
The last use was removed by:

  commit b1f41685a60e5416af8f636393bffd03ac4c13f5
  Author: Alexandros Lamprineas <alexandros.lamprineas@arm.com>
  Date:   Thu Jun 1 15:09:08 2023 +0100
2023-08-03 23:21:07 -07:00
Justin Bogner
121e15f96c [Driver] Minor formatting fixes in Options.td. NFC 2023-08-03 22:55:22 -07:00
Justin Bogner
7affa07cad [Driver] Remove Flags from cl_Group. NFC
These flags are redundant since everything in the `cl_Group`
explicitly sets flags anyway. Remove the Flags because they're
confusing and will cause problems with some later refactorings.
2023-08-03 22:55:22 -07:00
Raghu Maddhipatla
71d763b88d [OpenMP] [Semantics] [Flang] Adding more semantic checks for USE_DEVICE_PTR and USE_DEVICE_ADDR clauses.
The following restrictions for USE_DEVICE_PTR and USE_DEVICE_ADDR clauses on OMP TARGET DATA directive are implemented in this patch.

  - A list item may not be specified more than once in use_device_ptr clauses that appear on the directive.
  - A list item may not be specified more than once in use_device_addr clauses that appear on the directive.
  - A list item may not be specified in both a use_device_addr clause and a use_device_ptr clause on the directive.
  - A list item that appears in a use_device_ptr or use_device_addr clause must not be a structure element.
  - A list item that appears in a use_device_ptr must be of type C_PTR.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D155133
2023-08-04 00:19:36 -05:00
Jan Svoboda
8fd56ea112 [clang][deps] NFC: Speed up canonical context hash computation
This patch makes use of the infrastructure established in D157046 to speed up computation of the canonical context hash in the dependency scanner. This is somewhat hot code, since it's ran for all modules in the dependency graph of every TU.

I also tried an alternative approach that tried to avoid allocations as much as possible (essentially doing `HashBuilder.add(Arg.toStringRef(ArgVec))`), but that turned out to be slower than approach in this patch.

Note that this is not problematic in the same way command-line hashing used to be prior D143027. The lambda is now being called even for constant strings.

Depends on D157046.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157052
2023-08-03 20:36:34 -07:00
Jan Svoboda
acd1ab869f [clang] NFC: Avoid double allocation when generating command line
This patch makes use of the infrastructure established in D157046 to avoid needless allocations via `StringSaver`.

Depends on D157046.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157048
2023-08-03 20:35:42 -07:00
Jan Svoboda
8345265049 [clang] Abstract away string allocation in command line generation
This patch abstracts away the string allocation and vector push-back from command line generation. Instead, **all** generated arguments are passed into `ArgumentConsumer`, which may choose to do the string allocation and vector push-back, or something else entirely.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157046
2023-08-03 20:35:00 -07:00
Kai Luo
be7a54655c [JITLink][ELF] Fix reading target architecture when the ELF object is big-endian
Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D156982
2023-08-04 10:55:38 +08:00
Freddy Ye
dc7c0181ef [X86] Promote VAES, SHA512, SM4 implied feature to AVX2
Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D155662
2023-08-04 10:43:34 +08:00
Fangrui Song
5fd5f8027f [Driver] Mark m_x86_Features_Group options as TargetSpecific
so that they lead to an error when compiled for non-x86 targets.
Follow-up to D151590.

```
% aarch64-linux-gnu-gcc -c -mavx a.c
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mavx’
% clang --target=aarch64-unknown-linux-gnu -c -mavx a.c  # without this patch
clang: warning: argument unused during compilation: '-mavx' [-Wunused-command-line-argument]
...

% clang --target=aarch64-unknown-linux-gnu -c -mavx a.c  # with this patch
clang: error: unsupported option '-mavx' for target 'aarch64-unknown-linux-gnu'
```

As a workaround for https://github.com/llvm/llvm-project/issues/63270, we don't
report an error for -msse4.2.

Reviewed By: pengfei, skan

Differential Revision: https://reviews.llvm.org/D156962
2023-08-03 19:04:53 -07:00
Shilei Tian
fcf1a1022a [OMPX] Change thread_dim to block_dim and the original block_dim to grid_dim
There is no `threadDim` in CUDA. Instead, it is `blockDim`. Then the current
`blockDim` is `gridDim` in CUDA.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D157051
2023-08-03 21:51:06 -04:00
Shilei Tian
c171ed4693 [OpenMP] Fix the linkage for kernel environment global variable
This patch fixes the issue that multiple definition of kernel environment global
variables can occur because of wrong linkage.

Fixes #64284.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D156955
2023-08-03 21:33:31 -04:00
Zhongyunde
68ea002a63 [InstSimplify] Check the NonZero for power of two value
Fixes https://github.com/llvm/llvm-project/issues/64339

proofs: https://alive2.llvm.org/ce/z/yZ_I2a

Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D156881
2023-08-04 09:14:45 +08:00
Zhongyunde
9c837b7d0e [ValueTracking] Improve the coverage of isKnownToBeAPowerOfTwo for vscale
this PR tries to match the following pattern, seperate from D156881
     ```
     %vscale = call i64 @llvm.vscale.i64()
     %shift = shl nuw nsw i64 %vscale, 11
     ```
Now, we only check the shl recursively when the OrZero is true.

Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D157062
2023-08-04 09:06:34 +08:00
Alex Langford
08dc847d55 [lldb][NFCI] Add SBTraceCursor.h to swig headers file
Differential Revision: https://reviews.llvm.org/D156934
2023-08-03 16:41:17 -07:00
Alexey Bataev
58b0d7c34d [SLP]Improve stores vectorization.
Use O(nlogn) instead of O(N2) (N <= 32) sorting approach and do not try
to revectorize all possible combinations of stores, if they
definitely cannot be combined because of mem/data dependencies.
Compile time (O3 + lto, skylake_avx512):
External/SPEC/CINT2006/483.xalancbmk/483.xalancbmk.test 117.15       120.11     2.5%
External/SPEC/CINT2017speed/623.xalancbmk_s/623.xalancbmk_s.test 203.67       207.42     1.8%
External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 232.43       235.01     1.1%
External/SPEC/CINT2017rate/523.xalancbmk_r/523.xalancbmk_r.test 205.49       207.25     0.9%
External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test 310.46       306.23    -1.4%

Link time (O3+lto, skylake_avx512):
External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 1383.69   1475.94    6.7%

Other changes are too small, cannot rely on them.

size..text
Program                                                                                                           size..text
                                                                                                                  results     results0    diff
                                               test-suite :: SingleSource/Regression/C/Regression-C-sumarray.test      392.00     1439.00 267.1%
                                                     test-suite :: MultiSource/Applications/JM/ldecod/ldecod.test   394258.00   394818.00   0.1%
                                                     test-suite :: MultiSource/Applications/JM/lencod/lencod.test   846355.00   847075.00   0.1%
                                                test-suite :: External/SPEC/CINT2006/464.h264ref/464.h264ref.test   782816.00   783360.00   0.1%
                                               test-suite :: External/SPEC/CFP2017rate/508.namd_r/508.namd_r.test   779667.00   779923.00   0.0%
                                                   test-suite :: MultiSource/Benchmarks/mafft/pairlocalalign.test   224398.00   224446.00   0.0%
                                                        test-suite :: MultiSource/Applications/oggenc/oggenc.test   185019.00   185035.00   0.0%
                                         test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 12487610.00 12488010.00   0.0%
                                                    test-suite :: MultiSource/Benchmarks/7zip/7zip-benchmark.test  1051772.00  1051804.00   0.0%
                                                          test-suite :: MultiSource/Applications/SPASS/SPASS.test   529586.00   529602.00   0.0%
                                            test-suite :: External/SPEC/CINT2006/400.perlbench/400.perlbench.test  1084684.00  1084716.00   0.0%
                                                  test-suite :: MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.test  1014245.00  1014261.00   0.0%

                                          test-suite :: MultiSource/Benchmarks/MallocBench/espresso/espresso.test   223494.00   223478.00  -0.0%
                                             test-suite :: External/SPEC/CINT2017speed/625.x264_s/625.x264_s.test   660843.00   660795.00  -0.0%
                                              test-suite :: External/SPEC/CINT2017rate/525.x264_r/525.x264_r.test   660843.00   660795.00  -0.0%
                                                      test-suite :: MultiSource/Applications/ClamAV/clamscan.test   568824.00   568760.00  -0.0%

espresso - 2 more stores vectorized
x264 - small number of changes in 3-4 functions, generated a bit more
vector stores (2 4x zeroinitializer stores + some other small variations).
clamscan - emitted 32xi8 store instead of several scalar stores + several 4x-8x stores.

Differential Revision: https://reviews.llvm.org/D155246
2023-08-03 16:14:21 -07:00
Alex Voicu
7240008c0a [Clang][CodeGen] __dynamic_cast should care about type_info's address space
`__dynamic_cast` relies on `type_info`, which its signature assumed to be in the generic / default address space. This patch corrects the oversight (we know that `type_info` resides in the GlobalVar address space)  and adds an associated test.

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D155870
2023-08-03 23:25:06 +01:00
Chia-hung Duan
3ef766adda [scudo] Specify memory order while using atomic_compare_exchange
`atomic_compare_exchange` was using `_strong` and `memory_order_acquire`
by default. This is not aligned with general use, for example, in C++,
the default is `memory_order_seq_cst`. To reduce the ambiguity, make the
version and ordering explicitly.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D156952
2023-08-03 22:15:13 +00:00
Jan Svoboda
243bc75049 [clang][cli] Accept option spelling as Twine
This will make it possible to accept the spelling as `StringLiteral` in D157029 and avoid some unnecessary allocations in a later patch.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157035
2023-08-03 15:09:52 -07:00
Zhen Wang
c5abddbf29 Enable CUDA Fortran for bbc 2023-08-03 14:04:03 -07:00
Bjorn Pettersson
4ce7c4a92a [llvm] Drop some typed pointer handling/bitcasts
Differential Revision: https://reviews.llvm.org/D157016
2023-08-03 22:54:33 +02:00
Bjorn Pettersson
2bdc86484d [clang][CodeGen] Drop some typed pointer bitcasts
Differential Revision: https://reviews.llvm.org/D156911
2023-08-03 22:54:33 +02:00
Florian Hahn
deec9e7674
[VPlan] Move VPTransformState::get() to VPlan.cpp (NFC).
The last dependency of code defined in LoopVectorize.cpp has been
removed a while ago. Move VPTransformState::get() to VPlan.cpp where
other members are also defined.
2023-08-03 21:49:58 +01:00
Andrzej Warzynski
8cacabe473 [mlir] Add an integration test for masked vectorisation for linalg.matmul
Differential Revision: https://reviews.llvm.org/D156823
2023-08-03 20:14:35 +00:00
Andrew Lenharth
d5c2204cfc [TableGen] OpInterface inheritance duplicates bases
OpInterface inheritance will duplicate base interfaces, causing compilation failure.  Unique the set of base interfaces.

Reviewed By: rriddle, jdd

Differential Revision: https://reviews.llvm.org/D156964
2023-08-03 15:09:03 -05:00
Tom Yang
9a3f0cd717 Fix crash in lldb-vscode when missing function name
Summary:
In cases where the PC has no function name, lldb-vscode crashes.

`lldb::SBFrame::GetDisplayFunctionName()` returns a `nullptr`, and when we
attempt to construct an `std::string`, it raises an exception.

Test plan:
This can be observed with creating a test file (credit to @clayborg for
the example):
```
int main() {
  typedef void (*FooCallback)();
  FooCallback foo_callback = (FooCallback)0;
  foo_callback(); // Crash at zero!
  return 0;
}
```
and attempting to debug the file through VSCode.

I add a test case in D156732 which should cover this.

Differential Revision: https://reviews.llvm.org/D156970
2023-08-03 12:56:37 -07:00
Emilio Cota
6537181de4 [bazel] fix typo in 0575ab2d46 [mlir][tensor][transform][python] Add mix-in class 2023-08-03 15:21:13 -04:00
Krishna-13-cyber
54081868dd [clang-repl] Remove redundant subsections from the table of content.
Differential revision: https://reviews.llvm.org/D156877
2023-08-03 19:16:18 +00:00
Kiran Chandramohan
93b0d0f6b5 [Flang][OpenMP] Add TODO message for copyprivate clause
The copyprivate clause is not yet implemented. Provide a TODO
error message when this clause is seen.

Reviewed By: NimishMishra

Differential Revision: https://reviews.llvm.org/D155596
2023-08-03 18:51:27 +00:00
Craig Topper
40f3708205 [RISCV] Add a test case that would have failed before D156974. NFC
Tweak the immediate on two vror.vi test cases to use a uimm6 immediate
that would have failed before D156974 when we were looking for a simm6
immediate.
2023-08-03 11:23:55 -07:00
Volodymyr Sapsai
32056aa344
[docs] Fix doxygen markers for grouping methods. NFC. 2023-08-03 11:16:42 -07:00
Jan Svoboda
efcb07bf6e [llvm][Support] Avoid intermediate heap allocations in StringSaver
The `Twine::str()` function currently always allocates heap memory via `std::string`. However, some instances of `Twine` don't need an intermediate buffer at all, and the rest can attempt to print into a stack buffer first.

This is intentionally not making use of `Twine::isSingleStringLiteral()` from D157010 to skip saving the string in the bump-pointer allocator, since the `StringSaver` documentation suggests that MUST happen for every given string.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157015
2023-08-03 11:12:05 -07:00
Rainer Orth
43dfe0f08e [Driver] Allow for sparcv8plus subdir with Solaris/SPARC GCC
Since GCC 11, the bundled Solaris/SPARC GCC uses the `sparcv8plus`
subdirectory for 32-bit objects, just like upstream GCC.  Before that, it
used `32` instead from a local patch.

Since `clang` doesn't know about that `sparcv8plus` subdirectory, it
wouldn't properly use GCC 11+ installations.

The new `solaris-sparc-gcc-search.test` testcase wasn't run initially (like
the existing `crash-report-null.test`) because the `.test` suffix wasn't
handled.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D157013
2023-08-03 20:01:13 +02:00
Jan Svoboda
673d963436 [llvm][ADT] Make Twine aware of StringLiteral
The `const char *` storage backing StringLiteral has static lifetime. Making `Twine` aware of that allows us to avoid allocating heap memory in some contexts (e.g. avoid passing it to `StringSaver::save()` in a follow-up Clang patch).

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157010
2023-08-03 10:52:57 -07:00
Alexander Yermolovich
e1ceae4b60 [BOLT][DWARF] Fix setting DW_AT_ranges offset of Skeleton CU
Fixed a bug where when Skelton CU had DW_AT_ranges, it the output CU DW_AT_ranges
 offset was relative, and not absolute.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D156958
2023-08-03 10:34:21 -07:00
Alexander Yermolovich
efb8a1c906 [BOLT][DWARF] Delete DW_AT_low_pc when converting to ranges
Now that we have new DWARF Rewriter we can remove DW_AT_low_pc when converting
DW_AT_low_pc/DW_AT_high_pc to DW_AT_ranges. Which closer follows DWARF spec.
Leaving CU DW_AT_low_pc in place. Reading the spec I think it's needed.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D156957
2023-08-03 10:33:04 -07:00
Valentin Clement
b82c259370
[flang][openacc] Add lowering support for the link clause on OpenACC declare
Lower link clause with data entry operation.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D156913
2023-08-03 10:22:32 -07:00
Zequan Wu
4b08be77c9 Revert "[Profile] Remove duplicate file locks when enabled continuous mode and online merging."
This reverts commit 985486dca48bffd9e991d9f5ac32e1d109ae000f.

This seems to cause malformed profdata: crbug.com/1469456
2023-08-03 13:09:33 -04:00
Nikolas Klauser
b63ac56ac4 [libc++] Update clang-tidy configuration for the tests
This is to avoid clang-tidy complaining all over the tests that the naming is wrong.
2023-08-03 09:40:48 -07:00
Nikolas Klauser
ae381cf9f2 [libc++] Fix PSTL status 2023-08-03 09:32:54 -07:00
Jay Foad
186b2b48e0 [PEI] Switch to backwards frame index elimination by default
Also rename the flag from supportsBackwardScavenger to
eliminateFrameIndicesBackwards to reflect what it actually does.

X86 is the only target still using forwards frame index elimination.
This will not block removing support for forwards register scavenging,
because X86 does not use the register scavenger.

Differential Revision: https://reviews.llvm.org/D156983
2023-08-03 17:20:32 +01:00
Benjamin Maxwell
dbf798fa64 [mlir] Fix generating checks for multiple funcs in generate-test-checks
This regressed in D154458 due to the added tracking of used variable
names that now also has to be cleared alongside the counter.

Reviewed By: rafaelubalmw, c-rhodes, awarzynski

Differential Revision: https://reviews.llvm.org/D156547
2023-08-03 15:55:03 +00:00
Nikolas Klauser
dcdcc7c804 [libc++][NFC] Replace typedefs with using in the math headers
Reviewed By: #libc, Mordante, ldionne

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D155382
2023-08-03 08:51:50 -07:00