summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Modify an IO format error messagevkd1V Donaldson2022-01-043-6/+6
| | | | | | | | | | | | | | F18 constraint C1308 is: For the G edit descriptor, e shall not be specified if w is zero. For an edit descriptor such as 'G0.2E4', change the error message from: error: Unexpected 'e' in 'G0' edit descriptor To: error: A 'G0' edit descriptor must not have an 'e' value
* [SCEV] Compute exit count from overflow check expressed w/ x.with.overflow ↵Philip Reames2022-01-043-22/+51
| | | | | | | | | | intrinsics This ports the logic we generate in instcombine for a single use x.with.overflow check for use in SCEV's analysis. The result is that we can prove trip counts for many checks, and (through existing logic) often discharge them. Motivation comes from compiling a simple example with -ftrapv. Differential Revision: https://reviews.llvm.org/D116499
* Add extra test for D116499 requested in reviewPhilip Reames2022-01-041-0/+24
|
* [mlir] Fix incorrect top-level comment in DialectSparseTensor.cppAlex Zinenko2022-01-041-1/+1
|
* [llvm][cmake] never link llvm-config against llvm dylibsternenseemann2022-01-041-0/+6
| | | | | | | | | | | | | | | | | When cross-compiling, in order to make the output of the native and cross-compiled llvm-config match, one needs to re-pass all cmake flags relevant to BuildVariables.inc via `CROSS_TOOLCHAIN_FLAGS_NATIVE`. If `LLVM_LINK_LLVM_DYLIB=ON` is among those, building a full `libLLVM` shared object is required for the native llvm-config, otherwise `--shared-mode` will be incorrect and `--link-shared` broken. To avoid this, we can make llvm-config link statically against the needed components for simplicity's sake in both the native and cross case. Reviewed By: beanz Differential Revision: https://reviews.llvm.org/D116537
* [libc++] Use std::addressof in std::function::targetLouis Dionne2022-01-043-4/+43
| | | | | | | This guards against hostile overloads of operator&. Thanks to Peter Dimov for the report in https://github.com/boostorg/lambda/issues/24. Differential Revision: https://reviews.llvm.org/D116380
* [funcattrs] Infer writeonly argument attribute [part 2]Philip Reames2022-01-048-17/+31
| | | | | | | | This builds on the code from D114963, and extends it to handle calls both direct and indirect. With the revised code structure (from series of previously landed NFCs), this is pretty straight forward. One thing to note is that we can not infer writeonly for arguments which might be captured. If the pointer can be read back by the caller, and then read through, we have no way to track that. This is the same restriction we have for readonly, except that we get no mileage out of the "callee can be readonly" exception since a writeonly param on a readonly function is either a) readnone or b) UB. This means we can't actually infer much unless nocapture has already been inferred. Differential Revision: https://reviews.llvm.org/D115003
* [regalloc] Fix GCC warning `-Wattributes`. NFC.Michael Liao2022-01-041-3/+3
| | | | | - Mark it with LLVM_LIBRARY_VISIBILITY to preserve the legacy visibility.
* [X86] combineSetCCMOVMSK - use APInt::getLowBitsSet to create bitmask. NFC.Simon Pilgrim2022-01-041-1/+1
| | | | SelectionDAG::getConstant creates an APInt internally anyway, and getLowBitsSet helps assert for legal bitwidths. Plus it silences static analyzer out-of-bounds shift warnings.
* [mlir][ods] Handle DeclareOpInterfaceMethods in formatgenJacques Pienaar2022-01-044-4/+29
| | | | | | | | | | | Previously it would not consider ops with DeclareOpInterfaceMethods<InferTypeOpInterface> as having the InferTypeOpInterface interfaces added. The OpInterface nested inside DeclareOpInterfaceMethods is not retained so that one could query it, so check for the the C++ class directly (a bit raw/low level - will be addressed in follow up). Differential Revision: https://reviews.llvm.org/D116572
* [clang-format] Add an option to add a space between operator overloading and ↵Rajat Bajpai2022-01-046-4/+59
| | | | | | | | | | opening parentheses This change adds an option AfterOverloadedOperator in SpaceBeforeParensOptions to add a space between overloaded operator and opening parentheses in clang-format. Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks Differential Revision: https://reviews.llvm.org/D116283
* [NFC] Expose isRematerializable and copyHint from CalcSpillWeightsMircea Trofin2022-01-042-6/+19
| | | | | | | We need to reuse them for the ML regalloc eviction advisor, as we 'explode' the weight calculation into sub-features. Differential Revision: https://reviews.llvm.org/D116074
* [AST] Produce ReturnStmt containing RecoveryExpr when type is wrongSam McCall2022-01-046-22/+83
| | | | | | | | | Previously we just drop the ReturnStmt and its argument from the AST, which blocks analysis of broken code. Fixes https://github.com/llvm/llvm-project/issues/39944 Differential Revision: https://reviews.llvm.org/D116414
* [NFC][regalloc] Introduce RegAllocGreedy.hMircea Trofin2022-01-042-356/+420
| | | | | | | | | | | This was suggested in D114831. It should simplify the relation between eviction advisor and the allocator, and simplify ingesting more features tied to the internals of the allocator, in the future. This change simply pulls out RAGreedy, places it in the llvm namespace, and cleans up a bit the includes in the new header file. Differential Revision: https://reviews.llvm.org/D116114
* Revert "[JITLink] Add fixup value range check"luxufan2022-01-052-25/+4
| | | | This reverts commit 17af06ba8005d6d14b0ac79ece01ecb028de9f90.
* [InferAttrs] Add writeonly to all the math functionsBenjamin Kramer2022-01-042-115/+126
| | | | | | | | | | | | | | | All of these functions would be `readnone`, but can't be on platforms where they can set `errno`. A `writeonly` function with no pointer arguments can only write (but never read) global state. Writeonly theoretically allows these calls to be CSE'd (a writeonly call with the same arguments will always result in the same global stores) or hoisted out of loops, but that's not implemented currently. There are a few functions in this list that could be `readnone` instead of `writeonly`, if someone is interested. Differential Revision: https://reviews.llvm.org/D116426
* [Arm] Remove duplicate CPU testsTomas Matheson2022-01-041-27/+14
| | | | | | | | | | | | | There are some duplicate test lines in clang/test/Driver/arm-cortex-cpus.c. Looks like these were duplicated from the corresponding v8.0a tests, which test both "-target armv8" and "-target armv8a". "-target armv8.X" without the "a" doesn't work for later versions though. Several tests also specify the -mlittle-endian twice, which looks unintentional. Remove duplicate test: -target arm -march=armv5 -mthumb Differential Revision: https://reviews.llvm.org/D116415
* [LAA] Remove overeager assertion for aggregate types.Florian Hahn2022-01-043-1/+181
| | | | | | | | | 0a00d64 turned an early exit here into an assertion, but the assertion can be triggered, as PR52920 shows. The later code is agnostic to the accessed type, so just drop the assert. The patch also adds tests for LAA directly and loop-load-elimination to show the behavior is sane.
* Delete file erroneously added in 229c95ab661d89dSam McCall2022-01-041-1381/+0
| | | | This was committed by mistake. The unusual filename caused problems for us downstream, apologies if it causes problems for you too!
* [clangd] Adjust compile flags so they work when applied to other file(type)s.Sam McCall2022-01-042-2/+54
| | | | | | | | | | | | | | | | | | | | | It's reasonable to want to use the command from one file to compile another. In particular, the command from a translation unit to parse a related header: {"file": "foo.h", "command": "clang foo.cpp"} This is largely what InterpolatingCompilationDatabase tries to do. To do this correctly can require nontrivial changes to the argv, because the file extension affects semantics. e.g. here we must add "-x c++header". When external tools compile commands for different files, we should apply the same adjustments. This is better than telling people to "fix their tools": - simple e.g. python scripts shouldn't have to interpret clang argv - this is a good way to represent the intent "parse header X in the context of file Y", which can work even if X is not self-contained. clangd does not support this today, but some other tools do, and we may one day. This issue is discussed in https://github.com/clangd/clangd/issues/519 Differential Revision: https://reviews.llvm.org/D116167
* [ConstantFold] Remove another incorrect icmp of gep foldNikita Popov2022-01-042-8/+3
| | | | | | | | This folded (null + X) == g to false, but of course this is incorrect if X == g. Possibly this got confused with the null == g case, which is already handled elsewhere.
* [InstSimplify] Update test to make miscompile more obvious (NFC)Nikita Popov2022-01-041-4/+5
| | | | | | This is now testing (null + g3) != g3 and still coming up with "true" as the answer. The original case was a less obvious miscompile with index overflow involved.
* [libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <__hash_table>Nikolas Klauser2022-01-041-23/+17
| | | | | | | | | | Use `_LIBCPP_DEBUG_ASSERT` in `<__hash_table>` Reviewed By: Quuxplusone, ldionne, Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D116486
* [CodeCompletion] Signature help for aggregate initialization.Sam McCall2022-01-047-112/+1735
| | | | | | | | | | | | | | | | | | | | The "parameter list" is the list of fields which should be initialized. We introduce a new OverloadCandidate kind for this. It starts to become harder for CC consumers to handle all the cases for params, so I added some extra APIs on OverloadCandidate to abstract them. Includes some basic support for designated initializers. The same aggregate signature is shown, the current arg jumps after the one you just initialized. This follows C99 semantics for mixed designated/positional initializers (which clang supports in C++ as an extension) and is also a useful prompt for C++ as C++ designated initializers must be in order. Related bugs: - https://github.com/clangd/clangd/issues/965 - https://github.com/clangd/clangd/issues/306 Differential Revision: https://reviews.llvm.org/D116326
* [JITLink] Add fixup value range checkluxufan2022-01-042-4/+25
| | | | | | | | This patch makes jitlink to report an out of range error when the fixup value out of range Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D107328
* Introduce the AttributeMask classserge-sans-paille2022-01-0417-83/+153
| | | | | | | | | | This class is solely used as a lightweight and clean way to build a set of attributes to be removed from an AttrBuilder. Previously AttrBuilder was used both for building and removing, which introduced odd situation like creation of Attribute with dummy value because the only relevant part was the attribute kind. Differential Revision: https://reviews.llvm.org/D116110
* [gn build] Port 4dcc47aaeaf0LLVM GN Syncbot2022-01-041-0/+1
|
* [gn build] Port 4950198116a5LLVM GN Syncbot2022-01-041-0/+1
|
* [clang][dataflow] Add multi-variable constant propagation example.Yitzhak Mandelbaum2022-01-042-0/+487
| | | | | | | | Adds another constant-propagation analysis that covers all variables in the scope (vs the existing single-variable demo). But, the analysis is still unsuited to use, in that ignores issues of escaping variables. Differential Revision: https://reviews.llvm.org/D116370
* [clang][dataflow] Add parameterized map lattice.Yitzhak Mandelbaum2022-01-043-0/+297
| | | | | | | This patchs adds a `MapLattice` template for lifting a lattice to a keyed map. A typical use is for modeling variables in a scope with a partcular lattice. Differential Revision: https://reviews.llvm.org/D116369
* [CodeGen] Add target triple to test (NFC)Nikita Popov2022-01-041-1/+1
| | | | Exact IR may depend on target.
* [ConstantFold] Remove unnecessary bounded index restrictionNikita Popov2022-01-0430-2085/+2059
| | | | | | | | | | | | | | | | | | | The fold for merging a GEP of GEP into a single GEP currently bails if doing so would result in notional overindexing. The justification given in the comment above this check is dangerously incorrect: GEPs with notional overindexing are perfectly fine, and if some code treats them incorrectly, then that code is broken, not the GEP. Such a GEP might legally appear in source IR, so only preventing its creation cannot be sufficient. (The constant folder also ends up canonicalizing the GEP to remove the notional overindexing, but that's neither here nor there.) This check dates back to https://github.com/llvm/llvm-project/commit/bd4fef4a8939db18f39b108e19097b25e2c7c47a, and as far as I can tell the original issue this was trying to patch around has since been resolved. Differential Revision: https://reviews.llvm.org/D116587
* [libc++] Add `return 0` to some main() functionsLouis Dionne2022-01-043-0/+3
| | | | This unbreaks the tests when running in freestanding mode.
* [CodeGen] Regenerate test checks (NFC)Nikita Popov2022-01-042-77/+121
| | | | | Switch these tests to use update_cc_test_checks.py to simplify future updates.
* [Flang] Enable support for conversion of recursive record typesKiran Chandramohan2022-01-042-6/+34
| | | | | | | | | | | | | | | | | | | Uses the recursive type conversion implemented in D113579, D113580. Tests check for recursive and mutually recursive types. Note: The downstream implementation for recursive types is a bit old and is based on a static map. This was removed while upstreaming (https://reviews.llvm.org/D112961) based on review comments. Since the recursive type conversion is now available in MLIR we are using that. If this patch is accepted we can use the same in the downstream implementation. Part of upstreaming flang from fir-dev branch of https://github.com/flang-compiler/f18-llvm-project. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D115937 Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
* [VP][ISel] use LEGALPOS for legalization actionSimon Moll2022-01-042-4/+11
| | | | | | | | | | Use the VPIntrinsics.def's LEGALPOS that is specified with every VP SDNode to determine which return or operand value type shall be used to infer the legalization action. Reviewed By: frasercrmck Differential Revision: https://reviews.llvm.org/D116594
* [lldb/python] Fix dangling Event and CommandReturnObject referencesPavel Labath2022-01-044-22/+54
| | | | | | | | | | | | | | | | | | | | | | Unlike the rest of our SB objects, SBEvent and SBCommandReturnObject have the ability to hold non-owning pointers to their non-SB counterparts. This makes it hard to ensure the SB objects do not become dangling once their backing object goes away. While we could make these two objects behave like others, that would require plubming even more shared pointers through our internal code (Event objects are mostly prepared for it, CommandReturnObject are not). Doing so seems unnecessarily disruptive, given that (unlike for some of the other objects) I don't see any good reason why would someone want to hold onto these objects after the function terminates. For that reason, this patch implements a different approach -- the SB objects will still hold non-owning pointers, but they will be reset to the empty/default state as soon as the function terminates. This python code will not crash if the user decides to store these objects -- but the objects themselves will be useless/empty. Differential Revision: https://reviews.llvm.org/D116162
* [DAG] TargetLowering::SimplifySetCC - use APInt::getMinSignedBits() helper. NFC.Simon Pilgrim2022-01-041-3/+1
|
* Recommit "[Clang] Extend emitUnaryBuiltin to avoid duplicate logic.""Jun Zhang2022-01-041-49/+40
| | | | | | This reverts the revert commit f552ba6e84057cad56e91e7c54170a60349d3330. Recommit with fixed author name.
* Revert "[Clang] Extend emitUnaryBuiltin to avoid duplicate logic."Florian Hahn2022-01-041-40/+49
| | | | | | | This reverts commit 5c57e6aa5777bddf9ddaca5d927f1b47a1a9d381. Reverted due to a typo in the authors name. Will recommit soon with fixed authorship.
* [OpenMP] Add nec and nvidia as compiler vendors for OpenMPSaiyedul Islam2022-01-044-14/+16
| | | | | | | | | | | | OpenMP Specs 5.0[1] and 5.1[2] recognizes nec and nvidia as known compiler vendors and their absence is causing compilation error in one of the vendor based metadirective test of sollve_vv project[3]. [1] https://www.openmp.org/wp-content/uploads/Context-Definitions-5.0-v1.0.pdf [2] https://www.openmp.org/wp-content/uploads/OpenMP-API-Additional-Definitions-2-0.pdf [3] https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/metadirective/test_metadirective_arch_nvidia_or_amd.c Differential Revision: https://reviews.llvm.org/D116540
* Improve the 'modernize-use-default-member-init'Oleg Smolsky2022-01-044-18/+56
| | | | | | | | | | | We want to deal with non-default constructors that just happen to contain constant initializers. There was already a negative test case, it is now a positive one. We find and refactor this case: struct PositiveNotDefaultInt { PositiveNotDefaultInt(int) : i(7) {} int i; };
* [JITLink] Improve extractBits functionluxufan2022-01-041-4/+4
| | | | | | | | Address the advice proposed at patch D105429 . Use [Low, Low+size) to represent bits. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D107250
* [Clang][Sema] Adjust formatting (NFC)Egor Zhdan2022-01-041-29/+29
| | | | | | | | | | This is a preparation for another change in the watchOS/tvOS availability logic. It is extracted into a separate commit to simplify reviewing and to keep the linter happy at the same time. rdar://81491680 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D116459
* [Clang][NFC] Fix multiline comment prefixes in function headersSaiyedul Islam2022-01-042-7/+8
| | | | | | | | Cleanup of D105191 after latest clang-format changes. Reviewed By: MyDeveloperDay Differential Revision: https://reviews.llvm.org/D111545
* [AVR] Optimize int16 shift operation for shift amount greater than 8Ben Shi2022-01-045-10/+124
| | | | | | | | | | | | Skip operation on the lower byte in int16 logical left shift when shift amount is greater than 8. Skip operation on the higher byte in int16 logical & arithmetic right shift when shift amount is greater than 8. Reviewed By: aykevl Differential Revision: https://reviews.llvm.org/D115594
* [Clang] Extend emitUnaryBuiltin to avoid duplicate logic.Jun Zhan2022-01-041-49/+40
| | | | | | | | | | | This patch extends `emitUnaryBuiltin` so that we can better emitting IR when implement builtins specified in D111529. Also contains some NFC, applying it to existing code. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D116161
* [ConstantFolding] Remove unused ConstantFoldLoadThroughGEPConstantExpr()Nikita Popov2022-01-042-24/+0
| | | | This API is no longer used since bbeaf2aac678633749e7385466da10a1c0120b3b.
* [CodeComplete] drop unused Scope param. NFCSam McCall2022-01-048-22/+20
|
* [ConstFold] Slightly clean up icmp of two geps fold (NFC)Nikita Popov2022-01-041-20/+11
| | | | | As we're only dealing with one type of constant expression here, try to directly cast to GEPOperator.