Sanjay Patel [Sun, 16 Jan 2022 18:36:49 +0000 (13:36 -0500)]
[InstCombine] propagate IR flags from binop through select
The tests with constant folding that produces poison
could potentially remove the select entirely:
https://alive2.llvm.org/ce/z/e-WUqF
...but this patch just removes the FMF-only limitation on
propagation.
Sanjay Patel [Sun, 16 Jan 2022 18:01:43 +0000 (13:01 -0500)]
[InstCombine] add tests for binop with flags and select op; NFC
Sanjay Patel [Sun, 16 Jan 2022 17:44:46 +0000 (12:44 -0500)]
[InstCombine] auto-generate complete test check lines; NFC
Florian Hahn [Sat, 15 Jan 2022 15:57:35 +0000 (15:57 +0000)]
[LV] Make test more robust by adding users of inductions.
The modified tests didn't have actual users of all inductions, making it
trivial to eliminate them. Add users to make sure the inductions are
actually used in the vectorized version.
Florian Hahn [Mon, 17 Jan 2022 13:27:33 +0000 (13:27 +0000)]
[VPlan] Drop unnecessary uses of getVPSingleValue (NFC).
David Sherwood [Mon, 22 Nov 2021 11:38:06 +0000 (11:38 +0000)]
[CodeGen][AArch64] Ensure isSExtCheaperThanZExt returns true for negative constants
When we know the value we're extending is a negative constant then it
makes sense to use SIGN_EXTEND because this may improve code quality in
some cases, particularly when doing a constant splat of an unpacked vector
type. For example, for SVE when splatting the value -1 into all elements
of a vector of type <vscale x 2 x i32> the element type will get promoted
from i32 -> i64. In this case we want the splat value to sign-extend from
(i32 -1) -> (i64 -1), whereas currently it zero-extends from
(i32 -1) -> (i64 0xFFFFFFFF). Sign-extending the constant means we can use
a single mov immediate instruction.
New tests added here:
CodeGen/AArch64/sve-vector-splat.ll
I believe we see some code quality improvements in these existing
tests too:
CodeGen/AArch64/reduce-and.ll
CodeGen/AArch64/unfold-masked-merge-vector-variablemask.ll
The apparent regressions in CodeGen/AArch64/fast-isel-cmp-vec.ll only
occur because the test disables codegen prepare and branch folding.
Differential Revision: https://reviews.llvm.org/D114357
David Green [Mon, 17 Jan 2022 11:04:14 +0000 (11:04 +0000)]
[AArch64] Add tests for sinking mask And to smaller loads. NFC
Fraser Cormack [Sat, 15 Jan 2022 11:46:30 +0000 (11:46 +0000)]
[RISCV] Add tests for scalable-vector vwsub patterns
This patch adds tests for patterns introduced in D117188.
Reviewed By: jacquesguan
Differential Revision: https://reviews.llvm.org/D117392
Nathan James [Mon, 17 Jan 2022 10:55:35 +0000 (10:55 +0000)]
[clangd] Add option to use dirty file contents when building preambles.
Adds a option `use-dirty-preambles` to enable using unsaved in editor contents when building pre-ambles.
This enables a more seamless user experience when switching between header and implementation files and forgetting to save inbetween.
It's also in line with the LSP spec that states open files in the editor should be used instead of on the contents on disk - https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/
For now the option is defaulted to off and hidden, Though I have a feeling it should be moved into the `.clangd` config and possibly defaulted to true.
Addresses https://github.com/clangd/clangd/issues/488
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D95046
Lorenzo Chelini [Thu, 13 Jan 2022 07:43:29 +0000 (08:43 +0100)]
[MLIR][Linalg] Handle Attribute in InitTensorOp
In some cases, the result of an initTensorOp may have an attribute.
However, the Attribute was not passed to `inferResultType`, failing the
verifier. Therefore, propagate the Attribute to `inferResultType`.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D117192
Haojian Wu [Fri, 14 Jan 2022 10:28:04 +0000 (11:28 +0100)]
Reland (2) "[AST] Add RParen loc for decltype AutoTypeloc.""
The patch was reverted because it caused a crash during PCH build -- we
missed to update the RParenLoc in TreeTransform<Derived>::TransformAutoType.
This relands 55d96ac and 37ec65e with a test and fix.
Alex Zinenko [Mon, 17 Jan 2022 09:55:36 +0000 (10:55 +0100)]
Revert "[mlir] fix crash in PybindAdaptors.h"
This reverts commit
970cb57ef72c9045250e0492cb00127b49ddfea8.
Broke the buildbot.
Nikita Popov [Mon, 10 Jan 2022 15:11:24 +0000 (16:11 +0100)]
[MachineInstr] Don't include debug uses in bundle header (PR52817)
Following the recommendation in
https://github.com/llvm/llvm-project/issues/52817#issuecomment-
1007635426,
this excludes debug instructions when finalizing the bundle. As uses
in debug instructions don't have effects, they will no longer be
included in the BUNDLE header.
Fixes https://github.com/llvm/llvm-project/issues/52817.
Differential Revision: https://reviews.llvm.org/D116945
Haojian Wu [Mon, 17 Jan 2022 09:35:29 +0000 (10:35 +0100)]
[clangd] Avoid a code completion crash
This is a workaround (adding a newline to the eof) in clangd to avoid the code
completion crash, see https://github.com/clangd/clangd/issues/332.
In principle, this is a clang bug, we should fix it in clang, but it is not
trivial.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D117456
Ralf Grosse-Kunstleve [Tue, 11 Jan 2022 18:34:38 +0000 (19:34 +0100)]
[LLDB] Fix Python GIL-not-held issues
The GIL must be held when calling any Python C API functions. In multithreaded applications that use callbacks this requirement can easily be violated by accident. A general tool to ensure GIL health is not available, but patching Python Py_INCREF to add an assert provides a basic health check:
```
+int PyGILState_Check(void); /* Include/internal/pystate.h */
+
#define Py_INCREF(op) ( \
+ assert(PyGILState_Check()), \
_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
((PyObject *)(op))->ob_refcnt++)
#define Py_DECREF(op) \
do { \
+ assert(PyGILState_Check()); \
PyObject *_py_decref_tmp = (PyObject *)(op); \
if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
--(_py_decref_tmp)->ob_refcnt != 0) \
```
Adding this assertion causes around 50 test failures in LLDB. Adjusting the scope of things guarded by `py_lock` fixes them.
More background: https://docs.python.org/3/glossary.html#term-global-interpreter-lock
Patch by Ralf Grosse-Kunstleve
Differential Revision: https://reviews.llvm.org/D114722
Nikita Popov [Mon, 17 Jan 2022 09:00:54 +0000 (10:00 +0100)]
[ValueTracking] Remove ComputeMultiple() function
This function is no longer used since
499f1ca79f232faae09b1793a994d1a22ba403cd.
Alex Zinenko [Fri, 14 Jan 2022 16:25:41 +0000 (17:25 +0100)]
[mlir] fix crash in PybindAdaptors.h
The constructor function was being defined without indicating its "__init__"
name, which made it interpret it as a regular fuction rather than a
constructor. When overload resolution failed, Pybind would attempt to print the
arguments actually passed to the function, including "self", which is not
initialized since the constructor couldn't be called. This would result in
"__repr__" being called with "self" referencing an uninitialized MLIR C API
object, which in turn would cause undefined behavior when attempting to print
in C++.
Fix this by specifying the correct name.
This in turn uncovers the fact the the mechanism used by PybindAdaptors.h to
bind constructors directly as "__init__" functions taking "self" is deprecated
by Pybind. The modern method requires using "py::init", which seems to rely on
the C++ equivalent of the bound class to be available, which is not the case in
PybindAdaptors.h. A deeper inspection shows that the deprecation concerns
old-style pybind11 constructors that had to allocate the object using
placement new with "self" as memory. The PybindAdaptors.h only provides
extension classes and never allocates (the object construction is delegated to
the base class), so it does not use the deprecated functionality. Use the
implementation detail tag class to convince pybind11 that we are using the
modern constructor binding method and suppress the warning.
On top of that, the definition of the function was incorrectly indicated as the
method on the "None" object instead of being the method of its parent class.
This would result in a second problem when Pybind would attempt to print
warnings pointing to the parent class since the "None" does not have a
"__name__" field or its C API equivalent.
Fix this by specifying the correct parent class by looking it up by name in the
parent module.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D117325
Lian Wang [Mon, 17 Jan 2022 08:58:49 +0000 (08:58 +0000)]
[RISCV] Add scheduler for bfp instruction in Zbf extension
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117290
Nikita Popov [Mon, 17 Jan 2022 09:09:44 +0000 (10:09 +0100)]
[GlobalOpt] Drop an incorrect check
This was a last-minute addition to D117249, and of course I ended
up inverting the condition in a way that caused an uninitialized
memory read.
I've dropped it entirely, as I don't think we actually care whether
the size is zero or not here. The previous code wasn't checking
this either.
Nikita Popov [Tue, 11 Jan 2022 13:24:49 +0000 (14:24 +0100)]
[GlobalOpt] Use generic type when converting malloc to global
The malloc to global transform currently determines the type of the
global by looking at bitcasts of the malloc. This is limited (the
transform fails if there are multiple different types) and
incompatible with opaque pointers.
My initial approach was to construct an appropriate struct type
based on usage in loads/stores. What this patch does instead is
to always create an [i8 x AllocSize] global, without trying to
guess types at all.
This does mean that other transforms that require a certain global
type may break. I fixed two of these in D117034 and D117223, which
I believe should be sufficient to avoid regressions. In particular,
the global SRA change should end up splitting the global into
naturally-typed sub-globals, at which point all other optimizations
should work.
Differential Revision: https://reviews.llvm.org/D117092
Sam McCall [Sun, 16 Jan 2022 15:00:25 +0000 (16:00 +0100)]
[docs] Clarify & update JSONCompilationDatabase docs
- prefer `arguments` over `command`, and add example
- clarify that there's no shell-unescaping of `arguments`
Fixes https://github.com/llvm/llvm-project/issues/53143
Differential Revision: https://reviews.llvm.org/D117428
Fangrui Song [Mon, 17 Jan 2022 08:34:42 +0000 (00:34 -0800)]
[ELF] GnuHashTableSection: replace stable_sort with 2-key sort. NFC
strTabOffset stabilizes llvm::sort. My x86-64 executable is 5+KiB smaller.
Nikita Popov [Thu, 13 Jan 2022 11:39:43 +0000 (12:39 +0100)]
[GlobalOpt] Make global SRA offset based
Currently global SRA uses the GEP structure to determine how to
split the global. This patch instead analyses the loads and stores
that are performed on the global, and collects which types are used
at which offset, and then splits the global according to those.
This is both more general, and works fine with opaque pointers.
This is also closer to how ordinary SROA is performed.
Differential Revision: https://reviews.llvm.org/D117223
Haojian Wu [Mon, 17 Jan 2022 08:17:55 +0000 (09:17 +0100)]
[clangd] Better handling `\n` in the synthesized diagnostic message.
The newline-eof fix was rendered as "insert '...'", this patch
special-case it.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D117294
Nikita Popov [Tue, 11 Jan 2022 11:34:11 +0000 (12:34 +0100)]
[DSE] Remove alloc function check in canSkipDef()
canSkipDef() currently skips inaccessiblememonly calls, but not
if they are allocation functions. This check was added in D103009,
but actually seems to be a leftover from a previous implementation
in D101440. canSkipDef() is not used on the storeIsNoop() path,
where the relevant transform ended up being implemented.
Differential Revision: https://reviews.llvm.org/D117005
Carl Ritson [Mon, 17 Jan 2022 08:04:28 +0000 (17:04 +0900)]
CycleInfo: Fix trivial typo. NFC.
Fangrui Song [Mon, 17 Jan 2022 08:05:27 +0000 (00:05 -0800)]
[ELF] RelocationScanner::scanOne: replace rel.r_offset with offset. NFC
Cameron Mulhern [Mon, 17 Jan 2022 07:54:51 +0000 (08:54 +0100)]
[clang-format] Add a BlockIndent option to AlignAfterOpenBracket
This style is similar to AlwaysBreak, but places closing brackets on new lines.
For example, if you have a multiline parameter list, clang-format currently only supports breaking per-parameter, but places the closing bracket on the line of the last parameter.
Function(
param1,
param2,
param3);
A style supported by other code styling tools (e.g. rustfmt) is to allow the closing brackets to be placed on their own line, aiding the user in being able to quickly infer the bounds of the block of code.
Function(
param1,
param2,
param3
);
For prior work on a similar feature, see: https://reviews.llvm.org/D33029.
Note: This currently only supports block indentation for closing parentheses.
Differential Revision: https://reviews.llvm.org/D109557
Fangrui Song [Mon, 17 Jan 2022 08:02:47 +0000 (00:02 -0800)]
[ELF] Relocations: remove some cast<Undefined>. NFC
Fangrui Song [Mon, 17 Jan 2022 07:56:24 +0000 (23:56 -0800)]
[ELF] De-template getAlternativeSpelling. NFC
Kito Cheng [Sun, 9 Jan 2022 14:16:05 +0000 (22:16 +0800)]
[RISCV] Add initial support for getRegUsageForType and getNumberOfRegisters
Those two TTI hooks are used during vectorization for calculating
register pressure, the default implementation isn't consider for LMUL,
and that's also definitly wrong value for register number (all register class
are 8 registers).
So in this patch we tried to:
1. Calculate right register usage for vector type and scalar type.
2. Return right number of register for general purpose register and
vector register.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116890
Qiu Chaofan [Mon, 17 Jan 2022 07:12:33 +0000 (15:12 +0800)]
[PowerPC] Allow -mfloat128 option for VSX targets
Targets with VSX feature but without native float128 instructions can
also use that type with supplementary libcalls. We don't enable it by
default now because Glibc assumes long double and float128 can be
implicitly converted in between, which is not available under default
'ibmlongdouble' semantics in clang.
This commit partly relands cbd93ce.
Fangrui Song [Mon, 17 Jan 2022 06:51:57 +0000 (22:51 -0800)]
[ELF] Remove unneeded SyntheticSection memset(*, 0, *)
After the D33630 fallout was properly fixed by
a4c5db30be4e216834b44e31b47304ea1b92635f.
Tested by D37462/D44986 tests, the new --no-rosegment test in build-id.s, and a few --rosegment/--no-rosegment programs.
Fangrui Song [Mon, 17 Jan 2022 06:37:31 +0000 (22:37 -0800)]
[ELF] Remove redundant fillTrap and memset(*, 0, *). NFC
The new tests in build-id.s would catch problems if we made a mistake here.
Fangrui Song [Mon, 17 Jan 2022 06:36:22 +0000 (22:36 -0800)]
[ELF][test] Add --build-id tests for -z separate-loadable-segments and --no-rosegment
Fangrui Song [Mon, 17 Jan 2022 05:44:19 +0000 (21:44 -0800)]
[ELF] RelocationSection<ELFT>::writeTo: use unstable partition
esmeyi [Mon, 17 Jan 2022 05:28:25 +0000 (00:28 -0500)]
Reland https://reviews.llvm.org/D113825 after fixing the test expectations.
Fangrui Song [Mon, 17 Jan 2022 05:19:01 +0000 (21:19 -0800)]
[ELF] Change some DenseMap<StringRef, *> to DenseMap<CachedHashStringRef, *>. NFC
Fangrui Song [Mon, 17 Jan 2022 05:02:05 +0000 (21:02 -0800)]
[ELF] StringTableSection: Use DenseMap<CachedHashStringRef> to avoid redundant hash computation
5~6% speedup when linking clang and chrome.
Fangrui Song [Mon, 17 Jan 2022 03:44:48 +0000 (19:44 -0800)]
[Driver][FreeBSD] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D117388
John Ericson [Sun, 16 Jan 2022 06:19:45 +0000 (06:19 +0000)]
[compiler-rt][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.
Differential Revision: https://reviews.llvm.org/D117420
eopXD [Sat, 15 Jan 2022 20:12:22 +0000 (12:12 -0800)]
[RISCV] Add patterns for vector widening integer multiply-add instructions
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117404
Dominik Grewe [Sun, 16 Jan 2022 21:16:57 +0000 (21:16 +0000)]
Preserve argument locations when cloning a region.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D117403
Nikita Popov [Sun, 16 Jan 2022 20:32:54 +0000 (21:32 +0100)]
[AttrBuilder] Remove unused removeAttributes() overload
The idiomatic way would be to call remove() with an AttributeMask
constructed from an AttributeSet.
Nikita Popov [Sun, 16 Jan 2022 19:58:38 +0000 (20:58 +0100)]
[AttrBuilder] Remove unused hasAttributes() overload
This is unused, and doesn't make a lot of sense as an API. The
usual pattern would be to combine the AttrBuilder(AttributeSet)
constructor with the overlaps() method.
Bjorn Pettersson [Tue, 11 Jan 2022 21:59:18 +0000 (22:59 +0100)]
[DAGCombine] Refactor DAGCombiner::ReduceLoadWidth. NFCI
Update code comments in DAGCombiner::ReduceLoadWidth and refactor
the handling of SRL a bit. The refactoring is done with the intent
of adding support for folding away SRA by using SEXTLOAD in a
follow-up patch.
The function is also renamed as DAGCombiner::reduceLoadWidth.
Differential Revision: https://reviews.llvm.org/D117104
Stanislav Gatev [Fri, 14 Jan 2022 18:27:39 +0000 (18:27 +0000)]
[clang][dataflow] Add transfer functions for bind temporary and static cast
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Differential Revision: https://reviews.llvm.org/D117339
Arjun P [Wed, 12 Jan 2022 16:36:47 +0000 (22:06 +0530)]
[MLIR] Simplex::getRationalSample: return an optional, empty if Simplex is empty
LLVM GN Syncbot [Sun, 16 Jan 2022 16:03:49 +0000 (16:03 +0000)]
[gn build] Port
e6b153947dfa
Alexandre Ganea [Sun, 16 Jan 2022 16:03:06 +0000 (11:03 -0500)]
Revert [LLD] Remove global state in lldCommon
It seems to be causing issues on https://lab.llvm.org/buildbot/#/builders/123/builds/8383
Alexandre Ganea [Sun, 16 Jan 2022 14:17:29 +0000 (09:17 -0500)]
[LLD] Supplement with more comments. Clarify the intention in
f860fe362282ed69b9d4503a20e5d20b9a041189.
hyeongyu kim [Sun, 16 Jan 2022 14:02:55 +0000 (23:02 +0900)]
Resolve lit failures in clang-aarch64*
LLVM GN Syncbot [Sun, 16 Jan 2022 13:58:27 +0000 (13:58 +0000)]
[gn build] Port
f860fe362282
Alexandre Ganea [Sun, 16 Jan 2022 02:47:54 +0000 (21:47 -0500)]
[LLD] Remove global state in lldCommon
Move all variables at file-scope or function-static-scope into a hosting structure (lld::CommonLinkerContext) that lives at lldMain()-scope. Drivers will inherit from this structure and add their own global state, in the same way as for the existing COFFLinkerContext.
See discussion in https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html
Differential Revision: https://reviews.llvm.org/D108850
Florian Hahn [Sun, 16 Jan 2022 13:14:16 +0000 (13:14 +0000)]
[LV] Restore metadata to disable runtime unrolling for epilogue loop.
After
d4a8fc3a87a1 LV stopped adding metadata to disable runtime
unrolling to the vectorized epilogue loop. This was missed because
278aa65cc495 removed the relevant test coverage.
This patch fixes that by adding the relevant metadata after
vector loop generation.
hyeongyu kim [Sun, 16 Jan 2022 11:42:35 +0000 (20:42 +0900)]
[msan] reflect the changed flag to the tests.
1b1c8d changed `enable-noundef-analysis` flag to
`disable-noundef-analysis`. noundef_analysis.cpp was using old
`enable-noundef-analysis` flag and this patch fixes it.
owenca [Sun, 16 Jan 2022 03:41:06 +0000 (19:41 -0800)]
[clang-format] Add return code to git-clang-format
https://github.com/llvm/llvm-project/issues/53220
Differential Revision: https://reviews.llvm.org/D117414
Florian Hahn [Sun, 16 Jan 2022 10:28:55 +0000 (10:28 +0000)]
[LV] Move AddRuntimeUnrollDisableMetaData so it can be used earlier (NFC)
Move up the definition of AddRuntimeUnrollDisableMetaData, so it can be
re-used earlier in the file in a follow-up patch.
hyeongyu kim [Sun, 16 Jan 2022 09:53:11 +0000 (18:53 +0900)]
[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default
Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions.
I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default.
Test updates are made as a separate patch: D108453
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D105169
Fangrui Song [Sun, 16 Jan 2022 08:28:47 +0000 (00:28 -0800)]
[ELF] Remove forEachRelSec. NFC
Fangrui Song [Sun, 16 Jan 2022 07:58:15 +0000 (23:58 -0800)]
[ELF] Remove !isLazy() condition from computeBinding
Seems applicable since we demote lazy symbols to Undefined (D111365).
Fangrui Song [Sun, 16 Jan 2022 07:49:47 +0000 (23:49 -0800)]
[ELF] Remove config->relocatable condition from Symbol::computeBinding
Fangrui Song [Sun, 16 Jan 2022 07:40:43 +0000 (23:40 -0800)]
[ELF] Speed up Symbol::computeBinding. NFC
When computeBinding is inlined into includeInDynsym and computeIsPreemptible,
the optimizer can remove the config->gnuUnique load.
Fangrui Song [Sun, 16 Jan 2022 07:32:48 +0000 (23:32 -0800)]
[ELF] Slightly speed up Symbol::includeInDynsym. NFC
Fangrui Song [Sun, 16 Jan 2022 07:27:45 +0000 (23:27 -0800)]
[ELF] Simplify Symbol::includeInDynsym
Fangrui Song [Sun, 16 Jan 2022 06:33:51 +0000 (22:33 -0800)]
[ELF] Optimize -z combreloc
Sorting dynamic relocations is a bottleneck. Simplifying the comparator improves
performance. Linking clang is 4~5% faster with --threads=8.
This change may shuffle R_MIPS_REL32 for Mips and is a NFC for non-Mips.
Luo, Yuanke [Wed, 12 Jan 2022 06:25:42 +0000 (14:25 +0800)]
[X86] Pre-checkin test case for combining const operand to VNNI
instruction.
John Ericson [Sun, 16 Jan 2022 05:48:30 +0000 (05:48 +0000)]
Revert "[cmake] Use `GNUInstallDirs` to support custom installation dirs."
https://lab.llvm.org/buildbot/#/builders/46/builds/21146 Still have
this odd error, not sure how to reproduce, so I will just try breaking
up my patch.
This reverts commit
4a678f8072004eff9214c1a4e1836a14abb69535.
John Ericson [Sat, 15 Jan 2022 07:37:48 +0000 (07:37 +0000)]
[cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!
It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up
- Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.
- Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.
I figured it was time to make a new revision.
I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.
---
As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.
These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.
Reviewed By: #libunwind, #libc, #libc_abi, compnerd
Differential Revision: https://reviews.llvm.org/D99484
Lang Hames [Sun, 16 Jan 2022 03:03:15 +0000 (14:03 +1100)]
[ORC-RT] Remove some stale comments.
We switched to SPS serialization for these functions in
089acf25223d2.
Lang Hames [Sun, 16 Jan 2022 01:56:06 +0000 (12:56 +1100)]
[ORC-RT] Update WrapperFunctionCall for
089acf25223.
089acf25223 updated WrapperFunctionCall to carry arbitrary argument payloads
(rather than plain address ranges). This commit implements the corresponding
update for the ORC runtime.
Fangrui Song [Sun, 16 Jan 2022 01:59:05 +0000 (17:59 -0800)]
[ELF] Simplify elf::link exit. NFC
Fangrui Song [Sun, 16 Jan 2022 01:13:09 +0000 (17:13 -0800)]
[SelectionDAG] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D117235
Craig Topper [Sat, 15 Jan 2022 21:50:38 +0000 (13:50 -0800)]
[RISCV] Add RISCVISD::BFPW to ComputeNumSignBitsForTargetNode.
Dave Lee [Fri, 7 Jan 2022 03:38:31 +0000 (19:38 -0800)]
[lldb] Set result error state in 'frame variable'
Ensure that errors in `frame variable` are reflected in result object.
The statistics for `frame variable` show invocations as being successful, even
when executing one of the error paths.
This change replaces `result.GetErrorStream()` with `result.AppendError()`,
which also sets the status to `eReturnStatusFailed`.
Differential Revision: https://reviews.llvm.org/D116788
Recommitting after D116901 and D116863.
(cherry picked from commit
2c7d10c41278181e3e45c68f28b501cd95193a8a)
Nikita Popov [Sat, 15 Jan 2022 21:14:16 +0000 (22:14 +0100)]
[AttrBuilder] Remove ctor accepting AttributeList and Index
Use the AttributeSet constructor instead. There's no good reason
why AttrBuilder itself should exact the AttributeSet from the
AttributeList. Moving this out of the AttrBuilder generally results
in cleaner code.
Lucas Prates [Thu, 23 Sep 2021 12:34:30 +0000 (13:34 +0100)]
[AArch64] clang support for Armv8.8/9.3 MOPS
This introduces clang command line support for the new Armv8.8-A and
Armv9.3-A instructions for standardising memcpy, memset and memmove
operations, which was previously introduced into LLVM in
https://reviews.llvm.org/D116157.
Patch by Lucas Prates, Tomas Matheson and Son Tuan Vu.
Differential Revision: https://reviews.llvm.org/D117271
Jonas Devlieghere [Sat, 15 Jan 2022 19:41:37 +0000 (11:41 -0800)]
[lldb] Use PlatformMacOSX for Mac Catalyst
Use PlatformMacOSX for Mac Catalyst apps on both Intel (x86) and Apple
Silicon (arm64).
Mehdi Amini [Fri, 14 Jan 2022 07:47:47 +0000 (07:47 +0000)]
Disable the MLIR ExecutionEngine library when the native target is not configured
The execution engine would not be functional anyway, we're already
disabling the tests, this also disable the rest of the code.
Anecdotally this reduces the number of static library built when the
builtin target is disabled goes from 236 to 218.
Here is the complete list of LLVM targets built when running
`ninja check-mlir`:
libLLVMAggressiveInstCombine.a
libLLVMAnalysis.a
libLLVMAsmParser.a
libLLVMBinaryFormat.a
libLLVMBitReader.a
libLLVMBitstreamReader.a
libLLVMBitWriter.a
libLLVMCore.a
libLLVMDebugInfoCodeView.a
libLLVMDebugInfoDWARF.a
libLLVMDemangle.a
libLLVMFileCheck.a
libLLVMFrontendOpenMP.a
libLLVMInstCombine.a
libLLVMIRReader.a
libLLVMMC.a
libLLVMMCParser.a
libLLVMObject.a
libLLVMProfileData.a
libLLVMRemarks.a
libLLVMScalarOpts.a
libLLVMSupport.a
libLLVMTableGen.a
libLLVMTableGenGlobalISel.a
libLLVMTextAPI.a
libLLVMTransformUtils.a
Differential Revision: https://reviews.llvm.org/D117287
Nikolas Klauser [Sat, 15 Jan 2022 16:52:24 +0000 (17:52 +0100)]
[libc++] Add _LIBCPP_HIDE_FROM_ABI to in_in_result
Add `_LIBCPP_HIDE_FROM_ABI` to `in_in_result` conversion operators
Reviewed By: Quuxplusone, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D117399
Fangrui Song [Sat, 15 Jan 2022 18:46:25 +0000 (10:46 -0800)]
[ELF] Make some diagnostics follow the convention
paperchalice [Sat, 15 Jan 2022 18:40:48 +0000 (10:40 -0800)]
[CMake][LLDB] Resolve install conflict when `LLDB_BUILD_FRAMEWORK=ON`
Try to fix https://github.com/llvm/llvm-project/issues/108
Install python scripts into canonical resource path
Differential revision: https://reviews.llvm.org/D116853
Jonas Devlieghere [Sat, 15 Jan 2022 18:23:06 +0000 (10:23 -0800)]
[lldb] Correctly display the number of types found
Correctly display the number of types found for `target modules lookup
--type` and add a test.
Fixes #53219
Dave Lee [Sat, 15 Jan 2022 18:20:02 +0000 (10:20 -0800)]
[lldb] Remove anon struct from frame-var-anon-unions test
This test for anonymous unions seems off. It tests the following:
```
union {
// fields
};
struct {
// fields
} var{...};
```
Both are anonymous types, but the first does not declare a variable and the
second one does. The test then checks that `frame var` can directly access the
fields of the anonymous union, but can't directly access the fields of the
anonymous struct variable.
The second test, to directly access the members of the struct variable, seems
pointless as similar code would not compile. A demonstration:
```
struct {
int a;
int z;
} a_z{23, 45};
printf("%d\n", a_z.a); // fine
printf("%d\n", a); // this does not compile
```
Since we can't directly access the fields in code, I'm not sure there's a
reason to test that lldb also can't directly access them (other than perhaps as
a regression test).
Differential Revision: https://reviews.llvm.org/D116863
Jonas Devlieghere [Sat, 15 Jan 2022 05:46:26 +0000 (21:46 -0800)]
[lldb] Remove PlatformDarwin::GetCompatibleArch helper
This also removes the corresponding unit tests. I wrote them to sanity
check my original refactoring and checked them in because why not. The
current implementation, without the added complexity of indices, is
simple enough that we can do without it.
Peter Klausler [Thu, 30 Dec 2021 00:22:37 +0000 (16:22 -0800)]
[flang] Fold SCALE()
Fold references to the intrinsic function SCALE().
(Also work around some MSVC headaches somehow exposed by
this patch: disable a bogus MSVC warning that began to appear
in unrelated source files, and avoid the otherwise-necessary
use of the "template" keyword in a call to a template member
function of a class template.)
Differential Revision: https://reviews.llvm.org/D117150
Arthur O'Dwyer [Sat, 15 Jan 2022 17:20:33 +0000 (12:20 -0500)]
[libc++] Normalize some whitespace in preparation for D116570. NFC.
Nikita Popov [Sat, 15 Jan 2022 17:00:20 +0000 (18:00 +0100)]
[AttrBuilder] Remove non-const td_attrs()
Mutations should happen through appropriate APIs that uphold the
sorting invariant. Exposing a mutable iterator is not necessary.
Alexandre Ganea [Sat, 15 Jan 2022 17:00:58 +0000 (12:00 -0500)]
Silence warning with MSVC.
Fixes:
[2587/4073] Building CXX object projects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommon.x86_64.dir\sanitizer_stoptheworld_win.cpp.obj
D:\git\llvm-project\compiler-rt\lib\sanitizer_common\sanitizer_stoptheworld_win.cpp(125,33): warning: comparison of integers of different signs: 'DWORD' (aka 'unsigned long') and 'int' [-Wsign-compare]
if (SuspendThread(thread) == -1) {
~~~~~~~~~~~~~~~~~~~~~ ^ ~~
1 warning generated.
Alexandre Ganea [Sat, 15 Jan 2022 16:59:46 +0000 (11:59 -0500)]
[compiler-rt][cmake] Fix clang-cl warnings introduced in
ae4c643bcdf2
See report in https://reviews.llvm.org/D116872#3245667
Nikita Popov [Sat, 15 Jan 2022 16:55:12 +0000 (17:55 +0100)]
[AttrBuilder] Remove empty() / td_empty() methods
The empty() method is a footgun: It only checks whether there are
non-string attributes, which is not at all obvious from its name,
and of dubious usefulness. td_empty() is entirely unused.
Drop these methods in favor of hasAttributes(), which checks
whether there are any attributes, regardless of whether these are
string or enum attributes.
Florian Hahn [Sat, 15 Jan 2022 15:21:16 +0000 (15:21 +0000)]
[LoopUtils] Use InstSimplifyFolder in addRuntimeChecks.
Use the InstSimplifyFolder introduced earlier to perform initial
simplification during runtime check construction.
Simon Pilgrim [Sat, 15 Jan 2022 14:55:21 +0000 (14:55 +0000)]
[X86] LowerFunnelShift - enable vXi32 handling
Mark de Wever [Mon, 8 Nov 2021 20:16:50 +0000 (21:16 +0100)]
[libc++] Adds tests for LWG-3373.
The code in libc++ already satisfy the requirements of LWG-3373. Since
the issue was written to specifically allow the types to be used in
structured bindings, tests have been added to validate the new
requirement.
Implements
LWG-3373 {to,from}_chars_result and format_to_n_result need the "we really mean what we say" wording
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D117337
Amir Ayupov [Fri, 14 Jan 2022 22:18:43 +0000 (14:18 -0800)]
[BOLT][CMAKE] Accept BOLT_CLANG_EXE and BOLT_LLD_EXE
Add CMake options to supply clang and lld binaries for use in check-bolt
instead of requiring the build of clang and lld projects.
Suggested by Mehdi Amini in https://lists.llvm.org/pipermail/llvm-dev/2021-December/154426.html
Test Plan:
```
cmake -G Ninja ~/local/llvm-project/llvm \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS="bolt" \
-DBOLT_CLANG_EXE=~/local/bin/clang \
-DBOLT_LLD_EXE=~/local/bin/lld
ninja check-bolt
...
llvm-lit: /home/aaupov/local/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using clang: /home/aaupov/local/bin/clang
llvm-lit: /home/aaupov/local/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using ld.lld: /home/aaupov/local/bin/ld.lld
llvm-lit: /home/aaupov/local/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using lld-link: /home/aaupov/local/bin/lld-link
llvm-lit: /home/aaupov/local/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using ld64.lld: /home/aaupov/local/bin/ld64.lld
llvm-lit: /home/aaupov/local/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using wasm-ld: /home/aaupov/local/bin/wasm-ld
...
```
Tested all configurations:
- LLVM_ENABLE_PROJECTS="bolt;clang;lld" + no BOLT_*_EXE
- LLVM_ENABLE_PROJECTS="bolt;clang" + BOLT_LLD_EXE
- LLVM_ENABLE_PROJECTS="bolt;lld" + BOLT_CLANG_EXE
- LLVM_ENABLE_PROJECTS="bolt" + BOLT_CLANG_EXE + BOLT_LLD_EXE
- LLVM_ENABLE_PROJECTS="bolt;clang;lld" + BOLT_CLANG_EXE + BOLT_LLD_EXE
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D117061
Fraser Cormack [Thu, 13 Jan 2022 17:23:07 +0000 (17:23 +0000)]
[SelectionDAG][VP] Add splitting/widening for VP_LOAD and VP_STORE
Original patch by @hussainjk.
This patch was split off from D109377 to keep vector legalization
(widening/splitting) separate from vector element legalization
(promoting).
While the original patch added a third overload of
SelectionDAG::getVPStore, this patch takes the liberty of collapsing
those all down to 1, as three overloads seems excessive for a
little-used node.
The original patch also used ModifyToType in places, but that method
still crashes on scalable vector types. Seeing as the other VP
legalization methods only work when all operands need identical
widening, this patch follows in that vein.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117235
Florian Hahn [Sat, 15 Jan 2022 11:26:44 +0000 (11:26 +0000)]
[IRBuilder] Migrate select-folding to value-based FoldSelect.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D117228
Fangrui Song [Sat, 15 Jan 2022 09:35:48 +0000 (01:35 -0800)]
[CMake] Fix compiler-rt -Wl,-z,gnu-version-script-compat warnings on non-Solaris
Fangrui Song [Sat, 15 Jan 2022 08:42:42 +0000 (00:42 -0800)]
[MC] Remove MCContext::reportFatalError
As the 10-year-old FIXME comment says, this API is not recommended.
Chenbing.Zheng [Sat, 15 Jan 2022 08:35:06 +0000 (08:35 +0000)]
[RISCV][Clang] Add attrs to crc32_d/crc32c_d
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117380