jacquesguan [Wed, 30 Mar 2022 11:14:00 +0000 (19:14 +0800)]
[mlir][Vector] Add constant folder for insertelement.
This revision adds constant folder for vector.insertelement.
Differential Revision: https://reviews.llvm.org/D122721
Craig Topper [Sat, 2 Apr 2022 01:28:08 +0000 (18:28 -0700)]
[RISCV] Add lowering for vp.fptoui and vp.uitofp.
This is a straightforward extension of D122512 to unsigned integers.
Jonas Devlieghere [Sat, 2 Apr 2022 00:41:36 +0000 (17:41 -0700)]
[lldb] Remove remaining calls to DataBufferLLVM::GetChars
Update the Linux and NetBSD Host libraries for
2165c36be445 which
removed DataBufferLLVM::GetChars. These files are compiled conditionally
based on the host platform.
Jonas Devlieghere [Thu, 31 Mar 2022 22:16:29 +0000 (15:16 -0700)]
[lldb] Return a DataBuffer from FileSystem::CreateDataBuffer (NFC)
The concrete class (DataBufferLLVM) is an implementation detail.
Owen Pan [Wed, 30 Mar 2022 18:50:52 +0000 (11:50 -0700)]
[clang-format] Fix a crash in qualifier alignment
Related to #54513.
Maksim Panchenko [Fri, 1 Apr 2022 23:43:21 +0000 (16:43 -0700)]
[BOLT][test] Fix AArch64 cross-platform tests
Use target-specific flags for building AArch64 non-runnable tests.
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D122520
Michael Gottesman [Fri, 1 Apr 2022 22:57:52 +0000 (15:57 -0700)]
[debug-info] As an NFC commit, refactor EmitFuncArgumentDbgValue so that it can be extended to support llvm.dbg.addr.
The reason why I am making this change is that before this commit,
EmitFuncArgumentDbgValue relied on a boolean flag IsDbgDeclare both to signal
that a DBG_VALUE should be made to be indirect /and/ that the original intrinsic
was a dbg.declare. This is no longer always true if we add support for handling
dbg.addr since we will have an indirect DBG_VALUE that is a different intrinsic
from dbg.declare.
With that in mind, in this NFC patch, we prepare for future fixes by introducing
a 3 case-enum argument to EmitFuncArgumentDbgValue that allows the caller to
explicitly specify how the argument's DBG_VALUE should be emitted. This then
allows us to turn the indirect checks into a != FuncArgumentDbgValueKind::Value
and prepare us for a future where we add support here for llvm.dbg.addr
directly.
rdar://
83957028
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D122945
Mitch Phillips [Fri, 1 Apr 2022 23:26:55 +0000 (16:26 -0700)]
[NFCI] clang-format SanitizerArgs.cpp
Jacques Pienaar [Fri, 1 Apr 2022 23:33:35 +0000 (16:33 -0700)]
[mlir] Switch debugString helper to << operator
Supports more cases.
Nico Weber [Fri, 1 Apr 2022 14:13:12 +0000 (10:13 -0400)]
[lld/mac] Tweak a few comments
Addresses review feedback I had missed on https://reviews.llvm.org/D122624
No behavior change.
Differential Revision: https://reviews.llvm.org/D122904
Adrian Prantl [Fri, 1 Apr 2022 22:55:07 +0000 (15:55 -0700)]
clang-format HostInfoBase.cpp
Arthur Eubanks [Fri, 1 Apr 2022 22:32:22 +0000 (15:32 -0700)]
[test] Mark uuid.s as unsupported on Windows
For systems using gnuwin32, awk does not exist.
Michael Jones [Wed, 30 Mar 2022 22:54:30 +0000 (15:54 -0700)]
[libc][NFC] add outline of printf
This patch adds the headers for printf. It contains minimal actual code,
and is more intended to be used for design review. The code is not built
yet, and may have minor errors.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D122773
LLVM GN Syncbot [Fri, 1 Apr 2022 21:24:52 +0000 (21:24 +0000)]
[gn build] Port
f547fc89c073
Richard [Fri, 1 Apr 2022 19:53:00 +0000 (13:53 -0600)]
[clang-tidy] Add modernize-macro-to-enum check
[buildbot issues fixed]
This check performs basic analysis of macros and replaces them
with an anonymous unscoped enum. Using an unscoped anonymous enum
ensures that everywhere the macro token was used previously, the
enumerator name may be safely used.
Potential macros for replacement must meet the following constraints:
- Macros must expand only to integral literal tokens. The unary
operators plus, minus and tilde are recognized to allow for positive,
negative and bitwise negated integers.
- Macros must be defined on sequential source file lines, or with
only comment lines in between macro definitions.
- Macros must all be defined in the same source file.
- Macros must not be defined within a conditional compilation block.
- Macros must not be defined adjacent to other preprocessor directives.
- Macros must not be used in preprocessor conditions
Each cluster of macros meeting the above constraints is presumed to
be a set of values suitable for replacement by an anonymous enum.
From there, a developer can give the anonymous enum a name and
continue refactoring to a scoped enum if desired. Comments on the
same line as a macro definition or between subsequent macro definitions
are preserved in the output. No formatting is assumed in the provided
replacements.
The check cppcoreguidelines-macro-to-enum is an alias for this check.
Fixes #27408
Differential Revision: https://reviews.llvm.org/D117522
Adrian Prantl [Fri, 1 Apr 2022 21:15:58 +0000 (14:15 -0700)]
Simplify ArchSpec::IsFullySpecifiedTriple() (NFC)
I found this function somewhat hard to read and removed a few entirely
redundant checks and converted it to early exits.
Differential Revision: https://reviews.llvm.org/D122912
Jean Perier [Fri, 1 Apr 2022 20:31:23 +0000 (22:31 +0200)]
[flang] add evaluate::IsAllocatableDesignator helper
Previously, some semantic checks that are checking if an entity is an
allocatable were relying on the expression being a designator whose
last symbol has the allocatable attribute.
This is wrong since this was considering substrings and array sections of
allocatables as being allocatable. This is wrong (see NOTE 2 in
Fortran 2018 section 9.5.3.1).
Add evaluate::IsAllocatableDesignator to correctly test this.
Also add some semantic tests for ALLOCATED to test the newly added helper.
Note that ifort and nag are rejecting coindexed-named-object in
ALLOCATED (`allocated(coarray_scalar_alloc[2])`).
I think it is wrong given allocated argument is intent(in) as per
16.2.1 point 3.
So 15.5.2.6 point 4 regarding allocatable dummy is not violated (If the actual
argument is a coindexed object, the dummy argument shall have the INTENT (IN)
attribute.) and I think this is valid. gfortran accepts it.
The need for this helper was exposed in https://reviews.llvm.org/D122779.
Differential Revision: https://reviews.llvm.org/D122899
Co-authored-by: Peixin-Qiao <qiaopeixin@huawei.com>
Craig Topper [Fri, 1 Apr 2022 20:14:10 +0000 (13:14 -0700)]
[RISCV][AMDGPU][TargetLowering] Special case overflow expansion for (uaddo X, 1).
If we expand (uaddo X, 1) we previously expanded the overflow calculation
as (X + 1) <u X. This potentially increases the live range of X and
can prevent X+1 from reusing the register that previously held X.
Since we're adding 1, overflow only occurs if X was UINT_MAX in which
case (X+1) would be 0. So this patch adds a special case to expand
the overflow calculation to (X+1) == 0.
This seems to help with uaddo intrinsics that get introduced by
CodeGenPrepare after LSR. Alternatively, we could block the uaddo
transform in CodeGenPrepare for this case.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D122933
Erich Keane [Mon, 28 Mar 2022 15:57:50 +0000 (08:57 -0700)]
Fix behavior of ifuncs with 'used' extern "C" static functions
We expect that `extern "C"` static functions to be usable in things like
inline assembly, as well as ifuncs:
See the bug report here: https://github.com/llvm/llvm-project/issues/54549
However, we were diagnosing this as 'not defined', because the
ifunc's attempt to look up its resolver would generate a declared IR
function.
Additionally, as background, the way we allow these static extern "C"
functions to work in inline assembly is by making an alias with the C
mangling in MOST situations to the version we emit with
internal-linkage/mangling.
The problem here was multi-fold: First- We generated the alias after the
ifunc was checked, so the function by that name didn't exist yet.
Second, the ifunc's generation caused a symbol to exist under the name
of the alias already (the declared function above), which suppressed the
alias generation.
This patch fixes all of this by moving the checking of ifuncs/CFE aliases
until AFTER we have generated the extern-C alias. Then, it does a
'fixup' around the GlobalIFunc to make sure we correct the reference.
Differential Revision: https://reviews.llvm.org/D122608
Craig Topper [Fri, 1 Apr 2022 19:23:42 +0000 (12:23 -0700)]
[RISCV] Add tests for uaddo with a constant 1. NFC
The overflow calculation can be optimized to check if the add
result is 0.
Erich Keane [Fri, 1 Apr 2022 19:22:44 +0000 (12:22 -0700)]
FIX the wildcards to pass an FP diff in mangle-nttp-anon-union.cpp
Erich Keane [Fri, 1 Apr 2022 19:02:45 +0000 (12:02 -0700)]
Add some wildcards to pass FP difference on one of the buildbots
Lei Zhang [Fri, 1 Apr 2022 18:43:09 +0000 (14:43 -0400)]
[mlir][vector] Fold transpose(broadcast(<scalar>))
For such cases, the transpose op can be elided.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D122903
Erich Keane [Thu, 31 Mar 2022 14:27:11 +0000 (07:27 -0700)]
[GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs
As reported in https://github.com/llvm/llvm-project/issues/54588
and discussed in https://github.com/itanium-cxx-abi/cxx-abi/issues/139
We are supposed to do a DFS, pre-order, decl-order search for a name for
the union in this case. Prevoiusly we crashed because the IdentiferInfo
pointer was nullptr, so this makes sure we have a name in the cases
described by the ABI.
I added an llvm-unreachable to cover an unexpected case at the end of
the new function with information/reference to the ABI in case we come
up with some way to get back to here.
Differential Revision: https://reviews.llvm.org/D122820
zhijian [Fri, 1 Apr 2022 18:10:22 +0000 (14:10 -0400)]
Addressed post-commit comment https://reviews.llvm.org/D122746#inline-1175831
wren romano [Wed, 30 Mar 2022 19:32:33 +0000 (12:32 -0700)]
[mlir][sparse] Moving `delete coo` into codegen instead of runtime library
Prior to this change there were a number of places where the allocation and deallocation of SparseTensorCOO objects were not cleanly paired, leading to inconsistencies regarding whether each function released its tensor/coo arguments or not, as well as making it easy to run afoul of memory leaks, use-after-free, or double-free errors. This change cleans up the codegen vs runtime boundary to resolve those issues. Now, the only time the runtime library frees an object is either (a) because it's a function explicitly designed to do so, or (b) because the allocated object is entirely local to the function and would be a memory leak if not released. Thus, now the codegen takes complete responsibility for releasing any objects it caused to be allocated.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122435
Sanjay Patel [Fri, 1 Apr 2022 16:22:10 +0000 (12:22 -0400)]
[AArch64] add tests for funnel+or == 0; NFC
These are copied from x86 (
1074bdfb52b2e1753e51472 ) to
provide more coverage for a potential generic combine.
Sanjay Patel [Fri, 1 Apr 2022 14:32:35 +0000 (10:32 -0400)]
[InstCombine] add tests for icmp with sub with multiple uses; NFC
Issue #54558
Zequan Wu [Fri, 1 Apr 2022 17:38:57 +0000 (10:38 -0700)]
[LLDB] Add require x86 for NativePdb Test.
Yitzhak Mandelbaum [Mon, 28 Mar 2022 15:38:17 +0000 (15:38 +0000)]
[clang][dataflow] Add support for correlation of boolean (tracked) values
This patch extends the join logic for environments to explicitly handle
boolean values. It creates the disjunction of both source values, guarded by the
respective flow conditions from each input environment. This change allows the
framework to reason about boolean correlations across multiple branches (and
subsequent joins).
Differential Revision: https://reviews.llvm.org/D122838
Yitzhak Mandelbaum [Fri, 25 Mar 2022 20:01:18 +0000 (20:01 +0000)]
[clang][dataflow] Add support for (built-in) (in)equality operators
Adds logical interpretation of built-in equality operators, `==` and `!=`.s
Differential Revision: https://reviews.llvm.org/D122830
Zequan Wu [Fri, 18 Mar 2022 22:31:19 +0000 (15:31 -0700)]
[LLDB][NativePDB] Create inline function decls
This creates inline functions decls in the TUs where the funcitons are inlined and local variable decls inside those functions.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D121967
Simon Pilgrim [Fri, 1 Apr 2022 16:47:24 +0000 (17:47 +0100)]
[DAG] Add llvm::isMinSignedConstant helper. NFC
Pulled out of D122754
Petr Hosek [Fri, 1 Apr 2022 16:29:54 +0000 (09:29 -0700)]
Revert "[runtimes] Create Tests.cmake if it does not exist"
This reverts commit
d6623d72461b5a1ed3bd3ac966d14329e5b0f851 since
it broke the build on Mac.
Simon Pilgrim [Fri, 1 Apr 2022 16:22:33 +0000 (17:22 +0100)]
[X86] matchAddressRecursively - add XOR(X, MIN_SIGNED_VALUE) handling
Allows us to fold XOR(X, MIN_SIGNED_VALUE) == ADD(X, MIN_SIGNED_VALUE) into LEA patterns
As mentioned on PR52267.
Differential Revision: https://reviews.llvm.org/D122815
Alisamar Husain [Mon, 28 Mar 2022 18:20:28 +0000 (23:50 +0530)]
[intelpt] Refactor timestamps out of `IntelPTInstruction`
Storing timestamps (TSCs) in a more efficient map at the decoded thread level to speed up TSC lookup, as well as reduce the amount of memory used by each decoded instruction. Also introduced TSC range which keeps the current timestamp valid for all subsequent instructions until the next timestamp is emitted.
Differential Revision: https://reviews.llvm.org/D122603
Lei Zhang [Fri, 1 Apr 2022 16:07:25 +0000 (12:07 -0400)]
[mlir][vector] Handle scalars in extract_strided_slice(broadcast)
For such cases we cannot generate extract_strided_slice ops.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D122902
Lei Zhang [Fri, 1 Apr 2022 16:02:43 +0000 (12:02 -0400)]
[mlir][spirv] Add pattern to lower math.copysign
This follows the logic:
https://git.musl-libc.org/cgit/musl/tree/src/math/copysignf.c
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D122910
Simon Pilgrim [Fri, 1 Apr 2022 15:58:45 +0000 (16:58 +0100)]
[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) (RECOMMITTED)
As noticed on PR39174, if we're extracting a single non-constant bit index, then try to use BT+SETCC instead to avoid messing around moving the shift amount to the ECX register, using slow x86 shift ops etc.
Recommitted with a fix to ensure we zext/trunc the SETCC result to the original type.
Differential Revision: https://reviews.llvm.org/D122891
Dmitry Vyukov [Fri, 1 Apr 2022 14:30:55 +0000 (16:30 +0200)]
sanitizer_common: add Mutex::TryLock
Will be used in future changes.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D122905
Dmitry Vyukov [Fri, 1 Apr 2022 14:35:33 +0000 (16:35 +0200)]
sanitizer_common: expose max_address from LoadedModule
Currently LoadedModule provides max_executable_address.
Replace it with just max_address.
It's only used for printing for human inspection and since
modules are non-overlapping, max_address is as good as max_executable_address
for matching addresses/PCs against modules (I assume it's used for that).
On the hand, max_address is more general and can used to match e.g. data addresses.
I want to use it for that purpose in future changes.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D122906
zhijian [Fri, 1 Apr 2022 15:55:11 +0000 (11:55 -0400)]
[AIX][XCOFF] print unsupported message for llvm-ar big archive write operation
Summary:
when run "llvm-ar cr" on AIX OS , it created a gnu archive, it is not desirable in aix OS.
instead of creating a gnu archive, the patch will print a unsupport message for llvm-ar big archive write operation in AIX OS.
after implement the big archive operation, I will revert the XFAIL: AIX " and "--format=gnu" test cases in the patch.
Reviewer : James Henderson, Jinsong Ji
Differential Revision: https://reviews.llvm.org/D122746
Florian Hahn [Fri, 1 Apr 2022 15:53:39 +0000 (16:53 +0100)]
Recommit "[LV] Remove unneeded createHeaderBranch.(NFCI)"
This reverts commit
14e3650f01d158f7e4117c353927a07ceebdd504.
The issue causing the revert were fixed independently in
a08c90a4023f and
14e5f9785c9c.
Simon Pilgrim [Fri, 1 Apr 2022 15:48:24 +0000 (16:48 +0100)]
Revert rGa5f637bcbb7d1e08ce637f113fc117c3f4b2b110 "[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y))"
Investigating a sanitizer-windows buildbot breakage
Simon Pilgrim [Fri, 1 Apr 2022 15:40:10 +0000 (16:40 +0100)]
[X86] lowerShuffleAsRepeatedMaskAndLanePermute - allow 64-bit sublane shuffling on AVX512BW v64i8 shuffles
We were only performing this on 256-bit vectors on AVX2 targets
Noticed while triaging Issue #54658
Simon Pilgrim [Fri, 1 Apr 2022 15:21:54 +0000 (16:21 +0100)]
[X86] Add PR54658 test case
Simon Pilgrim [Fri, 1 Apr 2022 14:57:29 +0000 (15:57 +0100)]
[X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y))
As noticed on PR39174, if we're extracting a single non-constant bit index, then try to use BT+SETCC instead to avoid messing around moving the shift amount to the ECX register, using slow x86 shift ops etc.
Differential Revision: https://reviews.llvm.org/D122891
Yitzhak Mandelbaum [Wed, 23 Mar 2022 00:01:55 +0000 (00:01 +0000)]
[clang][dataflow] Fix handling of base-class fields.
Currently, the framework does not track derived class access to base
fields. This patch adds that support and a corresponding test.
Differential Revision: https://reviews.llvm.org/D122273
Martin Sebor [Fri, 1 Apr 2022 14:58:38 +0000 (16:58 +0200)]
[InstCombine] Add additional tests for strlen/strnlen (NFC)
Taken from D122686.
Aaron Ballman [Fri, 1 Apr 2022 14:31:59 +0000 (10:31 -0400)]
Add prototypes to functions which need them; NFC
Nikita Popov [Fri, 1 Apr 2022 14:31:08 +0000 (16:31 +0200)]
[MemCpyOpt] Add test for PR54682 (NFC)
Florian Hahn [Fri, 1 Apr 2022 14:14:47 +0000 (15:14 +0100)]
[LV] Add SCEV workaround from 80e8025 to epilogue vector code path.
This was exposed by
14e3650f. The recommit of
14e3650f will hit the
problematic code path requiring the workaround.
test case that crashes without the workaround.
Joseph Huber [Fri, 1 Apr 2022 13:42:21 +0000 (09:42 -0400)]
[OpenMP] Make linker wrapper thin-lto default thread count use all
Summary:
Currently there is no option to configure the number of thin-backend
threads to use when performing thin-lto on the device, but we should
default to use all the threads rather than just one. In the future we
should use the same arguments that gold / lld use and parse it here.
Matthias Springer [Fri, 1 Apr 2022 13:07:00 +0000 (22:07 +0900)]
[mlir][tensor][bufferize] Support 0-d collapse_shape with offset
Differential Revision: https://reviews.llvm.org/D122901
Sanjay Patel [Thu, 31 Mar 2022 19:10:47 +0000 (15:10 -0400)]
[x86] add tests for funnel+or == 0; NFC
This is another family of patterns based on issue #49541
Mikhail Goncharov [Fri, 1 Apr 2022 13:27:12 +0000 (15:27 +0200)]
fix bazel build after
369337e3c2
Kadir Cetinkaya [Fri, 1 Apr 2022 11:53:16 +0000 (13:53 +0200)]
[clangd] Record IO precentage for first preamble build of the instance
Differential Revision: https://reviews.llvm.org/D122894
Nathan Sidwell [Fri, 1 Apr 2022 12:47:35 +0000 (05:47 -0700)]
[demangler] Fix node matcher test
Move node matcher compilation test to non-anonymous namespace and
avoid using attribute.
Jay Foad [Thu, 31 Mar 2022 12:39:02 +0000 (13:39 +0100)]
[AMDGPU] Only count global-to-global as indirect accesses
Previously any load (global, local or constant) feeding into a
global load or store would be counted as an indirect access. This
patch only counts global loads feeding into a global load or store.
The rationale is that the latency for global loads is generally
much larger than the other kinds.
As a side effect this makes it easier to write small kernels test
cases that are not counted as having indirect accesses, despite
the fact that arguments to the kernel are accessed with an SMEM
load.
Differential Revision: https://reviews.llvm.org/D122804
Florian Hahn [Fri, 1 Apr 2022 12:47:34 +0000 (13:47 +0100)]
[LV] Re-use TripCount from EPI.TripCount.
During skeleton construction for the epilogue vector loop, generic
helpers use getOrCreateTripCount, which will re-expand the trip count
computation. Instead, re-use the TripCount created during main loop
vectorization.
Nathan Sidwell [Tue, 29 Mar 2022 13:19:18 +0000 (06:19 -0700)]
[demangler] Fix node matchers
* Add instantiation tests to ItaniumDemangleTest, to make sure all
match functions provide constructor arguments to the provided functor.
* Fix the Node constructors that lost const qualification on arguments.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D122665
Groverkss [Fri, 1 Apr 2022 12:08:27 +0000 (17:38 +0530)]
[MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation
This patch modifies the name "integerRelations" and "relation" to refer to the
disjuncts in PresburgerRelation to "disjunct(s)". This is done to be
consistent with the rest of the interface.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D122892
Nathan Sidwell [Wed, 30 Mar 2022 12:59:16 +0000 (05:59 -0700)]
[demangler][NFC] Use def file for node names
In order to add a unit test, we need to expose the node names beyond
ItaniumDemangle.h. This breaks them out into a def file.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D122739
Gabor Marton [Fri, 1 Apr 2022 09:58:17 +0000 (11:58 +0200)]
[analyzer][ctu] Only import const and trivial VarDecls
Do import the definition of objects from a foreign translation unit if that's type is const and trivial.
Differential Revision: https://reviews.llvm.org/D122805
Dmitry Preobrazhensky [Fri, 1 Apr 2022 11:44:24 +0000 (14:44 +0300)]
[AMDGPU][DOC][NFC] Added GFX1013 assembler syntax description
Arjun P [Fri, 1 Apr 2022 11:21:46 +0000 (12:21 +0100)]
[MLIR][Presburger] subtract: fix bug when an input set has duplicate divisions
Previously, when an input set had a duplicate division, the duplicates might
be removed by a call to mergeLocalIds due to being detected as being duplicate
for the first time. The subtraction implementation cannot handle existing
locals being removed, so this would lead to unexpected behaviour. Resolve this
by removing all the duplicates up front.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D122826
Nikita Popov [Fri, 1 Apr 2022 11:06:44 +0000 (13:06 +0200)]
[CoroSplit] Use freeze instead of bitcast for dummy instructions
Not all types that can appear in arguments can be bitcasts -- in
particular, bitcasts do not support struct types.
Xiang1 Zhang [Fri, 1 Apr 2022 10:12:38 +0000 (18:12 +0800)]
Refine tls-load-hoista llvm option
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D122890
Michał Górny [Thu, 31 Mar 2022 07:55:25 +0000 (09:55 +0200)]
[compiler-rt] [scudo] Use -mcrc32 on x86 when available
Update the hardware CRC32 logic in scudo to support using `-mcrc32`
instead of `-msse4.2`. The CRC32 intrinsics use the former flag
in the newer compiler versions, e.g. in clang since
12fa608af44a.
With these versions of clang, passing `-msse4.2` is insufficient
to enable the instructions and causes build failures when `-march` does
not enable CRC32 implicitly:
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.cpp:20:10: error: always_inline function '_mm_crc32_u32' requires target feature 'crc32', but would be inlined into function 'computeHardwareCRC32' that is compiled without support for 'crc32'
return CRC32_INTRINSIC(Crc, Data);
^
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.h:27:27: note: expanded from macro 'CRC32_INTRINSIC'
# define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
^
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/../sanitizer_common/sanitizer_platform.h:132:36: note: expanded from macro 'FIRST_32_SECOND_64'
# define FIRST_32_SECOND_64(a, b) (a)
^
1 error generated.
For backwards compatibility, use `-mcrc32` when available and fall back
to `-msse4.2`. The `<smmintrin.h>` header remains in use as it still
works and is compatible with GCC, while clang's `<crc32intrin.h>`
is not.
Use __builtin_ia32*() rather than _mm_crc32*() when using `-mcrc32`
to preserve compatibility with GCC. _mm_crc32*() are aliases
to __builtin_ia32*() in both compilers but GCC requires `-msse4.2`
for the former, while both use `-mcrc32` for the latter.
Originally reported in https://bugs.gentoo.org/835870.
Differential Revision: https://reviews.llvm.org/D122789
Arjun P [Fri, 1 Apr 2022 10:53:25 +0000 (11:53 +0100)]
[MLIR][Presburger] Factor out some functionality from LexSimplex into a LexSimplexBase
LexSimplex cannot be made to support symbols for symbolic lexmin; this requires
a second class. In preparation for upstreaming support for symbolic lexmin,
keep the part of LexSimplex that are specific to non-symbolic lexmin in LexSimplex
and move the parts that are required to a common class LexSimplexBase for both to
inherit from.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D122828
Simon Pilgrim [Fri, 1 Apr 2022 10:28:34 +0000 (11:28 +0100)]
[X86] Add getBT helper node for attempting to create a X86ISD::BT node
Avoids repeating all the extension/legalization wrappers in every use
Nikita Popov [Thu, 24 Mar 2022 09:31:47 +0000 (10:31 +0100)]
[CoroSplit] Handle argument being the frame pointer (PR54523)
If the frame pointer is an argument of the original pointer (which
happens with opaque pointers), then we currently first replace the
argument with undef, which will prevent later replacement of the
old frame pointer with the new one.
Fix this by replacing arguments with some dummy instructions first,
and then replacing those with undef later. This gives us a chance
to replace the frame pointer before it becomes undef.
Fixes https://github.com/llvm/llvm-project/issues/54523.
Differential Revision: https://reviews.llvm.org/D122375
Nikita Popov [Fri, 1 Apr 2022 10:27:14 +0000 (12:27 +0200)]
[Float2Int] Add test for PR54669 (NFC)
Simon Pilgrim [Fri, 1 Apr 2022 10:20:51 +0000 (11:20 +0100)]
Revert rGff2d1bb2b749bd8a5697c25d2380b7c97a59ae06 "[X86] Add getBT helper node for attempting to create a X86ISD::BT node"
Typo means that this doesn't return a value in all cases.
Martin Sebor [Fri, 1 Apr 2022 10:15:31 +0000 (12:15 +0200)]
[InstCombine] Add additional memchr tests (NFC)
Simon Pilgrim [Fri, 1 Apr 2022 10:12:12 +0000 (11:12 +0100)]
[X86] Add getBT helper node for attempting to create a X86ISD::BT node
Avoids repeating all the extension/legalization wrapper in every use
Alexandros Lamprineas [Thu, 31 Mar 2022 14:27:09 +0000 (15:27 +0100)]
[FuncSpec][NFC] Cache code metrics for analyzed functions.
This isn't expected to reduce compilation times as 'max-iters' is set to
one by default, but it helps with recursive functions that require higher
iteration counts.
Differential Revision: https://reviews.llvm.org/D122819
Simon Pilgrim [Fri, 1 Apr 2022 09:54:14 +0000 (10:54 +0100)]
[X86] lowerV8I16Shuffle - use explicit SmallVector<SDValue, 4> width to avoid MSVC AVX alignment bug
As discussed on Issue #54645 - building llc with /AVX can result in incorrectly aligned structs
Groverkss [Fri, 1 Apr 2022 09:32:27 +0000 (15:02 +0530)]
[MLIR][Presburger] Use PresburgerSpace in constructors
This patch modifies IntegerPolyhedron, IntegerRelation, PresburgerRelation,
PresburgerSet, PWMAFunction, constructors to take PresburgerSpace instead of
dimensions. This allows information present in PresburgerSpace to be carried
better and allows for a general interface.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D122842
Muhammad Omair Javaid [Fri, 1 Apr 2022 09:13:11 +0000 (14:13 +0500)]
[LLDB] Fix TestJobControl.py decorators import
Muhammad Omair Javaid [Fri, 1 Apr 2022 08:58:16 +0000 (13:58 +0500)]
[LLDB] Skip TestJobControl.py AArch64/Arm Linux
TestJobControl.py is randomly failing on AArch64/Arm Linux buildbots.
I am marking it as skipped to make buildbot stable.
Adrian Kuegel [Fri, 1 Apr 2022 08:33:08 +0000 (10:33 +0200)]
[OMPIRBuilder] Remove unused variable in test (NFC)
Peixin-Qiao [Fri, 1 Apr 2022 08:17:29 +0000 (16:17 +0800)]
[OMPIRBuilder] Support ordered clause specified without parameter
This patch supports ordered clause specified without parameter in
worksharing-loop directive in the OpenMPIRBuilder and lowering MLIR to
LLVM IR.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D114940
Iain Sandoe [Tue, 29 Jun 2021 07:06:26 +0000 (08:06 +0100)]
[C++20][Modules] Limit ModuleInternalLinkage to modules-ts.
At present, we are generating wrong code for C++20 modules entities which
should have internal linkage. This is because we are assigning
'ModuleInternalLinkage' unconditionally to such entities. However this mode
is only applicable to the modules-ts.
This change makes the special linkage mode conditional on fmodules-ts and
adds a unit test to verify that we generate the correct linkage.
Currently, static variables and functions in module purview are emitted into
object files as external. On some platforms, lambdas are emitted as global
weak defintions (on Windows this causes a mangler crash).
Differential Revision: https://reviews.llvm.org/D122413
Nikita Popov [Fri, 1 Apr 2022 07:34:13 +0000 (09:34 +0200)]
Revert "[compiler-rt] [scudo] Use -mcrc32 on x86 when available"
This reverts commit
09b53121c323f260ab97cecd067d4e7b3be1bf7c.
Breaks the build with GCC 11.2 on x86_64:
In file included from /home/npopov/repos/llvm-project/compiler-rt/lib/scudo/scudo_crc32.h:27,
from /home/npopov/repos/llvm-project/compiler-rt/lib/scudo/scudo_crc32.cpp:14:
/usr/lib/gcc/x86_64-redhat-linux/11/include/smmintrin.h: In function ‘__sanitizer::u32 __scudo::computeHardwareCRC32(__sanitizer::u32, __sanitizer::uptr)’:
/usr/lib/gcc/x86_64-redhat-linux/11/include/smmintrin.h:846:1: error: inlining failed in call to ‘always_inline’ ‘long long unsigned int _mm_crc32_u64(long long unsigned int, long long unsigned int)’: target specific option mismatch
846 | _mm_crc32_u64 (unsigned long long __C, unsigned long long __V)
Martin Storsjö [Wed, 30 Mar 2022 10:34:02 +0000 (13:34 +0300)]
[libcxx] [test] Avoid spurious test breakage in clang-cl-dll configs with newer CMake
The pointer.volatile.pass.cpp test was already marked as XFAIL for
mingw-dll (for reasons explained in the comment above it).
The same issue also appears in clang-cl-dll when built with newer
CMake versions. (It didn't appear with older versions of CMake, as
CMake built the library with the clang-cl flag `-std:c++latest` when
we've requested C++ 20 - which practically built it in c++2b mode with
current clang versions. With current versions of CMake, it passes
`-std:c++20` instead.)
As it succeeds/fails dependent on factors we don't
directly control, mark it as UNSUPPORTED instead of XFAIL.
Differential Revision: https://reviews.llvm.org/D122718
Martin Storsjö [Thu, 31 Mar 2022 08:51:30 +0000 (11:51 +0300)]
[libcxx] [ci] Enable -Werror for libcxxabi and libunwind too
Differential Revision: https://reviews.llvm.org/D122800
Jason Molenda [Fri, 1 Apr 2022 06:44:17 +0000 (23:44 -0700)]
Update callers to SendPacket with std::string's to not devolve to c-strs
Many callers of SendPacket() in RNBRemote.cpp have a local std::string
object, call c_str() on it to pass a c-string, which is then copied into
a std::string temporary object.
Also free JSONGenerator objects once we've formatted them into
ostringstream and don't need the objects any longer, to reduce max
memory use in debugserver.
Differential Revision: https://reviews.llvm.org/D122848
rdar://
91117263
Mehdi Amini [Fri, 1 Apr 2022 06:36:34 +0000 (06:36 +0000)]
Fix MLIR test pass
Inadvertently removed `populateWithGenerated` while testing native
patterns.
Chuanqi Xu [Fri, 1 Apr 2022 06:35:35 +0000 (14:35 +0800)]
[C++20] [Modules] Don't generate strong function of a partition in importing modules
This solves the multiple defintiion issue
https://github.com/llvm/llvm-project/issues/54269.
I think the cause of the bug might be an oversight. We just forget to
edit this when implementing partitions. And it should be a good fix.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D121271
Kees Cook [Fri, 1 Apr 2022 06:27:10 +0000 (23:27 -0700)]
[CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=CSKY -DLLVM_ENABLE_ASSERTIONS=OFF
builds will fail to link due to undefined `llvm::MCInst::dump() const`
```
ld.lld: error: undefined symbol: llvm::MCInst::dump() const
>>> referenced by CSKYAsmBackend.cpp
>>> /home/kees/src/built-compilers/llvm/stage2-prof-gen/lto.cache/llvmcache-
0656FC38C728A7FE0F767D10CD84C7F820114C46:(llvm::CSKYAsmBackend::relaxInstruction(llvm::MCInst&, llvm::MCSubtargetInfo const&) const)
```
Wrap it in LLVM_DEBUG().
Fixes https://github.com/llvm/llvm-project/issues/54684
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D122854
Mehdi Amini [Fri, 1 Apr 2022 05:52:25 +0000 (05:52 +0000)]
Add a test case for `applyPatternsAndFoldGreedily` to support the revert of
59bbc7a08
This shows that pushing constant to the right in a commutative op leads
to `applyPatternsAndFoldGreedily` to converge without applying all the
patterns.
Differential Revision: https://reviews.llvm.org/D122870
Mehdi Amini [Fri, 1 Apr 2022 06:16:00 +0000 (06:16 +0000)]
Revert "[GreedPatternRewriter] Preprocess constants while building worklist when not processing top down"
This reverts commit
59bbc7a0851b6e0054bb3ed47df0958822f08880.
This exposes an issue breaking the contract of
`applyPatternsAndFoldGreedily` where we "converge" without applying
remaining patterns.
Fangrui Song [Fri, 1 Apr 2022 06:04:50 +0000 (23:04 -0700)]
[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions
This approach is used by AArch64/RISCV to make frame-setup/frame-destroy
instructions contiguous instead of being interleaved by CFI instructions. Code
checking `MBBI->getFlag(MachineInstr::FrameSetup) || MBBI->isCFIInstruction()`
can be simplified to just check FrameSetup.
This helps locate all CFI instructions in the prologue, which can be handy to use
.cfi_remember_state/.cfi_restore_state to decrease unwind table size (D114545).
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D122541
Kai Luo [Fri, 1 Apr 2022 05:16:11 +0000 (13:16 +0800)]
[PowerPC] Add cmpxchg test for pwr7 in atomic expand pass. NFC.
Vitaly Buka [Fri, 1 Apr 2022 03:39:03 +0000 (20:39 -0700)]
Destroy ValueNames after all unique_ptr<Value>
This UB detected by -fsanitize-memory-use-after-dtor in tensorflow/MLIR.
Tan Jinhua [Thu, 31 Mar 2022 06:43:47 +0000 (14:43 +0800)]
[llvm-cov] Add test cases for coverage_watermark
Add test cases for coverage_watermark in llvm-cov, also refer to
https://reviews.llvm.org/D116876
Differential Revision: https://reviews.llvm.org/D122785
Jake Vossen [Fri, 1 Apr 2022 03:38:14 +0000 (03:38 +0000)]
Fix Typo in SmallVector doc
Replace forward slash with backward slash.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D120930
Lian Wang [Thu, 31 Mar 2022 01:51:06 +0000 (01:51 +0000)]
[RISCV] Supplement SDNode patterns for vfwmul/vfwadd/vfwsub
Reviewed By: jacquesguan
Differential Revision: https://reviews.llvm.org/D122720
Richard Smith [Fri, 1 Apr 2022 01:40:40 +0000 (18:40 -0700)]
An expression should only contain an unexpanded parameter pack if it
lexically contains a mention of the pack.
Systematically distinguish between syntactic and semantic references to
packs, especially when propagating dependence from a type into an
expression. We should consult the type-as-written when computing
syntactic dependence and should consult the semantic type when computing
semantic dependence.
Fixes #54402.