aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [asan,test] Disable _FORTIFY_SOURCE test incompatible with glibc 2.40gentoo-19.1.0-rc1Fangrui Song2024-08-022-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | In terms of bug catching capability, `_FORTIFY_SOURCE` does not perform as well as some dynamic instrumentation tools. When a sanitizer is used, generally `_FORTIFY_SOURCE` should be disabled since sanitizer runtime does not implement most `*_chk` functions. Using `_FORTIFY_SOURCE` will regress error checking (asan/hwasan/tsan) or cause false positives (msan). `*printf_chk` are the most pronounced `_chk` interceptors for uninstrumented DSOes (https://reviews.llvm.org/D40951). glibc 2.40 introduced `pass_object_info` style fortified source for some functions ([1]). `fprintf` will be mangled as `_ZL7fprintfP8_IO_FILEU17pass_object_size1PKcz`, which has no associated interceptor, leading to printf-fortify-5.c failure. Just disable the test. Fix #100877 [1]: https://sourceware.org/pipermail/libc-alpha/2024-February/154531.html Pull Request: https://github.com/llvm/llvm-project/pull/101566 Gentoo-Component: compiler-rt
* [Sanitizers] Avoid overload ambiguity for interceptors (#100986)Nikita Popov2024-08-021-7/+9
| | | | | | | | | | | | | | | | | | | | | Since glibc 2.40 some functions like openat make use of overloads when built with `-D_FORTIFY_SOURCE=2`, see: https://github.com/bminor/glibc/blob/master/io/bits/fcntl2.h This means that doing something like `(uintptr_t) openat` or `(void *) openat` is now ambiguous, breaking the compiler-rt build on new glibc versions. Fix this by explicitly casting the symbol to the expected function type before casting it to an intptr. The expected type is obtained as `decltype(REAL(func))` so we don't have to repeat the signature from INTERCEPTOR in the INTERCEPT_FUNTION macro. Fixes https://github.com/llvm/llvm-project/issues/100754. (cherry picked from commit 155b7a12820ec45095988b6aa6e057afaf2bc892) Gentoo-Component: compiler-rt
* [llvm-exegesis] Use correct rseq struct size (#100804)Aiden Grossman2024-08-021-1/+12
| | | | | | | | | | | | | | | | Glibc v2.40 changes the definition of __rseq_size to the usable area of the struct rather than the actual size of the struct to accommodate users trying to figure out what features can be used. This change breaks llvm-exegesis trying to disable rseq as the size registered in the kernel is no longer equal to __rseq_size. This patch adds a check to see if __rseq_size is less than 32 bytes and uses 32 as a value if it is given alignment requirements. Fixes #100791. (cherry picked from commit 1e8df9e85a1ff213e5868bd822877695f27504ad) Gentoo-Component: llvm
* Set version to 19.1.0-rc1llvmorg-19.1.0-rc1Tobias Hieta2024-07-262-2/+2
|
* [MLGO][Infra] Add mlgo-utils to bump-version script (#100186)Aiden Grossman2024-07-261-0/+5
| | | | | | This patch adds support in the bump-version script for bumping the version of the mlgo-utils package. This should hopefully streamline the processor for that with the rest of the project and prevent having to manually update this package individually.
* [Utils] Updates to bump-version.py (#100089)Tobias Hieta2024-07-261-7/+19
| | | | * Add support for --git flag to bump version for a git suffix * Update location of the new file where the version is stored
* [flang][debug] Set scope of internal functions correctly. (#99531)Abid Qadeer2024-07-262-75/+132
| | | | | | | | | | | | | | | | | | | | | | | Summary: The functions internal to subroutine should have the scope set to the parent function. This allows a user to evaluate local variables of parent function when control is stopped in the child. Fixes #96314 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250527 (cherry picked from commit 626022bfd18f335ef62a461992a05dfed4e6d715)
* [PAC] Sign LR with B key for non-leaf functions with ptrauth-returns attr ↵Daniil Kovalev2024-07-267-5/+344
| | | | | | | | | | | | | | (#100552) For pauthtest ABI, there is a bunch of ptrauth-* options, including ptrauth-returns. Use "ptrauth-returns" function attribute to indicate need for LR signing with B key for non-leaf function to avoid using "sign-return-address" and "sign-return-address-key" which were originally designed for pac-ret. Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org> Co-authored-by: Anatoly Trosinenko <atrosinenko@accesssoftek.com> (cherry picked from commit 56fd2472d887392855ad85c53df5782a2c3f8ddb)
* [BasicAA] Fix handling of indirect assumption based results (#100130)Nikita Popov2024-07-263-7/+144
| | | | | | | | | | | | | | | | | | | | | If a result is potentially based on a not yet proven assumption, BasicAA will remember it inside AssumptionBasedResults and remove the cache entry if an assumption higher up is later disproved. However, we currently miss the case where another cache entry ends up depending on such an AssumptionBased result. Fix this by introducing an additional AssumptionBased state for cache entries. If such a result is used, we'll still increment AAQI.NumAssumptionUses, which means that the using entry will also become AssumptionBased and be cleared if the assumption is disproved. At the end of the root query, convert remaining AssumptionBased results into definitive results. Fixes https://github.com/llvm/llvm-project/issues/98978. (cherry picked from commit 91073380ac5a0dceebdd09f360a1dc194d7ee93f)
* [compiler-rt][ubsan][nfc-ish] Fix a type conversion bug (#100665)Alan Zhao2024-07-261-1/+1
| | | | | | | | | | If the inline asm version of `ptrauth_strip` is used instead of the builtin, the inline asm implementation currently returns an unsigned long, causing an incompatible pointer conversion issue. The spec for `ptrauth_sign` is that the result has the same type as the original value, so we add a cast to the result of the inline asm. (cherry picked from commit 25f9415713f9f57760a5322876906dc11385ef8e)
* [flang][OpenMP] Initialize privatised derived type variables (#100417)Tom Eccles2024-07-264-11/+73
| | | | | | Fixes #91928 (cherry picked from commit 98e733eaf2af1a5c1d9392e279d21182ffdf560d)
* Normalize ptrauth handling in sanitizer runtime (#100483)Anton Korobeynikov2024-07-261-22/+24
| | | | | | | | | | | 1. Include `ptrauth.h` if `ptrauth_intrinsics` language feature is specified (per ptrauth spec, this is what enables `ptrauh.h` usage and functions like `ptrauth_strip`) 2. For PAC-RET fallback implement two changes: 1. Switch to macro, so we can ignore key argument 2. Ensure the unsigned value is erased from LR, so the possibility of gadget reuse is reduced. Fixes #100467 (cherry picked from commit cc4f98979b079b517edd8a71f56a8975f436e63d)
* [libc++] Add missing xlocale.h include on Apple and FreeBSD (#99689)Louis Dionne2024-07-261-0/+4
| | | | | | | | | The `<locale>` header uses `strtoll_l` and friends which are defined in `<xlocale.h>` on these platforms. While this works via transitive includes when modules are disabled, this doesn't work anymore if the platforms are modularized properly. (cherry picked from commit a55df237375e98cfc2520d5eb1a23b302ef02ba0)
* [clang] Remove `__is_layout_compatible` from revertible type traits list ↵Vlad Serebrennikov2024-07-261-1/+3
| | | | | | | | | | | | | | | | | | (#100572) `__is_layout_compatible` was added in Clang 19 (#81506), and at that time it wasn't entirely clear whether it should be a revertible type trait or not. We decided to follow the example of other type traits. Since then #95969 happened, and now we know that we don't want new revertible type traits. This patch removes `__is_layout_compatible` from revertible type traits list, and leaves a comment what revertible type traits are, and that new type traits should not be added there. The intention is to also cherry-pick this to 19 branch. (cherry picked from commit 3295d377f37a60597321f502d164b5d6b1948e28)
* [AArch64][SME] Rewrite __arm_get_current_vg to preserve required registers ↵Kerry McLaughlin2024-07-262-28/+44
| | | | | | | | | | | | | | | | (#100143) The documentation for the __arm_get_current_vg support routine specifies that the following registers are call-preserved: - X1-X15, X19-X29 and SP - Z0-Z31 - P0-P15 This patch rewrites the implementation of this routine in compiler-rt, as the current version does not guarantee that these registers will be preserved. (cherry picked from commit 6da6772bf0a33131aa8540c9d4f60d5db75c32b5)
* [Flang][Driver] Enable config file options (#100343)Kiran Chandramohan2024-07-268-5/+74
| | | | | | | | Config files provide a facility to invoke the compiler with a predefined set of options. The patch only enables these options in the flang driver. Functionality was always there. (cherry picked from commit 8a77961280536b680c404a49002a00b988ca45fc)
* [libc] Only add '-fno-builtin-*' on the entrypoints that use them (#100481)Joseph Huber2024-07-262-10/+12
| | | | | | | | | | | | | | | | | Summary: The GPU build needs to be able to inline stuff in LTO. Builtin transformations cause problems on the functions that the optimizer does heavy libcall recognition on. Previously we moved to using `-fno-builtin-*` to allow us to only disable the problematic ones. However, this still didn't allow inlining because each function had the attribute that told the inliner not to inlining a nobuiltin function into a non-nobuiltin function This patch fixes that by only applying these attributes to the entrypoints that define them. That is enough to prevent recursive calls within the definitoins themselves. (cherry picked from commit 8e43acbfedf53ded43ec693ddaaf518cb7416c1c)
* [PAC][clang] Enable `-fptrauth-indirect-gotos` as part of pauthtest ABI ↵Daniil Kovalev2024-07-262-3/+7
| | | | | | (#100480) (cherry picked from commit 3f6eb13abf643afec17a73448ede380606531226)
* [Flang][Docs] Update information about AArch64 trampolines (#100391)Carlos Seo2024-07-261-1/+1
| | | | | | | Commits c4b66bf and 7647174 add support for AArch64 trampolines. Updated documentation to reflect the changes. (cherry picked from commit c6e69b041a7e6d18463f6cf684b10fd46a62c496)
* [AArch64] Implement INIT/ADJUST_TRAMPOLINE (#70267)Carlos Seo2024-07-266-1/+127
| | | | | | | | | | | | Add support for llvm.init.trampoline and llvm.adjust.trampoline intrinsics for AArch64. Fixes https://github.com/llvm/llvm-project/issues/65573 Fixes https://github.com/llvm/llvm-project/issues/76927 Fixes https://github.com/llvm/llvm-project/issues/83555 Updates https://github.com/llvm/llvm-project/pull/66157 (cherry picked from commit c4b66bf4d065d3bbc2e2fac8512a6df8e013c704)
* [ExprConstant] Handle shift overflow the same way as other kinds of overflow ↵Eli Friedman2024-07-268-35/+65
| | | | | | | | | | | | | (#99579) We have a mechanism to allow folding expressions that aren't ICEs as an extension; use it more consistently. This ends up causing bad effects on diagnostics in a few cases, but that's not specific to shifts; it's a general issue with the way those uses handle overflow diagnostics. (cherry picked from commit 20eff684203287828d6722fc860b9d3621429542)
* [libc++][spaceship] Implements X::iterator container requirements. (#99343)Mark de Wever2024-07-2614-7/+413
| | | | | | | | | | | | This implements the requirements for the container iterator requirements for array, deque, vector, and `vector<bool>`. Implements: - LWG3352 strong_equality isn't a thing Implements parts of: - P1614R2 The Mothership has Landed Fixes: https://github.com/llvm/llvm-project/issues/62486
* [libc++] Improve behavior when using relative path for ↵Louis Dionne2024-07-262-3/+8
| | | | | | | | LIBCXX_ASSERTION_HANDLER_FILE (#100157) Fixes #80696 (cherry picked from commit 046a17717d9c5b5385ecd914621b48bdd91524d0)
* [Clang][NFC] Simplify initialization of `OverloadCandidate` objects. (#100318)cor3ntin2024-07-262-20/+4
| | | | | | | | | | | | Initialize some fields of OverloadCandidate in its constructor. The goal here is try to fix read of uninitialized variable (which I was not able to reproduce) https://github.com/llvm/llvm-project/pull/93430#issuecomment-2187544278 We should certainly try to improve the construction of `OverloadCandidate` further as it can be quite britle. (cherry picked from commit 7d787df5b932b73aae6532d1e981152f103f9244)
* [Clang] Fix an assertion failure introduced by #93430 (#100313)cor3ntin2024-07-262-1/+6
| | | | | | | | | The PR #93430 introduced an assertion that did not make any sense. and caused a regression. The fix is to simply remove the assertion. No changelog. the intent is to backport this fix to clang 19. (cherry picked from commit dd82a84e0eeafb017c7220c4a9fbd0a8a407f8a9)
* [LLVM] [MC] Update frame layout & CFI generation to handle frames larger ↵Wesley Wiser2024-07-2619-65/+65
| | | | | | | | | | | | | | | | | | | | | | | | than 2gb (#99263) Rebase of #84114. I've only included the core changes to frame layout calculation & CFI generation which sidesteps the regressions found after merging #84114. Since these changes are a necessary precursor to the overall fix and are themselves slightly beneficial as CFI is now generated correctly, I think it is reasonable to merge this first step. --- For very large stack frames, the offset from the stack pointer to a local can be more than 2^31 which overflows various `int` offsets in the frame lowering code. This patch updates the frame lowering code to calculate the offsets as 64-bit values and fixes CFI to use the corrected sizes. After this patch, additional work is needed to fix offset truncations in each target's codegen. (cherry picked from commit ca076f7a63f6a80e2e38315ec462be354b196b8d)
* [clang][headers] Including stddef.h always redefines NULL (#99727)Ian Anderson2024-07-264-8/+105
| | | | | | | | | | | | stddef.h always includes __stddef_null.h. This is fine in modules because it's not possible to re-include the pcm, and it's necessary to export the _Builtin_stddef.null submodule. However, without modules it causes NULL to always get redefined which disrupts some C++ code. Rework the inclusion of __stddef_null.h so that with not building with modules it's only included if __need_NULL is set by the includer, or it's the first time stddef.h is being included. (cherry picked from commit 92a9d4831d5e40c286247c30fcd794563adbef6e)
* [libc++][doc] Update the release notes for LLVM 19. (#99061)Mark de Wever2024-07-263-11/+52
| | | | This is a preparation for the upcoming LLVM 19 release.
* [ARM] Create mapping symbols with non-unique namesFangrui Song2024-07-2412-47/+43
| | | | | | | | | | Similar to #99836 for AArch64. Non-unique names save .strtab space and match GNU assembler. Pull Request: https://github.com/llvm/llvm-project/pull/99906 (cherry picked from commit 298a9223a57c50cb0d24b82687ad1bc2f7a022e6)
* [RISCV] Fix InsnCI register type (#100113)Sudharsan Veeravalli2024-07-242-4/+14
| | | | | | | | | According to the spec the CI type instructions can take any of the 32 RVI registers. Fixes #100112 (cherry picked from commit 1ebfc81a91194c000ac70b4ea53891cc956aa6eb)
* [flang] fix C_PTR function result lowering (#100082)jeanPerier2024-07-243-88/+110
| | | | | | | | | | | | | | Functions returning C_PTR were lowered to function returning intptr (i64 on 64bit arch). This caused conflicts when these functions were defined as returning !fir.ref<none>/llvm.ptr in other compiler generated contexts (e.g., malloc). Lower them to return !fir.ref<none>. This should deal with https://github.com/llvm/llvm-project/issues/97325 and https://github.com/llvm/llvm-project/issues/98644. (cherry picked from commit 1ead51a86c6c746a1b9948ca1ee142df223ffebd)
* [PAC] Define __builtin_ptrauth_type_discriminator (#100204)Akira Hatanaka2024-07-2414-3/+183
| | | | | | | | | | | | | | | | The builtin computes the discriminator for a type, which can be used to sign/authenticate function pointers and member function pointers. If the type passed to the builtin is a C++ member function pointer type, the result is the discriminator used to signed member function pointers of that type. If the type is a function, function pointer, or function reference type, the result is the discriminator used to sign functions of that type. It is ill-formed to use this builtin with any other type. A call to this function is an integer constant expression. Co-Authored-By: John McCall rjmccall@apple.com (cherry picked from commit 666e3326fedfb6a033494c36c36aa95c4124d642)
* [ValueTracking] Don't use CondContext in dataflow analysis of phi nodes ↵Yingwei Zheng2024-07-243-11/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#100316) See the following case: ``` define i16 @pr100298() { entry: br label %for.inc for.inc: %indvar = phi i32 [ -15, %entry ], [ %mask, %for.inc ] %add = add nsw i32 %indvar, 9 %mask = and i32 %add, 65535 %cmp1 = icmp ugt i32 %mask, 5 br i1 %cmp1, label %for.inc, label %for.end for.end: %conv = trunc i32 %add to i16 %cmp2 = icmp ugt i32 %mask, 3 %shl = shl nuw i16 %conv, 14 %res = select i1 %cmp2, i16 %conv, i16 %shl ret i16 %res } ``` When computing knownbits of `%shl` with `%cmp2=false`, we cannot use this condition in the analysis of `%mask (%for.inc -> %for.inc)`. Fixes https://github.com/llvm/llvm-project/issues/100298. (cherry picked from commit 59eae919c938f890e9b9b4be8a3fa3cb1b11ed89)
* [LSR] Fix matching vscale immediates (#100080)Benjamin Maxwell2024-07-242-10/+16
| | | | | | | | | | | | | | | | | Somewhat confusingly a `SCEVMulExpr` is a `SCEVNAryExpr`, so can have > 2 operands. Previously, the vscale immediate matching did not check the number of operands of the `SCEVMulExpr`, so would ignore any operands after the first two. This led to incorrect codegen (and results) for ArmSME in IREE (https://github.com/iree-org/iree), which sometimes addresses things that are a `vscale * vscale` multiple away. The test added with this change shows an example reduced from IREE. The second write should be offset from the first `16 * vscale * vscale` (* 4 bytes), however, previously LSR dropped the second vscale and instead offset the write by `#4, mul vl`, which is an offset of `16 * vscale` (* 4 bytes). (cherry picked from commit 7fad04e94b7b594389111ae7eca0883ef18dc90b)
* Precommit vscale-fixups.ll test (NFC)Benjamin Maxwell2024-07-241-0/+47
| | | | | | Precommit test for #100080. (cherry picked from commit c1b70fa5bfea973d4141e27cf9668e9325609e19)
* [clang] Define `ATOMIC_FLAG_INIT` correctly for C++. (#97534)Chris Copeland2024-07-243-0/+12
| | | | (cherry picked from commit 4bb3a1e16f3a854d05bc0b8c5b6f8f78effb1d93)
* [clang][OpenMP] Propoagate debug location to OMPIRBuilder reduction codegen ↵Jan Leyonberg2024-07-241-1/+2
| | | | | | | | | | | (#100358) This patch propagates the debug location from Clang to the OpenMPIRBuilder. Fixes https://github.com/llvm/llvm-project/issues/97458 (cherry picked from commit 5b15d9c441810121c23f9f421bbb007fd4c448e8)
* [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (#99511)azhan922024-07-2415-27/+120
| | | | | | | This PR adds support for -mcpu=pwr11/power11 and -mtune=pwr11/power11 in clang and llvm. (cherry picked from commit 1df4d866cca51eeab8f012a97cc50957b45971fe)
* [libc++][string] Fixes shrink_to_fit. (#97961)Mark de Wever2024-07-242-3/+55
| | | | | | | | This ensures that shrink_to_fit does not increase the allocated size. Partly addresses #95161 (cherry picked from commit d0ca9f23e8f25b0509c3ff34ed215508b39ea6e7)
* [libc++][vector<bool>] Tests shrink_to_fit requirement. (#98009)Mark de Wever2024-07-241-1/+44
| | | | | | | | | | | | | | `vector<bool>`'s shrink_to_fit implementation is using the "swap-to-free-container-resources-trick" which only shrinks when the input vector is empty. Since the request to shrink_to_fit is non-binding, this is a valid implementation. It is not a high-quality implementation. Since `vector<bool>` is not a very popular container the implementation has not been changed and only a test to validate the non-growing property has been added. This was discovered while investigating #95161. (cherry picked from commit c2e438675754b83c31d7d5ba40cb13fe77e795de)
* [libc++][math] Fix undue overflowing of `std::hypot(x,y,z)` (#93350)PaulXiCao2024-07-248-65/+197
| | | | | | | | | | | | | | | The 3-dimentionsional `std::hypot(x,y,z)` was sub-optimally implemented. This lead to possible over-/underflows in (intermediate) results which can be circumvented by this proposed change. The idea is to to scale the arguments (see linked issue for full discussion). Tests have been added for problematic over- and underflows. Closes #92782 (cherry picked from commit 9628777479a970db5d0c2d0b456dac6633864760)
* [PowerPC] Add builtin_cpu_is P11 support (#99550)azhan922024-07-243-10/+69
| | | | | | This PR adds support for __builtin_cpu_is ("power11") (cherry picked from commit 63b382bbde5994e8f2cec75883320e3ad9fd618f)
* [NVPTX] Fix internal indirect call prototypes not obeying the ABI (#100131)Joseph Huber2024-07-243-13/+101
| | | | | | | | | | | | | | Summary: The NVPTX backend optimizes the ABI for functions that are internal, however, this is not legal for indirect call prototypes. Previously, we would modify the ABI on an aggregate byval type passed to an indirect call prototype, which would make PTXAS error. This patch just passes the function as a nullptr to force strict ABI compliance without modification in the helper function. Fixes https://github.com/llvm/llvm-project/issues/100055 (cherry picked from commit e0649a5dfc6b859d652318f578bc3d49674787a4)
* [LoongArch] Fix codegen for ISD::ROTR (#100292)hev2024-07-242-1/+36
| | | | | | | | This patch fixes the code generation for IR: sext i32 (trunc i64 (rotr i64 %x, i64 %y) to i32) to i64 (cherry picked from commit e386aacb747b4512dedf481ad83e054d3dd641e6)
* [PAC][compiler-rt][UBSan] Strip signed vptr instead of authenticating it ↵Akira Hatanaka2024-07-241-1/+1
| | | | | | | | | | (#100153) vptr cannot be authenticated without knowing the class type if it was signed with type discrimination. Co-authored-by: Oliver Hunt <oliver@apple.com> (cherry picked from commit 0a6a3c152faf56e07dd4f9e89e534d2b97eeab56)
* [clang][test] Add function type discrimination tests to static destructor ↵Oliver Hunt2024-07-241-6/+31
| | | | | | | | tests (#99604) I accidentally did not include tests for the setting up runtime calls when compiling with -fptrauth-function-pointer-type-discrimination (cherry picked from commit 8be1325cb1903797ba3dce67087e395f9e080576)
* Revert " [LICM] Fold associative binary ops to promote code hoisting (#81608)"Nikita Popov2024-07-246-335/+163
| | | | | | | | This reverts commit f2ccf80136a01ca69f766becafb329db6c54c0c8. The flag propagation code is incorrect. (cherry picked from commit b48819dbcdb48fc737dc22304ac343e4fdbae9ff)
* [LV] Disable VPlan-based cost model for 19.x release.Florian Hahn2024-07-233-4/+1
| | | | | | | | | As discussed in https://github.com/llvm/llvm-project/pull/92555 flip the default for the option added in https://github.com/llvm/llvm-project/pull/99536 to true. This restores the original behavior for the release branch to give the VPlan-based cost model more time to mature on main.
* [Infra] Fix version-check workflow (#100090)Tobias Hieta2024-07-231-1/+1
|
* Bump version to 19.1.0gitTobias Hieta2024-07-234-4/+4
|