Commit Graph

484696 Commits

Author SHA1 Message Date
Kazu Hirata
1daf2994de [llvm] Use StringRef::contains (NFC) 2023-12-23 22:21:52 -08:00
Shengchen Kan
17ff25a58e [X86][NFC] Not infer OpSize from Xi8|16|32|64
For legacy (arithmetic) instructions, the operand size override prefix (0x66)
is used to switch the operand data size from 32b to 16b (in 32/64-bit mode),
16b to 32b (in 16-bit mode). That's why we set OpSize16 for 16-bit instructions
and set OpSize32 for 32-bit instructions.

But it's not a generic rule any more after APX. APX adds 4 variants for
arithmetic instructions: promoted EVEX, NDD (new data destination), NF (no flag),
NF_NDD. All the 4 variants are in EVEX space and only legal in 64-bit
mode. EVEX.pp is set to 01 for the 16-bit instructions to encode 0x66.
For APX, we should set OpSizeFixed for 8/16/32/64-bit variants and set PD for
the 16-bit variants.

Hence, to reuse the classes ITy and its subclasses BinOp* for APX instructions,
we extract the OpSize setting from the class ITy.
2023-12-24 12:00:25 +08:00
Shengchen Kan
6e20df1a3b [X86][NFC] Set default OpPrefix to PS for XOP/VEX/EVEX instructions
It helps simplify the class definitions. Now, the only explicit usage of PS is
to check prefix 0x66/0xf2/0xf3 can not be used a prefix, e.g. wbinvd.

