460847 Commits

Author SHA1 Message Date
Sam James
94f7c961c7 [cmake] Disable GCC lifetime DSE
LLVM data structures like llvm::User and llvm::MDNode rely on
the value of object storage persisting beyond the lifetime of the
object (#24952).  This is not standard compliant and causes a runtime
crash if LLVM is built with GCC and LTO enabled (#57740).  Until
these issues are fixed, we need to disable dead store eliminations
eliminations based on object lifetime.

Bug: https://github.com/llvm/llvm-project/issues/24952
Bug: https://github.com/llvm/llvm-project/issues/57740
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106943

Reviewed By: MaskRay, thesamesam, nikic

Differential Revision: https://reviews.llvm.org/D150505
2023-05-13 20:34:05 +01:00
Amir Ayupov
76b2915fdb [Clang][CMake] Use perf-training for Clang-BOLT
Leverage perf-training flow for BOLT profile collection, enabling reproducible
BOLT optimization. Remove the use of bootstrapped build for profile collection.

Test Plan:
- Regular (single-stage) build
```
$ cmake ... -C .../clang/cmake/caches/BOLT.cmake
$ ninja clang-bolt
...
[21/24] Instrumenting clang binary with BOLT
[21/24] Generating BOLT profile for Clang
[23/24] Merging BOLT fdata
Profile from 2 files merged.
[24/24] Optimizing Clang with BOLT
...
          1291202496 : executed instructions (-1.1%)
            27005133 : taken branches (-71.5%)
...
```
- Two stage build (ThinLTO+InstPGO)
```
$ cmake ... -C .../clang/cmake/caches/BOLT.cmake -C .../clang/cmake/caches/BOLT-PGO.cmake
$ ninja clang-bolt
$ ninja stage2-clang-bolt
...
[2756/2759] Instrumenting clang binary with BOLT
[2756/2759] Generating BOLT profile for Clang
[2758/2759] Merging BOLT fdata
[2759/2759] Optimizing Clang with BOLT
...
BOLT-INFO: 7092 out of 184104 functions in the binary (3.9%) have non-empty execution profile
           756531927 : executed instructions (-0.5%)
            15399400 : taken branches (-40.3%)
...
```

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D143553
2023-05-13 10:36:29 -07:00
Nico Weber
c19c248466 [gn] port 88c1242ed7e1 (begone, LLVMExegesisARMTests) 2023-05-13 17:16:23 +02:00
Florian Hahn
f40a7901d1
[LV] Move selecting vectorization factor logic to LVP (NFC).
Split off from D143938. This moves the planning logic to select the
vectorization factor to LoopVectorizationPlanner as a step towards only
computing costs for individual VFs in LoopVectorizationCostModel and do
planning in LVP.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D150197
2023-05-13 12:28:14 +01:00
Florian Hahn
7472f1da96
[VPlan] Change LoopVectorizationPlanner::TTI to be const reference (NFC) 2023-05-13 12:27:57 +01:00
Uday Bondhugula
c40277f107 [MLIR] NFC. Pass affine copy options by const ref
NFC. Pass affine copy options by const ref.

Differential Revision: https://reviews.llvm.org/D150507
2023-05-13 15:37:05 +05:30
Mark de Wever
65429b9af6 Reland "[CMake] Bumps minimum version to 3.20.0."
The owner of the last two failing buildbots updated CMake.

This reverts commit e8e8707b4aa6e4cc04c0cffb2de01d2de71165fc.
2023-05-13 11:42:25 +02:00
Job Noorman
946e7aa6dc [llvm-jitlink] Pass object features when creating MCSubtargetInfo
The reason for this patch is to allow the MCDisassembler used in tests
to disassemble instructions that are only available when a specific
feature is enabled.

For example, on RISC-V it's currently not possible to use
decode_operand() on a compressed instruction. This patch fixes this.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D149523
2023-05-13 11:36:47 +02:00
Mark de Wever
62858636f5 [NFC][libc++][format] Tests formatter requirements.
Like done D149543 this validates the other formatter specializations.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150041
2023-05-13 11:21:15 +02:00
Florian Hahn
0418d0242b
[LV] Move getVScaleForTuning out of LoopVectorizationCostModel (NFC).
Split off refactoring from D150197 to reduce diff.
2023-05-13 10:17:13 +01:00
Aiden Grossman
9fe45fcba7 [Docs][llvm-exegesis] Specify supported platforms and architectures
Currently, there is no documentation on what platforms and architectures
llvm-exegesis is supported on. This patch adds in user-facing
documentation in the CommandGuide about what architectures are supported
as well as developer facing documentation detailing the technical
reasons for why certain platforms are supported and some aren't.

This is a follow-up after discussion in
https://discourse.llvm.org/t/clarification-on-platform-support-for-llvm-exegesis/70206.

Reviewed By: kpdev42

Differential Revision: https://reviews.llvm.org/D149378
2023-05-13 09:05:39 +00:00
Aiden Grossman
88c1242ed7 [llvm-exegesis] Remove Assembler Tests
The Assembler tests have been disabled for years in tree and at this
point don't test anything other than common MC infrastructure that is
already tested in other parts of the tree. This patch removes them due
to the mentioned reasons.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D149819
2023-05-13 08:56:58 +00:00
Aiden Grossman
db63fb5d45 [Clang][Docs] Fix man page build
This patch fixes the man page build. It currently doesn't work as
SOURCE_DIR isn't set correctly (just undefined) within the
add_sphinx_target function. This patch also moves around the creation of
targets for autogenerated rst files so that both the man page and html
build can depend upon them as before only the html build depended on
them.

Fixes #62540

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D149809
2023-05-13 08:51:10 +00:00
Florian Hahn
0e8717f711
[Matrix] Add shape verification.
At the moment, lower-matrix-intrinsics accepts mis-matches between
shapes for operations. See shape-verification.ll for an example where
@llvm.matrix.column.major.load specifies 6x1 and then the use
(@llvm.matrix.multiply) specifies the operand to have 1x6.

This patch adds verification for shapes to check if shapes match.

Reviewed By: thegameg

Differential Revision: https://reviews.llvm.org/D147438
2023-05-13 09:41:27 +01:00
Fangrui Song
c01ea0515f [test] Driver/ftime-trace.cpp: work around -Wmsvc-not-found
There may be one extra warning. Just make the check less strict.
```
clang: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
clang: warning: argument unused during compilation: '-ftime-trace' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-ftime-trace=e' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-ftime-trace-granularity=1' [-Wunused-command-line-argument]
```
2023-05-13 00:22:05 -07:00
Fangrui Song
2473b1af08 [ELF] Simplify getSectionRank and rewrite comments
Replace some RF_ flags with integer literals.
Rewrite the isWrite/isExec block to make the code block order reflect
the section order.
Rewrite some imprecise comments.

This is NFC, if we don't count invalid cases such as non-writable TLS
and non-writable RELRO.
2023-05-12 23:58:39 -07:00
Kazu Hirata
96ddbd6dd8 [llvm] Fix typos in documentation 2023-05-12 23:47:46 -07:00
LLVM GN Syncbot
b354028fc6 [gn build] Port b97859b67416 2023-05-13 06:40:42 +00:00
Craig Topper
98f59b2f5b [RISCV] Teach doPeepholeMaskedRVV to handle FMA instructions.
This lets us remove some isel patterns.

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D150463
2023-05-12 23:36:27 -07:00
Tom Stellard
245cb1f7ef docs: Document procedure for updating pull requests
See discussion in #56637.

Reviewed By: ldionne, jhenderson

Differential Revision: https://reviews.llvm.org/D147284
2023-05-12 23:35:11 -07:00
Tom Stellard
afa607fbac workflows/release-tasks: Remove stray backslash
Reviewed By: thieta

Differential Revision: https://reviews.llvm.org/D150018
2023-05-12 23:34:05 -07:00
Vitaly Buka
847789d457 Revert "[RISCV][llvm-mca] Add mca tests for riscv lmul instruments"
Memory leaks https://lab.llvm.org/buildbot/#/builders/5/builds/33657

This reverts commit 1e317c3f819c7b42f8b45383438004193d3344d4.
2023-05-12 23:30:09 -07:00
Tom Stellard
3a919ef26c github: Remove pull request template
We've opened up pull requests for libcxx so we don't need this template
any more.  Also, the repo-lockdown job already adds the same comment
when closing pull requests.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D150317
2023-05-12 23:29:23 -07:00
Fangrui Song
a2648bc4ea [ELF] Remove remnant ranks for PPC64 ELFv1 special sections 2023-05-12 23:21:14 -07:00
Tom Stellard
63bd7726d1 workflows/repo-lockdown: Ignore libcxx and related sub-directories
https://discourse.llvm.org/t/opening-up-prs-experimentally-for-a-subset-of-the-llvm-project/70375/11

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D150314
2023-05-12 23:20:24 -07:00
Kazu Hirata
7f28137b5d [clang-tidy] Modernize RangeDescriptor (NFC) 2023-05-12 23:19:19 -07:00
Kazu Hirata
2db0812882 [clang] Fix typos in documentation 2023-05-12 23:19:17 -07:00
Thurston Dang
d9377c1ded ASan: unbreak Windows build by limiting backtrace* tests to glibc
My newly added backtrace test (https://reviews.llvm.org/D150491)
broke the Windows buildbot (https://lab.llvm.org/buildbot/#/builders/127/builds/48103)
because they do not have execinfo.h.
I expect the same will happen with the backtrace_symbols test (https://reviews.llvm.org/D150498) as well.

This patch does a quick fix by restricting the test scope to glibc-2.27.
(A tricker fix would take into account SANITIZER_INTERCEPT_BACKTRACE,
which is defined as (SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS))
2023-05-13 05:56:28 +00:00
Thurston Dang
04fd535409 ASan: add backtrace_symbols test and clarify code is correct
This is another patch for https://github.com/google/sanitizers/issues/321
(sanitizer interceptors can write to freed memory, causing corruption),
in this case for backtrace_symbols.

backtrace_symbols is already correct, hence this patch removes the
TODO note. Additionally, this patch adds a test case for it.

Differential Revision: https://reviews.llvm.org/D150498
2023-05-13 05:26:45 +00:00
Weining Lu
0bbf3ddf5f [Clang][LoongArch] Add GPR alias handling without $ prefix
Currenlty there is a mismatch between LoongArch gcc and clang about
handling register name in inlineasm, i.e. gcc allows both `$`-prefixed
and non-prefiexed names for GPRs while clang only allows `$`-prefixed
one. This patch fixes this mismatch by adding non-prefixed GPR names
in clang.

Take `$r4` for example. With this patch, clang accepts `$r4`, `r4`,
`$a0` and `a0` like what gcc does.

Reviewed By: xen0n

Differential Revision: https://reviews.llvm.org/D136436
2023-05-13 12:08:59 +08:00
Douglas Yung
97b73e35eb Add 'REQUIRES: asserts' to test added in D150002 (53a4adc) because it tests for a crash that is caused by an assertion failure. 2023-05-12 19:01:52 -07:00
Kazu Hirata
81e149aab9 Replace None with std::nullopt in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-05-12 18:33:26 -07:00
Shengchen Kan
db39d47928 [X86][AsmParser] Reapply "Refactor code and optimize more instructions from VEX3 to VEX2"
This was reverted in d4994d0e7922 b/c a bolt test failed after the
encoding changed.

Relanded the patch with the updated test.
2023-05-13 09:26:29 +08:00
Tue Ly
36b702901a [libc][math] Implement fast division / modulus for UInt / (uint32_t * 2^e).
This is to improve a performance bottleneck of printf for long double.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D150475
2023-05-12 21:01:15 -04:00
Philip Reames
4cc2010f03 [RISCVGatherScatterLowering] Use InstSimplifyFolder
Main value of this is simplifying code, and making a few of the tests easier to read.

Differential Revision: https://reviews.llvm.org/D150474
2023-05-12 17:33:07 -07:00
Philip Reames
0152f013f6 Reapply "[RISCVGatherScatterLowering] Minor code cleanup [NFC]"
This was reverted in 4e84149c0aea0e9f16c51cc92f50d90992b13d57 due to a problem report which has been confirmed to be misattributed.

Original commit message:

Use a switch to avoid repeat tests on the opcode, and factor out some common code out of another switch.  (Not all branches had both common bits, but the one which didn't left the values unchanged and their starting value is the respective operand - so storing it back is a nop.)
2023-05-12 17:33:07 -07:00
Jessica Paquette
9c0a349788 Revert "[SuffixTree] Add suffix tree statistics"
This reverts commit d3a6a05b1f95564f2c66f885a83cf0dbe1a004a9.

Some bots don't like it.

Boo.
2023-05-12 17:09:26 -07:00
Jessica Paquette
d3a6a05b1f [SuffixTree] Add suffix tree statistics
Sometimes you want to see how much is being allocated in your data structure
in general.

Add statistics that show how many internal and leaf nodes have been allocated
in the suffix tree over the course of its construction.

Also add a testcase that shows that we actually get these stats out when we're
outlining stuff.

The test shows that we get the expected O(n) leaf nodes, a split, and so on.
2023-05-12 17:05:04 -07:00
Valentin Clement
c3c73e5d40
[mlir][openacc] Add canonicalization pattern for acc.host_data
Add if condition removal pattern for acc.host_data in a same way as
acc.enter_data, acc.exit_data and acc.update.

The condition is removed from the op if it is a true constant. If
it is a false constant then the region is inlined before the op
and the op is removed.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150480
2023-05-12 16:57:58 -07:00
Philip Reames
592199c8fe [LV] Use interface routines instead of internal variables
This makes a (possible) change to the internal representation easier in the future, and makes the code easier to read now.
2023-05-12 16:27:12 -07:00
Alan Zhao
d4994d0e79 Revert "[X86][AsmParser] Refactor code and optimize more instructions from VEX3 to VEX2"
This reverts commit c13ed1cc75781fccc7cec91017e84341c3047229.

Reason: causes bolt tests to fail: https://crbug.com/1445243
2023-05-12 16:08:35 -07:00
Philip Reames
4e84149c0a Revert "[RISCVGatherScatterLowering] Minor code cleanup [NFC]"
This reverts commit 13984608992246e42e66c019f09764650d60af63.  A problem was reported - the attribution seems slightly questionable, but this is low enough value after 297e06c that reverting is easy.
2023-05-12 16:08:20 -07:00
Thurston Dang
d3b5ac8b35 ASan: add testcase for backtrace interceptor
It is a known, longstanding issue that some ASan interceptors
may write to freed memory, causing corruption
(https://github.com/google/sanitizers/issues/321). This patch
adds a testcase for the backtrace interceptor (one of the
known cases).

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D150491
2023-05-12 23:02:19 +00:00
Yaxun (Sam) Liu
6adb9a0602 [AMDGPU] Emit predefined macro __AMDGCN_CUMODE__
Predefine __AMDGCN_CUMODE__ as 1 or 0 when compilation assumes CU or WGP modes.

If WGP mode is not supported, ignore -mno-cumode and emit a warning.

This is needed for implementing device functions like __smid
(312dff7b79/include/hip/amd_detail/amd_device_functions.h (L957))

Reviewed by: Matt Arsenault, Artem Belevich, Brian Sumner

Differential Revision: https://reviews.llvm.org/D145343
2023-05-12 18:50:52 -04:00
Teresa Johnson
19c5740a5a [MemProf] Set hot/cold new values with option
Adds support to set the hot/cold new hint values with an option. Change
the defaults slightly to make it easier to distinguish between compiler
synthesized vs manually inserted calls to the interface.

Differential Revision: https://reviews.llvm.org/D150488
2023-05-12 15:47:10 -07:00
Vadim Paretsky
7fd6d2babf [OpenMP] remove an erroneous assert on the location argument
The 'loc' argument is optional, and some compilers (e.g. MSVC) do no supply it.

Differential Revision: https://reviews.llvm.org/D148393
2023-05-12 15:40:37 -07:00
Kazu Hirata
6c3ea866e9 [llvm] Migrate {starts,ends}with_insensitive to {starts,ends}_with_insensitive (NFC)
This patch migrates uses of StringRef::{starts,ends}with_insensitive
to StringRef::{starts,ends}_with_insensitive so that we can use names
similar to those used in std::string_view.  I'm planning to deprecate
StringRef::{starts,ends}with_insensitive once the migration is
complete across the code base.

Differential Revision: https://reviews.llvm.org/D150426
2023-05-12 15:37:37 -07:00
Vadim Paretsky
3665e2bdd1 [OpenMP] Fix GCC build issues and restore "Additional APIs used by the MSVC compiler for loop collapse (rectangular and non-rectangular loops)"
Fixes a GCC build issue (an instance of unallowed typename keyword) and reworks memory allocation
to avoid the use of C++ library based primitives ) in and restores the earlier commit https://reviews.llvm.org/D148393

Differential Revision: https://reviews.llvm.org/D149010
2023-05-12 15:15:18 -07:00
Florian Mayer
edd0981e71 [HWASan] unflake test
The short granule logic made this test flaky because with low
probability there would be no tag mismatch by coincidence.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D150484
2023-05-12 15:06:31 -07:00
Jerry Ge
39578264d0 Fix mlir trait documentation typo
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Change-Id: I922eeda95223da2c7da0653451e604651b7594bd

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D150487
2023-05-12 22:52:23 +01:00