|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
c68baa73 |
| 24-Jul-2022 |
Corentin Jabot <[email protected]> |
[clang] Fix incorrect constant folding of `if consteval`
Fixes https://github.com/llvm/llvm-project/issues/55638.
`if consteval` was evaluated incorrectly when in a non-constant context that could
[clang] Fix incorrect constant folding of `if consteval`
Fixes https://github.com/llvm/llvm-project/issues/55638.
`if consteval` was evaluated incorrectly when in a non-constant context that could be constant-folded.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D130437
show more ...
|
| #
f764dc99 |
| 28-Jun-2022 |
serge-sans-paille <[email protected]> |
[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
Some code [0] consider that trailing arrays are flexible, whatever their size. Support for these legacy code has b
[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
Some code [0] consider that trailing arrays are flexible, whatever their size. Support for these legacy code has been introduced in f8f632498307d22e10fab0704548b270b15f1e1e but it prevents evaluation of __builtin_object_size and __builtin_dynamic_object_size in some legit cases.
Introduce -fstrict-flex-arrays=<n> to have stricter conformance when it is desirable.
n = 0: current behavior, any trailing array member is a flexible array. The default. n = 1: any trailing array member of undefined, 0 or 1 size is a flexible array member n = 2: any trailing array member of undefined or 0 size is a flexible array member
This takes into account two specificities of clang: array bounds as macro id disqualify FAM, as well as non standard layout.
Similar patch for gcc discuss here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
[0] https://docs.freebsd.org/en/books/developers-handbook/sockets/#sockets-essential-functions
show more ...
|
| #
a9a60f20 |
| 28-Jun-2022 |
Corentin Jabot <[email protected]> |
[Clang] Rename StringLiteral::isAscii() => isOrdinary() [NFC]
"Ascii" StringLiteral instances are actually narrow strings that are UTF-8 encoded and do not have an encoding prefix. (UTF8 StringLiter
[Clang] Rename StringLiteral::isAscii() => isOrdinary() [NFC]
"Ascii" StringLiteral instances are actually narrow strings that are UTF-8 encoded and do not have an encoding prefix. (UTF8 StringLiteral are also UTF-8 encoded strings, but with the u8 prefix.
To avoid possible confusion both with actuall ASCII strings, and with future works extending the set of literal encodings supported by clang, this rename StringLiteral::isAscii() to isOrdinary(), matching C++ standard terminology.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D128762
show more ...
|
| #
cdfa15da |
| 27-Jun-2022 |
Vitaly Buka <[email protected]> |
Revert "[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays"
This reverts D126864 and related fixes.
This reverts commit 572b08790a69f955ae0cbb1b4a7d4a215f15dad9. Th
Revert "[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays"
This reverts D126864 and related fixes.
This reverts commit 572b08790a69f955ae0cbb1b4a7d4a215f15dad9. This reverts commit 886715af962de2c92fac4bd37104450345711e4a.
show more ...
|
|
Revision tags: llvmorg-14.0.6, llvmorg-14.0.5 |
|
| #
886715af |
| 02-Jun-2022 |
serge-sans-paille <[email protected]> |
[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
Some code [0] consider that trailing arrays are flexible, whatever their size. Support for these legacy code has b
[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
Some code [0] consider that trailing arrays are flexible, whatever their size. Support for these legacy code has been introduced in f8f632498307d22e10fab0704548b270b15f1e1e but it prevents evaluation of __builtin_object_size and __builtin_dynamic_object_size in some legit cases.
Introduce -fstrict-flex-arrays=<n> to have stricter conformance when it is desirable.
n = 0: current behavior, any trailing array member is a flexible array. The default. n = 1: any trailing array member of undefined, 0 or 1 size is a flexible array member n = 2: any trailing array member of undefined or 0 size is a flexible array member n = 3: any trailing array member of undefined size is a flexible array member (strict c99 conformance)
Similar patch for gcc discuss here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
[0] https://docs.freebsd.org/en/books/developers-handbook/sockets/#sockets-essential-functions
show more ...
|
|
Revision tags: llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2 |
|
| #
706e89db |
| 20-Apr-2022 |
Serge Pavlov <[email protected]> |
Fix interaction of pragma FENV_ACCESS with other pragmas
Previously `#pragma STDC FENV_ACCESS ON` always set dynamic rounding mode and strict exception handling. It is not correct in the presence of
Fix interaction of pragma FENV_ACCESS with other pragmas
Previously `#pragma STDC FENV_ACCESS ON` always set dynamic rounding mode and strict exception handling. It is not correct in the presence of other pragmas that also modify rounding mode and exception handling. For example, the effect of previous pragma FENV_ROUND could be cancelled, which is not conformant with the C standard. Also `#pragma STDC FENV_ACCESS OFF` turned off only FEnvAccess flag, leaving rounding mode and exception handling unchanged, which is incorrect in general case.
Concrete rounding and exception mode depend on a combination of several factors like various pragmas and command-line options. During the review of this patch an idea was proposed that the semantic actions associated with such pragmas should only set appropriate flags. Actual rounding mode and exception handling should be calculated taking into account the state of all relevant options. In such implementation the pragma FENV_ACCESS should not override properties set by other pragmas but should set them if such setting is absent.
To implement this approach the following main changes are made:
- Field `FPRoundingMode` is removed from `LangOptions`. Actually there are no options that set it to arbitrary rounding mode, the choice was only `dynamic` or `tonearest`. Instead, a new boolean flag `RoundingMath` is added, with the same meaning as the corresponding command-line option.
- Type `FPExceptionModeKind` now has possible value `FPE_Default`. It does not represent any particular exception mode but indicates that such mode was not set and default value should be used. It allows to distinguish the case:
{ #pragma STDC FENV_ACCESS ON ... }
where the pragma must set FPE_Strict, from the case:
{ #pragma clang fp exceptions(ignore) #pragma STDC FENV_ACCESS ON ... }
where exception mode should remain `FPE_Ignore`.
- Class `FPOptions` has now methods `getRoundingMode` and `getExceptionMode`, which calculates the respective properties from other specified FP properties.
- Class `LangOptions` has now methods `getDefaultRoundingMode` and `getDefaultExceptionMode`, which calculates default modes from the specified options and should be used instead of `getRoundingMode` and `getFPExceptionMode` of the same class.
Differential Revision: https://reviews.llvm.org/D126364
show more ...
|
| #
6117784c |
| 14-Jun-2022 |
Serge Pavlov <[email protected]> |
[NFC] Remove unused function parameter
|
| #
2e603c67 |
| 11-Jun-2022 |
Kazu Hirata <[email protected]> |
[clang] Construct SmallVector with iterator ranges (NFC)
|
| #
52818fd9 |
| 06-Jun-2022 |
Phoebe Wang <[email protected]> |
[Clang][FP16] Add 4 builtins for _Float16
We are lacking builtins support for `_Float16`. In most cases, we can use other floating-type builtins and truncate them to `_Float16`. But it's a problem t
[Clang][FP16] Add 4 builtins for _Float16
We are lacking builtins support for `_Float16`. In most cases, we can use other floating-type builtins and truncate them to `_Float16`. But it's a problem to SNaN, e.g., https://gcc.godbolt.org/z/cqr5nG1jh This patch adds `__builtin_nansf16` support as well as other 3 ones since they are usually used together.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D127050
show more ...
|
|
Revision tags: llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
| #
6bec3e93 |
| 06-Oct-2021 |
Jay Foad <[email protected]> |
[APInt] Remove all uses of zextOrSelf, sextOrSelf and truncOrSelf
Most clients only used these methods because they wanted to be able to extend or truncate to the same bit width (which is a no-op).
[APInt] Remove all uses of zextOrSelf, sextOrSelf and truncOrSelf
Most clients only used these methods because they wanted to be able to extend or truncate to the same bit width (which is a no-op). Now that the standard zext, sext and trunc allow this, there is no reason to use the OrSelf versions.
The OrSelf versions additionally have the strange behaviour of allowing extending to a *smaller* width, or truncating to a *larger* width, which are also treated as no-ops. A small amount of client code relied on this (ConstantRange::castOp and MicrosoftCXXNameMangler::mangleNumber) and needed rewriting.
Differential Revision: https://reviews.llvm.org/D125557
show more ...
|
| #
924acb62 |
| 09-May-2022 |
serge-sans-paille <[email protected]> |
[clang] Prevent folding of non-const compound expr
When a non-const compound statement is used to initialize a constexpr pointer, the pointed value is not const itself and cannot be folded at codege
[clang] Prevent folding of non-const compound expr
When a non-const compound statement is used to initialize a constexpr pointer, the pointed value is not const itself and cannot be folded at codegen time.
This matches GCC behavior for compound literal expr arrays.
Fix issue #39324.
Differential Revision: https://reviews.llvm.org/D124038
show more ...
|
| #
859d9239 |
| 04-May-2022 |
Aaron Ballman <[email protected]> |
Fix a failing assertion with vector type initialization
When constant evaluating the initializer for an object of vector type, we would call APInt::trunc() but truncate to the same bit-width the obj
Fix a failing assertion with vector type initialization
When constant evaluating the initializer for an object of vector type, we would call APInt::trunc() but truncate to the same bit-width the object already had, which would cause an assertion. Instead, use APInt::truncOrSelf() so that we no longer assert in this situation.
Fix #50216
show more ...
|
| #
d6f9000e |
| 25-Apr-2022 |
Haojian Wu <[email protected]> |
[clang] Fix a constant evaluator crash on a NULL-type expr.
Differential Revision: https://reviews.llvm.org/D124384
|
| #
72315d02 |
| 21-Apr-2022 |
Richard Smith <[email protected]> |
Treat `std::move`, `forward`, etc. as builtins.
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`,
Treat `std::move`, `forward`, etc. as builtins.
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`, `move_if_noexcept`, `as_const`, `addressof`, and the libstdc++-specific function `__addressof`.
We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect.
This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change.
We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions.
In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken.
The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been.
This is a re-commit of fc3090109643af8d2da9822d0f99c84742b9c877, a571f82a50416b767fd3cce0fb5027bb5dfec58c, 64c045e25b8471bbb572bd29159c294a82a86a2, and de6ddaeef3aaa8a9ae3663c12cdb57d9afc0f906, and reverts aa643f455a5362de7189eac630050d2c8aefe8f2. This change also includes a workaround for users using libc++ 3.1 and earlier (!!), as apparently happens on AIX, where std::move sometimes returns by value.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D123345
Revert "Fixup D123950 to address revert of D123345"
This reverts commit aa643f455a5362de7189eac630050d2c8aefe8f2.
show more ...
|
| #
98d911e0 |
| 20-Apr-2022 |
David Tenty <[email protected]> |
Revert "Treat `std::move`, `forward`, etc. as builtins."
This reverts commit b27430f9f46b88bcd54d992debc8d72e131e1bd0 as the parent https://reviews.llvm.org/D123345 breaks the AIX CI:
https
Revert "Treat `std::move`, `forward`, etc. as builtins."
This reverts commit b27430f9f46b88bcd54d992debc8d72e131e1bd0 as the parent https://reviews.llvm.org/D123345 breaks the AIX CI:
https://lab.llvm.org/buildbot/#/builders/214/builds/819
show more ...
|
| #
cd149dbf |
| 19-Apr-2022 |
Chuanqi Xu <[email protected]> |
[NFC] Remove unused variable
|
| #
b27430f9 |
| 17-Apr-2022 |
Richard Smith <[email protected]> |
Treat `std::move`, `forward`, etc. as builtins.
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`,
Treat `std::move`, `forward`, etc. as builtins.
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`, `move_if_noexcept`, `as_const`, `addressof`, and the libstdc++-specific function `__addressof`.
We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect.
This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change.
We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions.
In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken.
The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been.
This is a re-commit of fc3090109643af8d2da9822d0f99c84742b9c877, a571f82a50416b767fd3cce0fb5027bb5dfec58c, and 64c045e25b8471bbb572bd29159c294a82a86a25 which were reverted in e75d8b70370435b0ad10388afba0df45fcf9bfcc due to a crasher bug where CodeGen would emit a builtin glvalue as an rvalue if it constant-folds.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D123345
show more ...
|
| #
e75d8b70 |
| 16-Apr-2022 |
Vitaly Buka <[email protected]> |
Revert "Treat `std::move`, `forward`, and `move_if_noexcept` as builtins." Revert "Extend support for std::move etc to also cover std::as_const and" Revert "Update test to handle opaque pointers flag
Revert "Treat `std::move`, `forward`, and `move_if_noexcept` as builtins." Revert "Extend support for std::move etc to also cover std::as_const and" Revert "Update test to handle opaque pointers flag flip."
It crashes on libcxx tests https://lab.llvm.org/buildbot/#/builders/85/builds/8174
This reverts commit fc3090109643af8d2da9822d0f99c84742b9c877. This reverts commit a571f82a50416b767fd3cce0fb5027bb5dfec58c. This reverts commit 64c045e25b8471bbb572bd29159c294a82a86a25.
show more ...
|
| #
fc309010 |
| 15-Apr-2022 |
Richard Smith <[email protected]> |
Extend support for std::move etc to also cover std::as_const and std::addressof, plus the libstdc++-specific std::__addressof.
This brings us to parity with the corresponding GCC behavior.
Remove S
Extend support for std::move etc to also cover std::as_const and std::addressof, plus the libstdc++-specific std::__addressof.
This brings us to parity with the corresponding GCC behavior.
Remove STDBUILTIN macro that ended up not being used.
show more ...
|
| #
64c045e2 |
| 01-Apr-2022 |
Richard Smith <[email protected]> |
Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.
We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addres
Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.
We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect.
This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change.
We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions.
In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken.
The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D123345
show more ...
|
| #
5955a0f9 |
| 14-Apr-2022 |
Eli Friedman <[email protected]> |
Allow flexible array initialization in C++.
Flexible array initialization is a C/C++ extension implemented in many compilers to allow initializing the flexible array tail of a struct type that conta
Allow flexible array initialization in C++.
Flexible array initialization is a C/C++ extension implemented in many compilers to allow initializing the flexible array tail of a struct type that contains a flexible array. In clang, this is currently restricted to C. But this construct is used in the Microsoft SDK headers, so I'd like to extend it to C++.
For now, this doesn't handle dynamic initialization; probably not hard to implement, but it's extra code, and I don't think it's necessary for the expected uses. And we explicitly fail out of constant evaluation.
I've added some additional code to assert that initializers have the correct size, with or without flexible array init. This might catch issues unrelated to flexible array init.
Differential Revision: https://reviews.llvm.org/D123649
show more ...
|
| #
53fd8db7 |
| 30-Mar-2022 |
David Truby <[email protected]> |
[Clang][AArch64][SVE] Allow subscript operator for SVE types
Undefined behaviour is just passed on to extract_element when the index is out of bounds. Subscript on svbool_t is not allowed as this do
[Clang][AArch64][SVE] Allow subscript operator for SVE types
Undefined behaviour is just passed on to extract_element when the index is out of bounds. Subscript on svbool_t is not allowed as this doesn't really have meaningful semantics.
Differential Revision: https://reviews.llvm.org/D122732
show more ...
|
| #
ba4482f4 |
| 05-Apr-2022 |
Nathan Sidwell <[email protected]> |
[clang][NFC] Add specificity to compatibility hack
Add specific dates and versions to note about source_location handling.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.or
[clang][NFC] Add specificity to compatibility hack
Add specific dates and versions to note about source_location handling.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D123119
show more ...
|
| #
d6148749 |
| 28-Mar-2022 |
James Y Knight <[email protected]> |
[Clang] Implement __builtin_source_location.
This builtin returns the address of a global instance of the `std::source_location::__impl` type, which must be defined (with an appropriate shape) befor
[Clang] Implement __builtin_source_location.
This builtin returns the address of a global instance of the `std::source_location::__impl` type, which must be defined (with an appropriate shape) before calling the builtin.
It will be used to implement std::source_location in libc++ in a future change. The builtin is compatible with GCC's implementation, and libstdc++'s usage. An intentional divergence is that GCC declares the builtin's return type to be `const void*` (for ease-of-implementation reasons), while Clang uses the actual type, `const std::source_location::__impl*`.
In order to support this new functionality, I've also added a new 'UnnamedGlobalConstantDecl'. This artificial Decl is modeled after MSGuidDecl, and is used to represent a generic concept of an lvalue constant with global scope, deduplicated by its value. It's possible that MSGuidDecl itself, or some of the other similar sorts of things in Clang might be able to be refactored onto this more-generic concept, but there's enough special-case weirdness in MSGuidDecl that I gave up attempting to share code there, at least for now.
Finally, for compatibility with libstdc++'s <source_location> header, I've added a second exception to the "cannot cast from void* to T* in constant evaluation" rule. This seems a bit distasteful, but feels like the best available option.
Reviewers: aaron.ballman, erichkeane
Differential Revision: https://reviews.llvm.org/D120159
show more ...
|
| #
dc46fa41 |
| 24-Mar-2022 |
Dávid Bolvanský <[email protected]> |
[NFCI] Fix set-but-unused warning in ExprConstant.cpp
|