See 82974e0114 for more details.
2023-12-24 10:20:40 +08:00
Vitaly Buka
0e07bf91f7 [NFC][sanitizer] Rename to Lock{Before,After}Fork StackDepotBase locking (#76303)
Followup to #76279
2023-12-23 16:23:55 -08:00
Rik Huijzer
061e4f24b2 [mlir][doc] Escape effects, interfaces, and traits (#76297)
Fixes https://github.com/llvm/llvm-project/issues/76270.

Thanks to @scottamain for the clear description.


Co-authored-by: Scott Main <scott@modular.com>
2023-12-23 21:48:33 +01:00
Felipe de Azevedo Piovezan
acacec3bbf [LiveDebugValues][nfc] Reduce memory usage of InstrRef (#76051)
Commit 1b531d54f6 (#74203) removed the usage of unique_ptrs of arrays
in favour of using vectors, but inadvertently increased peak memory
usage by removing the ability to deallocate vector memory that was no
longer needed mid-LDV.

In that same review, it was pointed out that `FuncValueTable` typedef
could be removed, since it was "just a vector".

This commit addresses both issues by making `FuncValueTable` a real data
structure, capable of mapping BBs to ValueTables and able to free
ValueTables as needed.

This reduces peak memory usage in the compiler by 10% in the benchmarks
flagged by the original review.

As a consequence, we had to remove a handful of instances of the
"declare-then-initialize" antipattern in unittests, as the
FuncValueTable class is no longer default-constructible.
2023-12-23 13:44:45 -03:00
Florian Hahn
fbcf8a8cbb [ConstraintElim] Add (UGE, var, 0) to unsigned system for new vars. (#76262)
The constraint system used for ConstraintElimination assumes all
varibles to be signed. This can cause missed optimization in the
unsigned system, due to missing the information that all variables are
unsigned (non-negative).

Variables can be marked as non-negative by adding Var >= 0 for all
variables. This is done for arguments on ConstraintInfo construction and
after adding new variables. This handles cases like the ones outlined in
https://discourse.llvm.org/t/why-does-llvm-not-perform-range-analysis-on-integer-values/74341

The original example shared above is now handled without this change,
but adding another variable means that instcombine won't be able to
simplify examples like https://godbolt.org/z/hTnra7zdY

Adding the extra variables comes with a slight compile-time increase
https://llvm-compile-time-tracker.com/compare.php?from=7568b36a2bc1a1e496ec29246966ffdfc3a8b87f&to=641a47f0acce7755e340447386013a2e086f03d9&stat=instructions:u

stage1-O3    stage1-ReleaseThinLTO    stage1-ReleaseLTO-g  stage1-O0-g
 +0.04%           +0.07%                   +0.05%           +0.02%
stage2-O3    stage2-O0-g    stage2-clang
  +0.05%         +0.05%        +0.05%

https://github.com/llvm/llvm-project/pull/76262
2023-12-23 15:53:48 +01:00
Matt Arsenault
ed6dc62862 DAG: Handle equal size element build_vector promotion (#76213) 2023-12-23 20:43:14 +07:00
Mark de Wever
5841140e38 [libc++][modules] Fixes C++20 build errors.
Recent CI changes have disabled testing modules in different
configurations. This broke building the std and std.compat module in
C++20. This was found by the CI in #76246.
2023-12-23 11:43:17 +01:00
Nikolas Klauser
b203d5320d [libc++] Optimize std::find if types are integral and have the same signedness (#70345)
Fixes #70238
2023-12-23 11:21:27 +01:00
Vitaly Buka
f78a742ab8 [NFC][sanitizer] Rename Lock{Before,After}Fork suffixes locking StackDepotBase (#76279)
This is preparation for performance optimization.

We need to highlight that this is very specific lock, and should not be
used for other purposes.
Add `fork_child` parameter to distinguish processes after fork.
2023-12-22 23:38:01 -08:00
XDeme
8097a5d37b [clang-format] Fix operator overload inconsistency in BreakAfterAttributes: Always (#74943)
Fixes llvm/llvm-project#74901
2023-12-22 23:02:47 -08:00
Owen Pan
f8f8926054 [clang-format] Fix a bug in annotating function declaration names (#76206)
Annotates function declaration names having unnamed parameters.
2023-12-22 22:51:00 -08:00
Craig Topper
31aa7d2de0 [RISCV] Use riscv_bitmanip.h in zbb.c. NFC
I missed this when converting other scalar bitmanip/crypto tests
to use intrinsics intead of builtins.
2023-12-22 20:10:37 -08:00
smanna12
bbe1b06fbb [NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto keyword (#75082)
Reported by Static Analyzer Tool:

In ​EmitAssemblyHelper::​RunOptimizationPipeline(): Using the auto
keyword without an & causes the copy of an object of type function.

 /// List of pass builder callbacks ("CodeGenOptions.h").
std::vector<std::function<void(llvm::PassBuilder &)>>
PassBuilderCallbacks;
2023-12-22 20:39:22 -06:00
Sameer Sahasrabuddhe
61b5cc6654 [LLVM] ConvergenceControlInst as a derived class of IntrinsicInst (#76230) 2023-12-23 07:58:43 +05:30
Aiden Grossman
63c3148354 [llvm-exegesis] Fix stack pointer register restoration
9eb80ab378 changed the method for stack
pointer restoration to fix segmentation faults. However, I made a
mistake in the patch and swapped a != for a ==, which caused an
arbitrary register (the first one specified) to get restored rather than
the stack pointer specifically. This patch fixes that issue and adds
test coverage to prevent regression.
2023-12-22 17:55:26 -08:00
Vitaly Buka
2205d2334f Revert "[Sema] Fix crash on invalid code with parenthesized aggregate initialization" (#76272)
Reverts llvm/llvm-project#76232 and
7ab16fb520 to recover build bots.

Breaks libc++ tests, details in #76232

#76228
2023-12-22 15:20:00 -08:00
Kazu Hirata
03dc806b12 [Transforms] Use {DenseMap,SmallPtrSet}::contains (NFC) 2023-12-22 14:51:22 -08:00
James Y Knight
4532617ae4 Change release branch creation process to bump version to N.1.0. (#75743)
This will help distinguish release branch builds from development branch
builds, and is similar to GCC's version numbering policy.

Thus, the branch `releases/18.x` will start out numbered 18.1.0, instead
of 18.0.0.

Unchanged are other versioning policies:
- mainline will be numbered 18.0.0, 19.0.0, ...
- typical release branch releases will increment micro version, e.g.
18.1.1, 18.1.2, ....
- If an ABI break is required on the release branch, the minor version
will be incremented, e.g. to 18.2.0.

See the Discourse RFC:

https://discourse.llvm.org/t/rfc-name-the-first-release-from-a-branch-n-1-0-instead-of-n-0-0/75384
2023-12-22 17:35:26 -05:00
Kazu Hirata
0e039fc39e [APINotes] Use DenseMap::contains (NFC) 2023-12-22 14:23:25 -08:00
Vitaly Buka
ceccacb0b8 [test][hwasan] Re-enabled android test 2023-12-22 12:54:12 -08:00
Ethan Luis McDonough
813a671232 [OpenMP] Remove unnecessary dependencies from plugin unit tests (#76266)
This was an oversight that seems to be causing problems on certain
builds. This patch should fix #76225.
2023-12-22 14:44:23 -06:00
Yingwei Zheng
345d7b1618 [InstCombine] Fold minmax intrinsic using KnownBits information (#76242)
This patch tries to fold minmax intrinsic by using
`computeConstantRangeIncludingKnownBits`.
Fixes regression in
[_karatsuba_rec:cpython/Modules/_decimal/libmpdec/mpdecimal.c](c31943af16/Modules/_decimal/libmpdec/mpdecimal.c (L5460-L5462)),
which was introduced by #71396.
See also
https://github.com/dtcxzyw/llvm-opt-benchmark/issues/16#issuecomment-1865875756.

Alive2 for splat vectors with undef: https://alive2.llvm.org/ce/z/J8hKWd
2023-12-23 04:41:32 +08:00
Felipe Cabarcas
9b6ea5e8f8 [OpenMP] Improve omp offload profiler (#68016)
Summary:
Adding information to the LIBOMPTARGET profiler runtime kernel and API
calls.

Key changes:
* Adding information to runtime calls for better understanding of how
the application
is executing. For example teams requested by the user, size of memory
transfers.
* Profile timer was changed from 'us' to 'ns', since 'us' was too
coarse-grain
  to register some important details like key kernel duration
* Removed non API or Runtime calls, to reduce complexity of profile for
application
  developers.

---------

Co-authored-by: Felipe Cabarcas <cabarcas@leia.crpl.cis.udel.edu>
Co-authored-by: fel-cab <fel-cab@github.com>
2023-12-22 14:58:11 -05:00
Vitaly Buka
1ba4a452e5 [test][hwasan] Add -g required for the test 2023-12-22 11:52:35 -08:00
Florian Hahn
e9a56ab316 [PhaseOrdering] Add test with removable chained conditions.
Based on https://godbolt.org/z/hTnra7zdY, which is a slightly more
complicated version of the example from
https://discourse.llvm.org/t/why-does-llvm-not-perform-range-analysis-on-integer-values/74341
2023-12-22 19:44:20 +00:00
Kareem Ergawy
52b7045fbb [flang][MLIR][OpenMP] Emit UpdateDataOp from !$omp target update (#75345)
Emits MLIR op corresponding to `!$omp target update` directive. So far,
only motion types: `to` and `from` are supported. Motion modifiers:
`present`, `mapper`, and `iterator` are not supported yet.

This is a follow up to #75047 & #75159, only the last commit is relevant
to this PR.
2023-12-22 20:02:31 +01:00
Nico Weber
04c473bea3 [lldb] Fix two deprecation warnings
No behavior change.
2023-12-22 12:11:07 -05:00
Nico Weber
d782f198a6 lld/MachO: Fix two typos to cycle bots 2023-12-22 12:06:38 -05:00
Maksim Levental
366923810e [lit] add LIT_MAX_WORKERS env variable (#76205) 2023-12-22 11:05:46 -06:00
Nico Weber
650119c737 [gn] port d430c145ba (dladdr check for clang) 2023-12-22 11:34:10 -05:00
Alexandros Lamprineas
6c2ad8ac7b [TLI][NFC] Autogenerate vectorized call tests for SLEEF/ArmPL. (#76146)
This patch prepares the ground for #76060.

* Unifies ArmPL and SLEEF tests for better coverage
* Replaces deprecated float* and double* types with ptr
* Adds noalias attribute to pointer arguments
* Adds some cmd-line options to the RUN lines to simplify output
* Removes datalayout since target triple is provided
* Removes checks for return statements
* Refactors the regex filter for autogenerated checks
* Removes redundant test file suffix (already under the AArch64 dir)
2023-12-22 16:29:18 +00:00
Fangrui Song
dd85c6cce4 [Sema] Add -Wc++11-narrowing-const-reference (#76094)
https://github.com/llvm/llvm-project/pull/75332 diagnosed narrowing
involving const reference. Our depot has hundreds if not thousands of
breakages

(https://github.com/llvm/llvm-project/pull/75332#issuecomment-1864757240).
Add a subgroup of -Wc++11-narrowing to help users gradually fix their
issues without regressing the existing -Wc++11-narrowing diagnostics.
2023-12-22 11:28:07 -05:00
Momchil Velikov
4b6968952e [AArch64] Implement spill/fill of predicate pair register classes (#76068)
We are getting ICE with, e.g.
```
#include <arm_sve.h>

 void g();
 svboolx2_t f0(int64_t i, int64_t n) {
     svboolx2_t r = svwhilelt_b16_x2(i, n);
     g();
     return r;
 }
```
2023-12-22 15:54:12 +00:00
Nikita Popov
d82eccc752 [RegAllocFast] Avoid duplicate hash lookup (NFC) 2023-12-22 16:52:20 +01:00
Nikita Popov
658b260dbf [Attributor] Don't construct pretty GEPs
Bring this in line with other transforms like ArgPromotion/SROA/
SCEVExpander and always produce canonical i8 GEPs.
2023-12-22 16:48:13 +01:00
NAKAMURA Takumi
5f254eb055 [Bazel] Fixup for #76163
This also reverts 7c9c807fa4 and 476812a742.
2023-12-23 00:08:39 +09:00
HaohaiWen
40ec791b15 [RegAllocFast] Refactor dominates algorithm for large basic block (#72250)
The original brute force dominates algorithm is O(n) complexity so it is
very slow for very large machine basic block which is very common with
O0. This patch added InstrPosIndexes to assign index for each
instruction and use it to determine dominance. The complexity is now
O(1).
2023-12-22 23:06:16 +08:00
Rainer Orth
5cb7534a7d [tsan] Only intercept pthread_mutex_clocklock on Linux (#76220)
`tsan_interceptors_posix.cpp` doesn't compile on FreeBSD 14.0/amd64:
```
In file included from /vol/llvm/src/llvm-project/local-freebsd/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:25:
/vol/llvm/src/llvm-project/local-freebsd/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp: In function ‘void __tsan::InitializeInterceptors()’:
/vol/llvm/src/llvm-project/local-freebsd/compiler-rt/lib/tsan/rtl/../../interception/interception.h:243:25: error: ‘real_pthread_mutex_clocklock’ is not a member of ‘__interception’; did you mean ‘real_pthread_mutex_unlock’?
```
Fixed by wrapping the `TSAN_INTERCEPT` invocation with `SANITIZER_LINUX`
as is already done for the interceptor definition.

Tested on `amd64-pc-freebsd14.0`.
2023-12-22 15:58:03 +01:00
Lucas Duarte Prates
e4f1c52832 [AArch64] Assembly support for the Armv9.5-A Memory System Extensions (#76237)
This implements assembly support for the Memory Systems Extensions
introduced as part of the Armv9.5-A architecture version.
The changes include:
* New subtarget feature for FEAT_TLBIW.
* New system registers for FEAT_HDBSS:
  * HDBSSBR_EL2 and HDBSSPROD_EL2.
* New system registers for FEAT_HACDBS:
  * HACDBSBR_EL2 and HACDBSCONS_EL2.
* New TLBI instructions for FEAT_TLBIW:
  * VMALLWS2E1(nXS), VMALLWS2E1IS(nXS) and VMALLWS2E1OS(nXS).
* New system register for FEAT_FGWTE3:
  * FGWTE3_EL3.
2023-12-22 14:40:29 +00:00
Simon Pilgrim
3736e1d1cd [SCEV] Ensure shift amount is in range before calling getZExtValue()
Fixes #76234
2023-12-22 14:16:54 +00:00
Ilya Biryukov
efeb546865 [clang-format] Add common attribute macros to Google style (#76239)
We have found that 199fc973ce regresses
formatting of our codebases because we do not properly configure the
names of attribute macros.

`GUARDED_BY` and `ABSL_GUARDED_BY` are very commoon in Google codebases
so it is reasonable to include them by default to avoid the need for
extra configuration in every Google repository.
2023-12-22 15:07:43 +01:00
Tomas Matheson
f5ab0bb148 [AArch64] paci<k>171615 auti<k>171615 assembly (#76227)
This adds the following instructions which are added in PAuthLR:
 - PACIA171615
 - PACIB171615
 - AUTIA171615
 - AUTIB171615

Also updates some encodings to match final published values.

Documentation can be found here:

https://developer.arm.com/documentation/ddi0602/2023-12/Base-Instructions

Co-authored-by: Lucas Prates <lucas.prates@arm.com>
2023-12-22 13:54:21 +00:00
Adam Paszke
85b2327192 [mlir][nvvm] Fix the PTX lowering of wgmma.mma_async (#76150) 2023-12-22 14:46:34 +01:00
Ilya Biryukov
d03beb9419 [clang-format] Do not break on JS fields like on goto labels (#76233)
This regressions was introduced in
70d7ea0ceb.
The commit moved some code and correctly picked up an explicit check for
not running on Verilog.
However, the moved code also never ran for JavaScript and after the
commit we run it there and
this causes the wrong formatting of:

```js
export type Params = Config&{
  columns: Column[];
};
```
into
```js
export type Params = Config&{
columns:
  Column[];
};
```
2023-12-22 14:41:38 +01:00
David Green
48b9106656 [AArch64] Add an strict fp reduction test. NFC 2023-12-22 13:25:00 +00:00
Abhina Sree
d430c145ba [CMake] Move check for dlfcn.h and dladdr to clang (#76163)
This patch checks for the presence of dlfcn.h and dladdr in clang to be used in clang/tools/libclang/CIndexer.cpp
2023-12-22 08:12:19 -05:00
Ilya Biryukov
7ab16fb520 [Sema] Update test for previous change
The warning for C++20 extension does not fire in on specific instance
because conversion now fails as class is invalid because of an invalid
member.

The new behavior is expected, so updating the test accordingly
2023-12-22 13:30:43 +01:00
Ilya Biryukov
86dc6e15f2 [Sema] Fix crash on invalid code with parenthesized aggregate initialization (#76232)
Fixes #76228.
Use the same logic as braced init lists, also adds a test that puts
incomplete types in various positions to check for regressions in the
future.
2023-12-22 13:11:27 +01:00