aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-10-10Bump version to 15.0.3Tobias Hieta8-11/+11
2022-10-10[Syntax] Fix macro-arg handling in TokenBuffer::spelledForExpandedSam McCall2-63/+211
A few cases were not handled correctly. Notably: #define ID(X) X #define HIDE a ID(b) HIDE spelledForExpanded() would claim HIDE is an equivalent range of the 'b' it contains, despite the fact that HIDE also covers 'a'. While trying to fix this bug, I found findCommonRangeForMacroArgs hard to understand (both the implementation and how it's used in spelledForExpanded). It relies on details of the SourceLocation graph that are IMO fairly obscure. So I've added/revised quite a lot of comments and made some naming tweaks. Fixes https://github.com/clangd/clangd/issues/1289 Differential Revision: https://reviews.llvm.org/D134618 (cherry picked from commit 67268ee11c220b1dfdf84afb10a12371c5ae6400)
2022-10-10[clangd] Improve inlay hints of things expanded from macrosSam McCall2-30/+38
When we aim a hint at some expanded tokens, we're only willing to attach it to spelled tokens that exactly corresponde. e.g. int zoom(int x, int y, int z); int dummy = zoom(NUMBERS); Here we want to place a hint "x:" on the expanded "1", but we shouldn't be willing to place it on NUMBERS, because it doesn't *exactly* correspond (it has more tokens). Fortunately we don't even have to implement this algorithm from scratch, TokenBuffer has it. Fixes https://github.com/clangd/clangd/issues/1289 Fixes https://github.com/clangd/clangd/issues/1118 Fixes https://github.com/clangd/clangd/issues/1018 Differential Revision: https://reviews.llvm.org/D133982 (cherry picked from commit 924974a3a13b03090d04860f209ce11b3d9d00a6)
2022-10-10[X86] Remove AVX512VP2INTERSECT from Sapphire Rapids.Freddy Ye2-6/+5
For more details, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D135509 (cherry picked from commit 566c277c64f8f76d8911aa5fd931903a357ed7be)
2022-10-10[clangd] Avoid scanning up to end of file on each comment!Sam McCall4-19/+43
Assigning char* (pointing at comment start) to StringRef was causing us to scan the rest of the source file looking for the null terminator. This seems to be eating about 8% of our *total* CPU! While fixing this, factor out the common bits from the two places we're parsing IWYU pragmas. Differential Revision: https://reviews.llvm.org/D135314 (cherry picked from commit 5d2d527c32da2081b814ef8b446bc3e037f74b0a)
2022-10-10[LoopVersioning] Invalidate SCEV for phi if new values are added.Florian Hahn2-1/+128
After 20d798bd47ec5191d, SCEV looks through PHIs with a single incoming value. This means adding a new incoming value may change the SCEV for a phi. Add missing invalidation when an existing PHI is reused during LoopVersioning. New incoming values will be added later from the versioned loop. Similar issues have been fixed by also adding missing invalidation. Fixes #57825. Note that the test case unfortunately requires running loop-vectorize followed by loop-load-elimination, which does the actual versioning. I don't think it is possible to reproduce the failure without that combination. (cherry picked from commit 623c4a7a55f716b96070a5c2f83fe0096cb38d38)
2022-10-10[clang-tools-extra] [clangd] Respect llvm_shlib_dir in testsMichał Górny1-0/+1
Add llvm_shlib_dir to variables used in clangd test suite, consistently to how it is used in the test suites of clang, clang-tools-extra and a few other components. This is necessary to ensure that the correct shared libraries are used when building clang standalone -- otherwise, use_clang() sets LD_LIBRARY_PATH to the directory containing the earlier system installation of clang rather than the just-built library. Differential Revision: https://reviews.llvm.org/D135062 (cherry picked from commit 77945a344c3dee3f9735744c8d4151ef2cec6a8d)
2022-10-04use LLVM_USE_STATIC_ZSTDllvmorg-15.0.2Cole2-14/+4
removes LLVM_PREFER_STATIC_ZSTD in favor of using a LLVM_USE_STATIC_ZSTD Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D133222 (cherry picked from commit fc1da043f4f9198303abd6f643cf23439115ce73)
2022-10-04tweak zstd behavior in cmake and llvm config for better testingCole Kissane4-6/+32
add LLVM_PREFER_STATIC_ZSTD (default TRUE) cmake config flag (compression test seems to fail for shared zstd on windows, note that zstd multithread is by default disabled in the static build so it may be a hidden variable) propagate variable zstd_DIR in LLVMConfig.cmake.in fix llvm-config CMakeLists.txt behavior for absolute libs windows get zstd lib name Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D132870 (cherry picked from commit c0b4f248df79f184adba856f13a950a53c881f3f)
2022-10-04[clang][DebugInfo] Emit debuginfo for non-constant case valueYonghong Song2-0/+45
Currently, clang does not emit debuginfo for the switch stmt case value if it is an enum value. For example, $ cat test.c enum { AA = 1, BB = 2 }; int func1(int a) { switch(a) { case AA: return 10; case BB: return 11; default: break; } return 0; } $ llvm-dwarfdump test.o | grep AA $ Note that gcc does emit debuginfo for the same test case. This patch added such a support with similar implementation to CodeGenFunction::EmitDeclRefExprDbgValue(). With this patch, $ clang -g -c test.c $ llvm-dwarfdump test.o | grep AA DW_AT_name ("AA") $ Differential Revision: https://reviews.llvm.org/D134705 (cherry picked from commit 75be0482a2e2a78fae83f1ca604f4ee20d673796)
2022-10-04[gn build] (manually) port 18b4a8bcf35 moreNico Weber1-1/+1
(cherry picked from commit dd428a571c69621d5b6eb2e0e3ce5497c304fb2c)
2022-10-03[LV] Update handling of scalable pointer inductions after b73d2c8.Florian Hahn8-246/+174
The dependent code has been changed quite a lot since 151c144 which b73d2c8 effectively reverts. Now we run into a case where lowering didn't expect/support the behavior pre 151c144 any longer. Update the code dealing with scalable pointer inductions to also check for uniformity in combination with isScalarAfterVectorization. This should ensure scalable pointer inductions are handled properly during epilogue vectorization. Fixes #57912. (cherry picked from commit 2c692d891ed639779b1c4b504ca63037bbacc0e8)
2022-10-03[LV] Add test for #57912.Florian Hahn1-0/+216
Add test showing miscompilation during epilogue vectorization with SVE. (cherry picked from commit 17167005d532dce35ade3a47a0403ffaa7fff6ff)
2022-10-03[LV] Convert sve-epilog-vect.ll to use opaque pointers.Florian Hahn1-111/+99
(cherry picked from commit 05b3493819fa8aba1eb7510afbcb80a64148beb6)
2022-10-03[Clang] Fix variant crashes from GH58028, GH57370Roy Jacobson2-4/+28
Fixes a null dereference in some diagnostic issuing code. Closes https://github.com/llvm/llvm-project/issues/57370 Closes https://github.com/llvm/llvm-project/issues/58028 Reviewed By: shafik Differential Revision: https://reviews.llvm.org/D134885 (cherry picked from commit 9415aad6a40fec74296008a25f34164a95c857f4)
2022-09-30[ValueTracking] Fix CannotBeOrderedLessThanZero() for fdiv (PR58046)Nikita Popov2-4/+17
When checking the RHS of fdiv, we should set the SignBitOnly flag, because a negative zero can become -Inf, which is ordered less than zero. Fixes https://github.com/llvm/llvm-project/issues/58046. Differential Revision: https://reviews.llvm.org/D134876
2022-09-30[InstSimplify] Add test for PR58046 (NFC)Nikita Popov1-0/+12
2022-09-30[libcxx] Make stdatomic.h work when included from a C source fileGergely Nagy3-14/+15
If a C source file includes the libc++ stdatomic.h, compilation will break because (a) the C++ standard check will fail (which is expected), and (b) `_LIBCPP_COMPILER_CLANG_BASED` won't be defined because the logic defining it in `__config` is guarded by a `__cplusplus` check, so we'll end up with a blank header. Move the detection logic outside of the `__cplusplus` check to make the second check pass even in a C context when you're using Clang. Note that `_LIBCPP_STD_VER` is not defined when in C mode, hence stdatomic.h needs to check if in C++ mode before using that macro to avoid a warning. In an ideal world, a C source file wouldn't be including the libc++ header directory in its search path, so we'd never have this issue. Unfortunately, certain build environments make this hard to guarantee, and in this case it's easy to tweak this header to make it work in a C context, so I'm hoping this is acceptable. Fixes https://github.com/llvm/llvm-project/issues/57710. Differential Revision: https://reviews.llvm.org/D134591 (cherry picked from commit afec0f0ec38a72bcc6a697c1cefb1dac0bbd02fb)
2022-09-30[docs] improve documentation for misc-const-correctnessJonas Toth1-32/+80
Improve the documentation for 'misc-const-correctness' to: - include better examples - improve the english - fix links to other checks that were broken due to the directory-layout changes - mention the limitation that the check does not run on `C` code. Addresses #56749, #56958 Reviewed By: njames93 Differential Revision: https://reviews.llvm.org/D132244 (cherry picked from commit b5b750346346bfe95c7c6b1cceacc6cfccc8f4f4)
2022-09-30[clang-tidy] adjust treating of array-of-pointers when 'AnalyzePointers' is ↵Jonas Toth3-48/+73
deactivated 'misc-const-correctness' previously considered arrays as 'Values' independent of the type of the elements. This is inconsistent with the configuration of the check to disable treating pointers as values. This patch rectifies this inconsistency. Fixes #56749 Reviewed By: njames93 Differential Revision: https://reviews.llvm.org/D130793 (cherry picked from commit e66345d54d5f5e803f54c1ace487d57bb11ee884)
2022-09-28Fix build error in StmtPrinterTest.cppNathan Ridge1-9/+11
(cherry picked from commit c933453858307d060a1b79e257feb99c9ac828d7)
2022-09-28[clangd] Avoid crash when printing call to string literal operator templateNathan Ridge2-3/+34
Differential Revision: https://reviews.llvm.org/D132830 (cherry picked from commit 898c421975ed36b99ec2047589384539bd29a40b)
2022-09-28[ELF] Rewrite R_RISCV_ALIGN nops when r.addend%4 != 0Fangrui Song2-4/+18
For RVC, GNU assembler and LLVM integrated assembler add c.nop followed by a sequence of 4-byte nops. Even if remove % 4 == 0, we have to split one 4-byte nop and therefore need to write the code sequence, otherwise we create an incorrect c.unimp. (cherry picked from commit 78084d9e77b9a2017e2215491b71b37c2671c292)
2022-09-26Bump version to 15.0.2Tobias Hieta8-11/+11
2022-09-26Exclude check-polly-unittests and check-polly-isl from check-allEli Friedman1-0/+2
The unittests are already included in check-polly, so check-all was running them twice. Running them twice causes a race on the output files, which led to intermittent failures on the reverse-iteration buildbot. (cherry picked from commit 2c29268bfcc84c3b94bcb0aa34b7ef9c9bd9af01)
2022-09-26[Hexagon] Add defaulted operator= to classes with defaulted copy ctorKrzysztof Parzyszek1-0/+3
This avoids deprecation warning: ``` warning: definition of implicit copy assignment operator for 'AddrInfo' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy] ``` This fixes https://github.com/llvm/llvm-project/issues/57229 (cherry picked from commit 252cea037bcad6e1e7236756bcbb4e4ed73e328d)
2022-09-26[MachineCycle][NFC] add a cache for block and its top level cycleChen Zheng2-16/+32
This solves https://github.com/llvm/llvm-project/issues/57664 Reviewed By: sameerds Differential Revision: https://reviews.llvm.org/D134019 (cherry picked from commit c941d925b0e47ec166364178edac75cf1cb1ee1a)
2022-09-23[libc++] Keep unary_function and binary_function in C++17 for one more releaseLouis Dionne3-5/+19
In LLVM 15, we added the deprecation markup for unary_function and binary_function for >= C++11, and we also removed it for >= C++17. While this is in accordance with the Standard, it's also a bit quick for our users, since there was no release in which the classes were marked as deprecated before their removal. We noticed widespread breakage due to this, and after months of trying to fix downstream failures, I am coming to the conclusion that users will be better served if we give them one release where unary_function is deprecated but still provided even in >= C++17. Differential Revision: https://reviews.llvm.org/D134473
2022-09-22SPIRV: Fix compilation in NDEBUG.James Y Knight1-0/+2
(cherry picked from commit 59351fe340f20a605bae53260ed30a8e0fd95cb6)
2022-09-20[LV] Keep track of cost-based ScalarAfterVec in VPWidenPointerInd.llvmorg-15.0.1Florian Hahn10-191/+292
Epilogue vectorization uses isScalarAfterVectorization to check if widened versions for inductions need to be generated and bails out in those cases. At the moment, there are scenarios where isScalarAfterVectorization returns true but VPWidenPointerInduction::onlyScalarsGenerated would return false, causing widening. This can lead to widened phis with incorrect start values being created in the epilogue vector body. This patch addresses the issue by storing the cost-model decision in VPWidenPointerInductionRecipe and restoring the behavior before 151c144. This effectively reverts 151c144, but the long-term fix is to properly support widened inductions during epilogue vectorization Fixes #57712.
2022-09-20[LV] Move new epilog-vectorization-widen-inductions.ll to AArch64 dir.Florian Hahn1-0/+0
The test requires the AArch64 backend, so move it to the right subdir.
2022-09-20[LV] Add tests for epilogue vectorization with widened inductions.Florian Hahn1-0/+274
Includes a test for the miscompile in #57712.
2022-09-19[libc++] Always query the compiler to find whether a type is always lockfreeLouis Dionne4-43/+26
In https://llvm.org/D56913, we added an emulation for the __atomic_always_lock_free compiler builtin when compiling in Freestanding mode. However, the emulation did (and could not) give exactly the same answer as the compiler builtin, which led to a potential ABI break for e.g. enum classes. After speaking to the original author of D56913, we agree that the correct behavior is to instead always use the compiler builtin, since that provides a more accurate answer, and __atomic_always_lock_free is a purely front-end builtin which doesn't require any runtime support. Furthermore, it is available regardless of the Standard mode (see https://godbolt.org/z/cazf3ssYY). However, this patch does constitute an ABI break. As shown by https://godbolt.org/z/1eoex6zdK: - In LLVM <= 11.0.1, an atomic<enum class with 1 byte> would not contain a lock byte. - In LLVM >= 12.0.0, an atomic<enum class with 1 byte> would contain a lock byte. This patch breaks the ABI again to bring it back to 1 byte, which seems like the correct thing to do. Fixes #57440 Differential Revision: https://reviews.llvm.org/D133377 (cherry picked from commit f1a601fe88f99d52ca80617266897b217bcd4d64)
2022-09-19[docs] Fix build-docs.shTobias Hieta1-1/+1
If libcxxabi is not included CMake will error out: Cannot find target libcxxabi-SHARED I ran into this doing the 15.0.0 release Differential Revision: https://reviews.llvm.org/D133475
2022-09-19[libcxx] Bump libc++ version to 15.0.1Tobias Hieta1-1/+1
2022-09-19[CodeGen] Don't zero callee-save registers with zero-call-used-regs (PR57692)Nikita Popov3-55/+4
Callee save registers must be preserved, so -fzero-call-used-regs should not be zeroing them. The previous implementation only did not zero callee save registers that were saved&restored inside the function, but we need preserve all of them. Fixes https://github.com/llvm/llvm-project/issues/57692. Differential Revision: https://reviews.llvm.org/D133946 (cherry picked from commit b4309800e9dc53a84222a6b57c8615d4a3084988)
2022-09-19[lit] Set shlibpath_var on OpenBSDBrad Smith1-1/+1
(cherry picked from commit 3eca0b395ff07d0428f4179e33a6ae295e608f47)
2022-09-19[clang(d)] Include/Exclude CLDXC options properlyKadir Cetinkaya3-4/+20
This handles the new CLDXC options that was introduced in https://reviews.llvm.org/D128462 inside clang-tooling to make sure cl driver mode is not broken. Fixes https://github.com/clangd/clangd/issues/1292. Differential Revision: https://reviews.llvm.org/D133962 (cherry picked from commit 23ace26e0d1aa2283d65d192c37592fb0eef1b1f)
2022-09-19[Libomptarget] Revert changes to AMDGPU plugin destructorsJoseph Huber2-50/+29
These patches exposed a lot of problems in the AMD toolchain. Rather than keep it broken we should revert it to its old semi-functional state. This will prevent us from using device destructors but should remove some new bugs. In the future this interface should be changed once these problems are addressed more correctly. This reverts commit ed0f21811544320f829124efbb6a38ee12eb9155. This reverts commit 2b7203a35972e98b8521f92d2791043dc539ae88. Fixes #57536 Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D133997
2022-09-15[llvm-objdump] Change printSymbolVersionDependency to use ELFFile APIFangrui Song4-22/+43
When .gnu.version_r is empty (allowed by readelf but warned by objdump), llvm-objdump -p may decode the next section as .gnu.version_r and may crash due to out-of-bounds C string reference. ELFFile<ELFT>::getVersionDependencies handles 0-entry .gnu.version_r gracefully. Just use it. Fix https://github.com/llvm/llvm-project/issues/57707 Differential Revision: https://reviews.llvm.org/D133751 (cherry picked from commit 25394c9d10e73b666f4fa1dff2426824894cce58)
2022-09-15[llvm-objdump][test] Add verneed-invalid.testFangrui Song1-0/+25
(cherry picked from commit 55a72dae1f996e4fb1528c1b6b1bff8550fec303)
2022-09-15[compiler-rt] Handle non-canonical triples with new runtime lib layoutRainer Orth1-0/+4
As described in Issue #54196 <https://github.com/llvm/llvm-project/issues/54196>, the ideas of `clang` and `compiler-rt` where runtime libs are located with `-DLLVM_ENABLE_RUNTIMES` can differ. This is the `compiler-rt` side of the patch I've used to get them in sync for the `amd64-pc-solaris2.11` and `sparc64-unknown-linux-gnu` release builds. Tested on `amd64-pc-solaris2.11` and `sparc64-unknown-linux-gnu`. Differential Revision: https://reviews.llvm.org/D133406 (cherry picked from commit cadc9cdedfef892b00b17658a823e4846a71e3ac)
2022-09-15[NFC] Fix exception in version-check.py scriptTobias Hieta1-1/+1
2022-09-15Bump version to 15.0.1Tobias Hieta7-10/+10
2022-09-15Downgrade implicit int and implicit function declaration to warning onlyAaron Ballman51-141/+148
The changes in Clang 15.0.0 which enabled these diagnostics as a warning which defaulted to an error caused disruption for people working on distributions such as Gentoo. There was an explicit request to downgrade these to be warning-only in Clang 15.0.1 with the expectation that Clang 16 will default the diagnostics to an error. See https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213 for more details on the discussion. See https://reviews.llvm.org/D133800 for the public review of these changes.
2022-09-14[MachO] Don't fold compact unwind entries with LSDAShoaib Meenai2-12/+184
Folding them will cause the unwinder to compute the incorrect function start address for the folded entries, which in turn will cause the personality function to interpret the LSDA incorrectly and break exception handling. You can verify the end-to-end flow by creating a simple C++ file: ``` void h(); int main() { h(); } ``` and then linking this file against the liblsda.dylib produced by the test case added here. Before this change, running the resulting program would result in a program termination with an uncaught exception. Afterwards, it works correctly. Reviewed By: #lld-macho, thevinster Differential Revision: https://reviews.llvm.org/D132845 (cherry picked from commit 56bd3185cdd8d79731acd6c75bf41869284a12ed)
2022-09-14[MachO] Fix dead-stripping __eh_frameShoaib Meenai2-0/+55
This section is marked S_ATTR_LIVE_SUPPORT in input files, which meant that on arm64, we were unnecessarily preserving FDEs if we e.g. had multiple weak definitions for a function. Worse, we would actually produce an invalid `__eh_frame` section in that case, because the CIE associated with the unnecessary FDE would still get dead-stripped and we'd end up with a dangling FDE. We set up associations from functions to their FDEs, so dead-stripping will just work naturally, and we can clear S_ATTR_LIVE_SUPPORT from our input `__eh_frame` sections to fix dead-stripping. Reviewed By: #lld-macho, int3 Differential Revision: https://reviews.llvm.org/D132489 (cherry picked from commit a745e47900dde15c180d5caea7a1d292ca809eb1)
2022-09-14[libc++][format] Updates feature-test macros.Mark de Wever5-20/+22
During the discussion on the SG-10 mailinglist regarding the format feature-test macros voted in during the last plenary it turns out libc++ can't mark the format feature-test macro as implemented. According to https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#__cpp_lib_format the not yet implemented paper P1361R2 Integration of chrono with text formatting affects the feature test macro. Note that P1361R2 doesn't mention the feature-test macro nor is there an LWG-issue to address the issue. The reporter of the issue didn't recall where this requirement exactly has been decided. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D133271
2022-09-12[LLD][COFF] Fix writing a map file when range extension thunks are insertedJan Ole Hüser4-4/+7
Bug: An assertion fails: Assertion failed: isa<To>(Val) && "cast<Ty>() argument of incompatible type!", file C:\Users\<user>\prog\llvm\llvm-git-lld-bug\llvm\include\llvm/Support/Casting.h, line 578 Bug is triggered, if - a map file is requested with /MAP, and - Architecture is ARMv7, Thumb, and - a relative jump (branch instruction) is greater than 16 MiB (2^24) The reason for the Bug is: - a Thunk is created for the jump - a Symbol for the Thunk is created - of type `DefinedSynthetic` - in file `Writer.cpp` - in function `getThunk` - the Symbol has no name - when creating the map file, the name of the Symbol is queried - the function `Symbol::computeName` of the base class `Symbol` casts the `this` pointer to type `DefinedCOFF` (a derived type), but the acutal type is `DefinedSynthetic` - The in the llvm::cast an assertion fails Changes: - Modify regression test to trigger this bug - Give the symbol pointing to the thunk a name, to fix the bug - Add assertion, that only DefinedCOFF symbols are allowed to have an empty name, when the constructor of the base class Symbol is executed Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D133201 (cherry picked from commit 4e5a59a3839f54d928d37d49d4c4ddbb3f339b76)
2022-09-12[mlir] Fix building CRunnerUtils on OpenBSD with 15.xBrad Smith1-5/+1
CRunnerUtils builds as C++11. 9c1d133c3a0256cce7f40e2e06966f84e8b99ffe broke the build on OpenBSD. aligned_alloc() was only introduced in C++17.