Commit Graph

104734 Commits

Author SHA1 Message Date
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
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
0e039fc39e [APINotes] Use DenseMap::contains (NFC) 2023-12-22 14:23:25 -08: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
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
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
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
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
Ilya Biryukov
95b423e44f [Sema] NFC. Simplify code in a few places of TryOrBuildParenListInitialization 2023-12-22 12:41:52 +01:00
Qizhi Hu
625197d39c [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (#74813)
Since import `ExplicitCastExpr` lacks of processing
`BuiltinBitCastExprClass` type, it would reach to the 'unreachable' code
and produce the crash. This patch aims to fix the
[crash](https://github.com/llvm/llvm-project/issues/74774) and try to
handle `BuiltinBitCastExpr`.

Co-authored-by: huqizhi <836744285@qq.com>
2023-12-22 18:06:59 +08:00
Balázs Kéri
0d903b689a [clang][ASTImporter] Import AlignValueAttr correctly. (#75308)
Expression of attribute `align_value` was not imported. Import of the
attribute is corrected, a test for it is added, other related tests with
FIXME are updated.
Fixes #75054.
2023-12-22 10:07:38 +01:00
Ben Shi
e2d0f50cd6 [clang][NFC] Remove trailing whitespace characters 2023-12-22 15:34:13 +08:00
hstk30-hw
033ec098be [Clang][Sema] Fix Wswitch-default bad warning in template (#76007)
https://github.com/llvm/llvm-project/pull/73077 added -Wswitch-default
diagnostic but it produced false positives in templates. This PR will
address that. https://github.com/llvm/llvm-project/issues/75943
2023-12-22 09:00:41 +08:00
Dinar Temirbulatov
809f2f3d7d [AArch64][SME2] Add builtins for FDOT, BFDOT, SUDOT, USDOT, SDOT, UDOT. (#75737)
Add SME2 DOT builtins.
2023-12-21 19:41:24 +00:00
Tomas Matheson
7bd17212ef Re-land "[AArch64] Codegen support for FEAT_PAuthLR" (#75947)
This reverts commit 9f0f558742.

Fix expensive checks failure by properly marking register def for ADR.
2023-12-21 18:32:55 +00:00
Walter Lee
6a870cca70 Add tests for driver to propagate module map flags for layering check (#75827)
Xcode 14.3.1 seems to have dropped these flags so we are creating unit tests to reproduce the issue.
2023-12-21 13:15:02 -05:00
Dinar Temirbulatov
77c5c44b01 [AArch64][SME2] Add SME2 MLA/MLS builtins. (#75584)
Add SME2 MLA/MLS builtins.
2023-12-21 16:42:24 +00:00
Tomas Matheson
9f0f558742 Revert "[AArch64] Codegen support for FEAT_PAuthLR"
This reverts commit 5992ce90b8.

Builtbot failures with expensive checks enabled.
2023-12-21 16:25:55 +00:00
Kazu Hirata
886655869c [clang] Fix typos in documentation 2023-12-21 08:18:49 -08:00
Kerry McLaughlin
35111695dd [Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
This patch enables the following builtins for SME2:
 - svld1, svld1_vnum
 - svldnt1, svldnt1_vnum
 - svst1, svst1_vnum
 - svstnt1, svstnt1_vnum
2023-12-21 15:25:23 +00:00
madanial0
6b505406a3 [Flang] remove whole-archive option for AIX linker (#76039)
The AIX linker does not support the `--whole-archive` option, removing
the option if the OS is AIX.

---------

Co-authored-by: Mark Danial <mark.danial@ibm.com>
2023-12-21 10:22:30 -05:00
Radu Salavat
3107f313f1 [Flang, Clang] Enable and test 'rdynamic' flag (#75598)
Enable and test 'rdynamic' flag
2023-12-21 14:37:51 +00:00
Tomas Matheson
5992ce90b8 [AArch64] Codegen support for FEAT_PAuthLR
- Adds a new +pc option to -mbranch-protection that will enable
  the use of PC as a diversifier in PAC branch protection code.

- When +pauth-lr is enabled (-march=armv9.5a+pauth-lr) in combination
  with -mbranch-protection=pac-ret+pc, the new 9.5-a instructions
  (pacibsppc, retaasppc, etc) are used.

Documentation for the relevant instructions can be found here:
https://developer.arm.com/documentation/ddi0602/2023-09/Base-Instructions/

Co-authored-by: Lucas Prates <lucas.prates@arm.com>
2023-12-21 14:18:33 +00:00
Tomas Matheson
92dc23c0e0 [AArch64] add missing test case for v9.4-A 2023-12-21 14:18:33 +00:00
madanial0
11c2c0940b [Flang] Add fortran runtime libraries to AIX driver (#75921)
Add fortran runtime libraries to flang-new on AIX

Co-authored-by: Mark Danial <mark.danial@ibm.com>
2023-12-21 08:59:21 -05:00
Kerry McLaughlin
a047675bbf [Clang][SME2] Add builtins for multi-vector fp round to integral value (#75941)
Adds the following SME2 builtins:
 - svrinta, svrintm, svrintn, svrintp (x2 & x4)
2023-12-21 12:08:47 +00:00
Ben Shi
73948ec6b2 [clang][analyzer] Support fflush in the StreamChecker (#74296) 2023-12-21 17:57:06 +08:00
Chuanqi Xu
2203a4e6e0 [NFC] [Serialization] Improve AST serialization by reordering packed
bits and extract big bits from packed bits

Previously I tried to improve the size of .pcm files by introducing
packed bits. And I find we can improve it further by reordering the
bits.

The secret comes from the VBR format. We can find the formal definition
of VBR format in the doc of LLVM. The VBR format will be pretty
efficicent for small numbers.

For example, if we need to pack 8 bits into a value and the stored value
is 0xf0, the actual stored value will be 0b000111'110000, which takes 12
bits actually. However, if we changed the order to be 0x0f, then we
can store it as 0b001111, which takes 6 bits only now.

So we can improve the size by placing bits with lower probability to be
1 in the higher bits and extract bit bigs from the packed bits to make
it possible to be optimized by VBR.

After this patch, the size of std module becomes to 27.7MB from 28.1MB.
2023-12-21 16:35:20 +08:00
martinboehme
469374e5c4 [clang][dataflow] Disallow setting properties on RecordValues. (#76042)
Instead, synthetic fields should now be used for the same purpose. These
have a
number of advantages, as described in
https://github.com/llvm/llvm-project/pull/73860, and longer-term, we
want to
eliminate `RecordValue` entirely.

As `RecordValue`s cannot have properties any more, I have replaced the
`OptionalIntAnalysis` with an equivalent analysis that tracks nullness
of
pointers (instead of whether an optional has a value). This serves the
same
purpose, namely to check whether the framework applies a custom
`merge()`
operation to widen properties.
2023-12-21 09:21:24 +01:00
martinboehme
2ee396b0b1 [clang][dataflow] Add Environment::get<>(). (#76027)
This template function casts the result of `getValue()` or
`getStorageLocation()` to a given subclass of `Value` or
`StorageLocation` (using `cast_or_null`).

It's a common pattern to do something like this:

```cxx
auto *Val = cast_or_null<PointerValue>(Env.getValue(E));
```

This can now be expressed more concisely like this:

```cxx
auto *Val = Env.get<PointerValue>(E);
```

Instead of adding a new method `get()`, I had originally considered
simply adding a template parameter to `getValue()` and
`getStorageLocation()` (with a default argument of `Value` or
`StorageLocation`), but this results in an undesirable repetition at the
callsite, e.g. `getStorageLocation<RecordStorageLocation>(...)`. The
`Value` and `StorageLocation` in the method name adds nothing of value
when the template argument already contains this information, so it
seemed best to shorten the method name to simply `get()`.
2023-12-21 09:02:20 +01:00
Qizhi Hu
72e8ab7d44 [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (#74991)
Lack of processing of `SubstNonTypeTemplateParmExpr` in
`isAncestorDeclContextOf` would make `hasAutoReturnTypeDeclaredInside`
returns false and lead to infinite recursion. This patch adds the
processor and try to fix [this
issue](https://github.com/llvm/llvm-project/issues/74839)

Co-authored-by: huqizhi <836744285@qq.com>
2023-12-21 15:05:33 +08:00
Timm Bäder
d5c98e7837 [clang][AST][NFC] const-qualify some local references 2023-12-21 06:32:32 +01:00
Chuanqi Xu
565e5e861f Recommit [NFC] [Serialization] Packing more bits and refactor AbbrevToUse
This patch tries to pack more bits into a value to reduce the size of
.pcm files. Also, after we introduced BitsPackers, it may slightly
better to adjust the way we use Abbrev.

After this patch, the size of the BMI for std module reduce from 28.94MB
to 28.1 MB.

This was reverted due to it broke the build of lldb. The reason that we
skip the serialization of a source location incorrectly. And this patch
now fixes that.
2023-12-21 10:30:12 +08:00
Max Winkler
0ea87560cc [clang] Separate Intel ADC instrinsics from ADX intrinsics (#75992)
See https://github.com/llvm/llvm-project/pull/75711 for discussion.

As a summary from the PR above, `<adxintrin.h>` includes adc intrinsics
and adx intrinsics.
To support MSVC STL we need to expose the adc intrinsics inside the
currently proposed `<intrin0.h>` header.
Move the processor agnostic adc intrinsics into a separate file that can
be included from `<immintrin.h>` and the currently proposed
`<intrin0.h>`.
2023-12-21 08:43:46 +08:00
Dimitry Andric
2c27013fa9 [clang] Add getClangVendor() and use it in CodeGenModule.cpp (#75935)
In 9a38a72f1d `ProductId` was assigned from the stringified value of
`CLANG_VENDOR`, if that macro was defined. However, `CLANG_VENDOR` is
supposed to be a string, as it is defined (optionally) as such in the
top-level clang `CMakeLists.txt`.

Furthermore, `CLANG_VENDOR` is only passed as a build-time define when
compiling `Version.cpp`, so add a `getClangVendor()` function to
`Version.h`, and use it in `CodegGenModule.cpp`, instead of relying on
the macro.

Fixes: 9a38a72f1d
2023-12-20 20:09:39 +01:00
Dimitry Andric
5c1a41f8ad Revert "[clang] Add getClangVendor() and use it in CodeGenModule.cpp (#75935)"
This reverts commit 9055519103, due to an
incorrectly chosen commit message.
2023-12-20 20:07:22 +01:00
Dimitry Andric
9055519103 [clang] Add getClangVendor() and use it in CodeGenModule.cpp (#75935)
In 9a38a72f1d `ProductId` was assigned from the stringified value of
`CLANG_VENDOR`, if that macro was defined. However, `CLANG_VENDOR` is
supposed to be a string, as it is defined (optionally) as such in the
top-level clang `CMakeLists.txt`.

Move the addition of `-DCLANG_VENDOR` to the compiler flags from
`clang/lib/Basic/CMakeLists.txt` to the top-level `CMakeLists.txt`, so
it is consistent across the whole clang codebase. Then remove the
stringification from `CodeGenModule.cpp`, to make it work correctly.

Fixes:		9a38a72f1d
2023-12-20 20:03:19 +01:00
Craig Topper
b03f0c596a [RISCV] Add sifive-p450 CPU. (#75760)
This is an out of order core with no vector unit. More information:
https://www.sifive.com/cores/performance-p450-470

Scheduler model and other tuning will come in separate patches.
2023-12-20 09:52:02 -08:00
Lucas Duarte Prates
d43fc5a6ad Reland: [AArch64] Assembly support for the Checked Pointer Arithmetic Extension (#73777)
This introduces assembly support for the Checked Pointer Arithmetic
Extension (FEAT_CPA), annouced as part of the Armv9.5-A architecture
version.

The changes include:
* New subtarget feature for FEAT_CPA
* New scalar instruction for pointer arithmetic
  * ADDPT, SUBPT, MADDPT, and MSUBPT
* New SVE instructions for pointer arithmetic
  * ADDPT (vectors, predicated), ADDPT (vectors, unpredicated)
  * SUBPT (vectors, predicated), SUBPT (vectors, unpredicated)
  * MADPT and MLAPT
* New ID_AA64ISAR3_EL1 system register

Mode details about the extension can be found at:
* https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-developments-2023
* https://developer.arm.com/documentation/ddi0602/2023-09/

Co-authored-by: Rodolfo Wottrich <rodolfo.wottrich@arm.com>
2023-12-20 15:43:17 +00:00
Abhina Sree
e86a02ce89 Use llvm-config.h in CIndexer.cpp instead of private header (#75928)
Use llvm-config.h in CIndexer.cpp instead of private header
2023-12-20 08:44:40 -05:00
Momchil Velikov
52820bdd68 [AArch64] Update target feature requirements of SVE bfloat instructions (#75596)
According to the latest update of the ISA
https://developer.arm.com/documentation/ddi0602/2023-09/?lang=en all of
the affected instruction encodings now require

    (FEAT_SVE2 or FEAT_SME2) and FEAT_SVE_B16B16
2023-12-20 10:16:40 +00:00
Haojian Wu
3b1f06e527 [AST] RecursiveASTVisitor: traverse the require clause for partial template specializations. (#75795)
This fixes tooling (clangd, include-cleaner) bugs where we miss
functionalities on concept AST nodes.
2023-12-20 10:08:43 +01:00
Vladimir Vereschaka
7022a24771 [ClangRepl] Fix failed ClangReplInterpreter unit tests (#75556).
See more details: https://lab.llvm.org/buildbot/#/builders/119/builds/16346

Behalf of @vgvassilev
2023-12-20 00:11:12 -08:00
Brandon Wu
379d32dab8 Recommit [RISCV] Implement multi-lib reuse rule for RISC-V bare-metal toolchain (#73765) (#75890)
Extend the multi-lib re-use selection mechanism for RISC-V.
This funciton will try to re-use multi-lib if they are compatible.
Definition of compatible:
  - ABI must be the same.
  - multi-lib is a subset of current arch, e.g. multi-lib=march=rv32im
    is a subset of march=rv32imc.
  - march that contains atomic extension can't reuse multi-lib that
    doesn't has atomic, vice versa. e.g. multi-lib=march=rv32im and
    march=rv32ima are not compatible, because software and hardware
    atomic operation can't work together correctly.
2023-12-20 14:42:11 +08:00
cor3ntin
c853676061 [Clang] Fix a crash when incorrectly calling an explicit object member function template (#75913)
Fixes #75732
2023-12-20 07:41:24 +01:00