Michael Kruse [Wed, 22 Sep 2021 22:27:16 +0000 (17:27 -0500)]
[Polly] Implement user-directed loop distribution/fission.
This is a simple version without the possibility to define distribute
points or followup-transformations. However, it is the first
transformation that has to check whether the transformation is correct.
It interprets the same metadata as the LoopDistribute pass.
Leonard Chan [Wed, 22 Sep 2021 22:25:05 +0000 (15:25 -0700)]
[compiler-rt][test] Add REQUIRES for checking static libc++abi
intercept-rethrow-exception.cc fails when running runtimes tests if linking in
a hermetic libc++abi. This is because if libc++abi is used, then asan expects
to intercept __cxa_rethrow_primary_exception on linux, which should unpoison the
stack. If we statically link in libc++abi though, it will contain a strong
definition for __cxa_rethrow_primary_exception which wins over the weakly
defined interceptor provided by asan, causing the test to fail by not unpoisoning
the stack on the exception being thrown.
It's likely no one has encountered this before and possible that upstream tests
opt for dynamically linking where the interceptor can work properly. An ideal
long term solution would be to update the interceptor and libc++[abi] APIs to
work for this case, but that will likely take a long time to work out. In the
meantime, since the test isn't necessarily broken, we can just add another
REQUIRES check to make sure that it's only run if we aren't statically linking
in libc++abi.
Differential Revision: https://reviews.llvm.org/D109938
Shilei Tian [Wed, 22 Sep 2021 22:16:56 +0000 (18:16 -0400)]
[NFC] Remove trailing spaces from some files
Wenlei He [Wed, 22 Sep 2021 01:17:49 +0000 (18:17 -0700)]
[llvm-profgen] Use hot threshold for context merging and trimming
Without preinliner, we need to tune down the cold count cutoff to merge/trim more context to limit profile size for large components. However it doesn't make sense for cold threshold to be higher than hot threshold, so we now change to use hot threshold as merging/trimming cut off instead.
Differential Revision: https://reviews.llvm.org/D110212
Aart Bik [Mon, 20 Sep 2021 18:15:13 +0000 (11:15 -0700)]
[mlir][sparse] add sparse kernels test to sparse compiler test suite
This test makes sure kernels map to efficient sparse code, i.e. all
compressed for-loops, no co-iterating while loops. In addition, this
revision removes the special constant folding inside the sparse
compiler in favor of Mahesh' new generic linalg folding. Thanks!
NOTE: relies on Mahesh fix, which needs to be rebased first
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D110001
Zhi An Ng [Wed, 22 Sep 2021 21:52:50 +0000 (14:52 -0700)]
[WebAssembly] Add relaxed-simd feature
This currently only defines a constant, but it the future will be used
to gate builtins for experimenting and prototyping relaxed-simd proposal
(https://github.com/WebAssembly/relaxed-simd/).
Differential Revision: https://reviews.llvm.org/D110111
peter klausler [Tue, 14 Sep 2021 20:37:11 +0000 (13:37 -0700)]
[flang] Catch error: base of DATA statement object can't be a pointer
A pointer with subscripts, substring indices, or components cannot
be initialized by a DATA statement (although of course a whole pointer
can be so). Catch the missing cases.
Differential Revision: https://reviews.llvm.org/D109931
Yuanfang Chen [Thu, 24 Jun 2021 06:46:42 +0000 (23:46 -0700)]
Diagnose -Wunused-value based on CFG reachability
While at it, add the diagnosis message "left operand of comma operator has no effect" (used by GCC) for comma operator.
This also makes Clang diagnose in the constant evaluation context which aligns with GCC/MSVC behavior. (https://godbolt.org/z/7zxb8Tx96)
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D103938
Craig Topper [Wed, 22 Sep 2021 21:25:40 +0000 (14:25 -0700)]
[RISCV] Remove stale FIXMEs from float-convert.ll and double-convert.ll. NFC
Craig Topper [Wed, 22 Sep 2021 21:21:03 +0000 (14:21 -0700)]
[RISCV] Add fcvt.s.w(u)/fcvt.d.w(u)/fcvt.h.w(u) to hasAllNBitUsers
These instructions only read the lower 32 bits of their input.
Craig Topper [Wed, 22 Sep 2021 21:16:30 +0000 (14:16 -0700)]
[RISCV] Add test cases showing failure to use ADDIW before fcvt.s.w/fcvt.d.w/fcvt.h.w. NFC
By not using ADDIW we can cause both an ADDIW and ADDI to be emitted
when the add has multiple users.
These instructions needed be added to the list of instructions that
only use the lower 32 bits of input.
I've also added tests for the wu versions, but I'm having trouble
showing bad codegen from it.
Tyler Augustine [Wed, 22 Sep 2021 20:44:02 +0000 (20:44 +0000)]
Fix bug for Ops with default valued attributes and successors/variadic regions.
When both a DefaultValuedAttr and a successor or variadic region was specified, this would generate invalid C++ declaration. There would be the parameter with a default value, followed by the successors/regions, which don't have a default, which is invalid.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D110205
Shilei Tian [Wed, 22 Sep 2021 21:16:28 +0000 (17:16 -0400)]
[OpenMP][Offloading] Change `bool IsSPMD` to `int8_t Mode` in `__kmpc_target_init` and `__kmpc_target_deinit`
This is a follow-up of D110029, which uses bitset to indicate execution mode. This patches makes the changes in the function call.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D110279
Yonghong Song [Mon, 20 Sep 2021 23:23:46 +0000 (16:23 -0700)]
[Clang] Ignore BTFTag attr if used as a type attribute
Currently, linux kernel has a __user attribute ([1]) defined as
__attribute__((noderef, address_space(__user)))
which is used by sparse tool ([2]) to do some
type checking of pointers to user space memory.
During normal compilation, __user will be defined
to nothing so it won't have an impact on compilation.
The btf_tag attribute, which is motivated by
carrying linux kernel annotations into dwarf/BTF,
is introduced in [3]. We intended to define __user as
__attribute__((btf_tag("user")))
so such information will be encoded in dwarf/BTF
and can be used later by bpf verification or other
tracing tools.
But linux kernel __user attribute is also used during
type conversion which btf_tag doesn't support ([4]) since
such type conversion is only used for compiler analysis
and not encoded in dwarf/btf. Theoretically, it is
possible for clang to understand these tags and
do a sparse-like type checking work. But I would like
to leave that to future work and for now suggest simply
ignore these btf_tag attributes if they are used
as type attributes.
[1] https://github.com/torvalds/linux/blob/master/include/linux/compiler_types.h#L10
[2] https://sparse.docs.kernel.org/en/latest/
[3] https://reviews.llvm.org/D106614
[4] https://github.com/torvalds/linux/blob/master/fs/binfmt_flat.c#L135
Differential Revision: https://reviews.llvm.org/D110116
MaheshRavishankar [Wed, 22 Sep 2021 18:14:19 +0000 (11:14 -0700)]
[mlir][Linalg] Teach constant -> generic op fusion to handle scalar constants.
The current folder of constant -> generic op only handles splat
constants. The same logic holds for scalar constants. Teach the
pattern to handle such cases.
Differential Revision: https://reviews.llvm.org/D109982
Louis Dionne [Wed, 22 Sep 2021 20:41:11 +0000 (16:41 -0400)]
[libc++][NFC] Add missing whitespace in <compare>
Sanjay Patel [Wed, 22 Sep 2021 20:16:49 +0000 (16:16 -0400)]
[InstCombine] add one-use check to shift-shift transform
We don't want to create extra instructions, and this
could infinite loop with the proposed transform in D110170.
Sanjay Patel [Wed, 22 Sep 2021 20:15:47 +0000 (16:15 -0400)]
[InstCombine] add test for shift-shift with extra use; NFC
Nikita Popov [Wed, 22 Sep 2021 20:28:58 +0000 (22:28 +0200)]
[JumpThreading] Add test with free instructions (NFC)
Which demonstrates that "free" instructions can prevent jump
threading.
River Riddle [Wed, 22 Sep 2021 20:07:05 +0000 (20:07 +0000)]
[mlir:DataFlowAnalysis] Reprocess the arguments of already executable edges
This fixes a bug where we discover new information about the arguments of an
already executable edge, but don't visit the arguments. We only visit the arguments, and not the block itself, so this commit shouldn't really affect performance at all.
Fixes PR#51871
Differential Revision: https://reviews.llvm.org/D110197
Yi Zhang [Wed, 22 Sep 2021 20:02:05 +0000 (16:02 -0400)]
Reset operation when canceling root update transaction
Should reset the operation to original state when canceling the updates.
Reviewed By: rriddle, ftynse
Differential Revision: https://reviews.llvm.org/D110176
Louis Dionne [Wed, 22 Sep 2021 13:35:32 +0000 (09:35 -0400)]
[libc++][NFCI] Remove uses of _LIBCPP_INLINE_VAR
All supported compilers provide support for inline variables in C++17 now.
Also, as a fly-by fix, replace some uses of _LIBCPP_CONSTEXPR by just
constexpr.
The only exception in this patch is `std::ignore`, which is provided
prior to C++17. Since it is defined in an anonymous namespace, it always
has internal linkage anyway, so using an inline variable there doesn't
provide any benefit. Instead, `inline` was removed entirely on `std::ignore`.
Differential Revision: https://reviews.llvm.org/D110243
Joe Loser [Wed, 22 Sep 2021 20:00:16 +0000 (16:00 -0400)]
[libc++][test] Remove disable_missing_braces_warning.h from tests
Several tests include `disable_missing_braces_warning.h` but do not need
to. Remove the include.
Inspired from discussion at https://reviews.llvm.org/D109668
Reviewed By: ldionne, #libc, Mordante
Differential Revision: https://reviews.llvm.org/D109711
Aart Bik [Tue, 21 Sep 2021 21:48:49 +0000 (14:48 -0700)]
[mlir][sparse] generalize reduction support in sparse compiler
Now not just SUM, but also PRODUCT, AND, OR, XOR. The reductions
MIN and MAX are still to be done (also depends on recognizing
these operations in cmp-select constructs).
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D110203
Sanjay Patel [Wed, 22 Sep 2021 19:01:53 +0000 (15:01 -0400)]
[ValueTracking] fix isOnlyUsedInZeroEqualityComparison with no users
This is another problem exposed by:
https://bugs.llvm.org/PR50836
Sanjay Patel [Wed, 22 Sep 2021 18:56:27 +0000 (14:56 -0400)]
[Analysis] reduce code for isOnlyUsedInZeroEqualityComparison; NFC
There's a bug here noted by the FIXME and visible in variations of PR50836.
Fangrui Song [Wed, 22 Sep 2021 18:51:09 +0000 (11:51 -0700)]
[ELF][AArch64] Refine and fix the condition when BTI/PAC PLT needs bti c
(As I mentioned in https://reviews.llvm.org/D62609#1534158 ,
the condition for using bti c for executable can be loosened.)
In two cases the address of a PLT may escape:
* canonical PLT entry for a STT_FUNC
* non-preemptible STT_GNU_IFUNC which is converted to STT_FUNC
The first case can be detected with `needsPltAddr`.
The second case is not straightforward to detect because for the Relocations.cpp
created `directSym`, it's difficult to know whether the associated `sym` has
exercised the `!needsPlt(expr)` code path. Just use the conservative `isInIplt`
condition. A non-preemptible ifunc not referenced by non-GOT-generating
non-PLT-generating relocations will have an unneeded `bti c`, but the cost is acceptable.
The second case fixes a bug as well: a -shared link may have non-preemptible ifunc.
Before the patch we did not emit `bti c` and could be wrong if the PLT address escaped.
GNU ld doesn't handle the case: `relocation R_AARCH64_ADR_PREL_PG_HI21 against STT_GNU_IFUNC symbol 'ifunc2' isn't handled by elf64_aarch64_final_link_relocate` (https://sourceware.org/bugzilla/show_bug.cgi?id=28370)
For -shared, if BTI is enabled but PAC is disabled, the PLT entry size increases
from 16 to 24 because we have to select the PLT scheme early, but the cost is
acceptable.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D110217
Joseph Huber [Wed, 22 Sep 2021 18:37:33 +0000 (14:37 -0400)]
[OpenMP] Fix KeepAlive usage
Summary:
Functions were called the wrong way around, this didn't keep the symbol
alive.
David Blaikie [Wed, 22 Sep 2021 03:25:13 +0000 (20:25 -0700)]
DebugInfo: Add (initially no-op) -gsimple-template-names={simple,mangled}
This is to build the foundation of a new debug info feature to use only
the base name of template as its debug info name (eg: "t1" instead of
the full "t1<int>"). The intent being that a consumer can still retrieve
all that information from the DW_TAG_template_*_parameters.
So gno-simple-template-names is business as usual/previously ("t1<int>")
=simple is the simplified name ("t1")
=mangled is a special mode to communicate the full information, but
also indicate that the name should be able to be simplified. The data
is encoded as "_STNt1|<int>" which will be matched with an
llvm-dwarfdump --verify feature to deconstruct this name, rebuild the
original name, and then try to rebuild the simple name via the DWARF
tags - then compare the latter and the former to ensure that all the
data necessary to fully rebuild the name is present.
Alex Langford [Wed, 15 Sep 2021 21:36:49 +0000 (14:36 -0700)]
[lldb] Remove IRExecutionUnit::CollectFallbackNames
The work that IRExecutionUnit::CollectFallbackNames is basically the
work that `CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments`
does already. It's also (at time or writing) specific to C++, so it can
be folded into `IRExecutionUnit::CollectCandidateCPlusPlusNames`.
Differential Revision: https://reviews.llvm.org/D109928
David Green [Wed, 22 Sep 2021 17:58:00 +0000 (18:58 +0100)]
Mark CFG as preserved in TypePromotion and InterleaveAccess passes
Neither of these passes modify the CFG, allowing us to preserve DomTree
and LoopInfo across them by using setPreservesCFG.
Differential Revision: https://reviews.llvm.org/D110161
Erich Keane [Wed, 22 Sep 2021 14:25:50 +0000 (07:25 -0700)]
Change error for storage-class to mean linkage, fix lang-linkage diag
Allow multiversioning declarations to match when the actual formal
linkage matches, not just when the storage class is identical.
Additionally, change the ambiguous 'linkage' mismatch to be more
specific and say 'language linkage'.
Sanjay Patel [Wed, 22 Sep 2021 17:24:51 +0000 (13:24 -0400)]
[Analysis] improve function matching for strlen libcall
The return type of strlen is size_t, not just any integer.
This is a partial fix for an example based on:
https://llvm.org/PR50836
There's another bug here because we can still crash
processing a real strlen or something that looks like it.
Michael Benfield [Wed, 15 Sep 2021 22:57:41 +0000 (22:57 +0000)]
Don't diagnose unused but set when the Cleanup attribute is used.
This applies to -Wunused-but-set-variable and
-Wunused-but-set-parameter.
This addresses bug 51865.
Differential Revision: https://reviews.llvm.org/D109862
Tobias Gysi [Wed, 22 Sep 2021 17:27:10 +0000 (17:27 +0000)]
[mlir][linalg] Fix interchange initialization in fusion on tensors.
If no interchange vector is given initialize it with the identity permutation from 0 to number of loops.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D110249
Hongtao Yu [Wed, 22 Sep 2021 16:11:53 +0000 (09:11 -0700)]
[llvm-profgen] An option to dump disasm of specified symbols
For large app, dumping disasm of the whole program can be slow and result in gianant output. Adding a switch to dump specific symbols only.
Reviewed By: wlei
Differential Revision: https://reviews.llvm.org/D110079
Daniil Fukalov [Mon, 20 Sep 2021 19:33:38 +0000 (22:33 +0300)]
[NFCI][CodeGen, AArch64] Fix inconsistent TargetCostKind types.
The pass uses different cost kinds to estimate "old" and "interleaved" costs:
default cost kind for all targets override `getInterleavedMemoryOpCost()` is
`TCK_SizeAndLatency`. Although at the moment estimated `TCK_Latency` costs are
equal to `TCK_SizeAndLatency`, (so the change is NFC) it may change in future.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D110100
Aaron Ballman [Wed, 22 Sep 2021 17:00:13 +0000 (13:00 -0400)]
Add document numbers for the C99 status page.
This doesn't add all of the document numbers, but it adds a bunch of
them. Not all of the documents are available on the committee page
(they're old enough that they come from a time when the mailing was
comprised of physical pieces of paper), so some of the documents listed
are assumed to be correct based on my reading of editor's reports.
Arthur Eubanks [Fri, 27 Aug 2021 19:32:59 +0000 (12:32 -0700)]
[SimplifyCFG] Ignore free instructions when computing cost for folding branch to common dest
When determining whether to fold branches to a common destination by
merging two blocks, SimplifyCFG will count the number of instructions to
be moved into the first basic block. However, there's no reason to count
free instructions like bitcasts and other similar instructions.
This resolves missed branch foldings with -fstrict-vtable-pointers in
llvm-test-suite's lambda benchmark.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D108837
Siva Chandra Reddy [Tue, 21 Sep 2021 23:53:30 +0000 (23:53 +0000)]
[libc] Add an implementation of bsearch.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D110222
Matt Morehouse [Wed, 22 Sep 2021 16:34:49 +0000 (09:34 -0700)]
[HWASan] Use a single .weak binding in asm.
Specifying .global and .weak causes a compiler warning:
warning: __sigsetjmp changed binding to STB_WEAK
Specifying only .weak should have the same effect without causing a
warning.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D110178
Stefan Gränitz [Wed, 22 Sep 2021 15:46:08 +0000 (17:46 +0200)]
[ORC] DebugObjectManagerPlugin tests can use lli in ORC greedy mode
Initially, lli only supported lazy mode for ORC. Greedy mode was added with
e1579894d205 and it's the default setting now. DebugObjectManagerPlugin tests don't rely on laziness, so we can switch them to greedy in order to avoid some unnecessary complexity.
Joseph Huber [Tue, 21 Sep 2021 21:34:11 +0000 (17:34 -0400)]
[OpenMP] Add function tracing debugging to device RTL
This patch adds support for an RAII struct that will print function
traces when placed inside of a function declaration. Each successive
call will increase the indentation to make it easier to visually
inspect.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D110202
Aart Bik [Wed, 22 Sep 2021 05:56:00 +0000 (22:56 -0700)]
[mlir][sparse] replace ad-hoc MemRef struct with CRunnerUtils definition
This revision removes the ad-hoc MemRefs that were needed using the old
ABI (when we still passed by value) and replaces them with the shared
StridedMemRef definitions of CRunnerUtils (possible now that we pass by
pointer). This avoids code duplication and makes sure we have a consistent
view of strided memory references in all our support libraries.
Reviewed By: jsetoain
Differential Revision: https://reviews.llvm.org/D110221
Craig Topper [Wed, 22 Sep 2021 16:12:45 +0000 (09:12 -0700)]
[RISCV] Optimize vp.store with an all ones mask to avoid a vmset.
We can use riscv_vse intrinsic instead of riscv_vse_mask. The code here
is based on similar code for handling masked.scatter and vp.scatter.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D110206
Shilei Tian [Wed, 22 Sep 2021 16:10:02 +0000 (12:10 -0400)]
[NFC] clang-format -i llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Hongtao Yu [Wed, 22 Sep 2021 00:16:45 +0000 (17:16 -0700)]
[CSSPGO] Set PseudoProbeInserter as a default pass.
Currenlty PseudoProbeInserter is a pass conditioned on a target switch. It works well with a single clang invocation. It doesn't work so well when the backend is called separately (i.e, through the linker or llc), where user has always to pass -pseudo-probe-for-profiling explictly. I'm making the pass a default pass that requires no command line arg to trigger, but will be actually run depending on whether the CU comes with `llvm.pseudo_probe_desc` metadata.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D110209
Alexey Bataev [Wed, 22 Sep 2021 15:08:40 +0000 (08:08 -0700)]
[SLP][NFC]Add a test to show an issue with incorrectly extracted
pointers.
Kazu Hirata [Wed, 22 Sep 2021 15:58:26 +0000 (08:58 -0700)]
[CodeGen] Remove redundant declaration MIRCanonicalizerID (NFC)
Note that MIRCanonicalizerID is declared in
llvm/include/llvm/CodeGen/Passes.h, which MIRCanonicalizerPass.cpp
includes.
Identified with readability-redundant-declaration.
Stefan Gränitz [Wed, 22 Sep 2021 15:35:26 +0000 (17:35 +0200)]
[ORC] Re-enable ELF DebugObjectManagerPlugin tests
These tests were disabled by accident after D107640. Actually, REQUIRES lines don't support `x86_64` and so these tests stopped running on all targets.
`native && target-x86_64` should be the correct term to express "x86_64 host targeting native arch".
Simon Pilgrim [Wed, 22 Sep 2021 15:48:01 +0000 (16:48 +0100)]
[SLP] getReductionCost - use explicit TTI::TCK_RecipThroughput CostKind. NFCI.
Avoid relying on the default cost kinds in TTI calls (we already do this in other places in SLP) - noticed while trying to see how much work it'd be to extend D110242 and remove all remaining uses of default CostKind arguments.
hyeongyu kim [Wed, 22 Sep 2021 15:23:31 +0000 (00:23 +0900)]
[InstCombine] Update InstCombine to use poison instead of undef for shufflevector's placeholder (3/3)
This patch is for fixing potential shufflevector-related bugs like D93818.
As D93818, this patch change shufflevector's default placeholder to poison.
To reduce risk, it was divided into several patches, and this patch is for InstCombineVectorOps.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D110230
Joe Loser [Wed, 22 Sep 2021 15:46:21 +0000 (11:46 -0400)]
[libc++] Disallow volatile types in std::allocator
LWG 2447 is marked as `Complete`, but there is no `static_assert` to
reject volatile types in `std::allocator`. See the discussion at
https://reviews.llvm.org/D108856.
Add `static_assert` in `std::allocator` to disallow volatile types. Since this
is an implementation choice, mark the binding test as `libc++` only.
Remove tests that use containers backed by `std::allocator` that test
the container when used with a volatile type.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D109056
Shilei Tian [Wed, 22 Sep 2021 15:40:37 +0000 (11:40 -0400)]
[OpenMP][Offloading] Use bitset to indicate execution mode instead of value
The execution mode of a kernel is stored in a global variable, whose value means:
- 0 - SPMD mode
- 1 - indicates generic mode
- 2 - SPMD mode execution with generic mode semantics
We are going to add support for SIMD execution mode. It will be come with another
execution mode, such as SIMD-generic mode. As a result, this value-based indicator
is not flexible.
This patch changes to bitset based solution to encode execution mode. Each
position is:
[0] - generic mode
[1] - SPMD mode
[2] - SIMD mode (will be added later)
In this way, `0x1` is generic mode, `0x2` is SPMD mode, and `0x3` is SPMD mode
execution with generic mode semantics. In the future after we add the support for
SIMD mode, `0b1xx` will be in SIMD mode.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D110029
hyeongyu kim [Wed, 22 Sep 2021 14:30:33 +0000 (23:30 +0900)]
[InstCombine] Update InstCombine to use poison instead of undef for shufflevector's placeholder (2/3)
This patch is for fixing potential shufflevector-related bugs like D93818.
As D93818, this patch change shufflevector's default placeholder to poison.
To reduce risk, it was divided into several patches, and this patch is for InstCombineCompares and InstructionCombining.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D110227
Louis Dionne [Wed, 22 Sep 2021 15:13:47 +0000 (11:13 -0400)]
[libc++][NFC] Add link to Discord channel from documentation
Teresa Johnson [Wed, 22 Sep 2021 15:04:08 +0000 (08:04 -0700)]
[Sanitizer] Add Windows header for _mkdir
This will hopefully fix the sanitizer_windows bot failure after D109794:
https://lab.llvm.org/buildbot/#/builders/127/builds/17222
Simon Pilgrim [Wed, 22 Sep 2021 13:40:29 +0000 (14:40 +0100)]
[Target][CodeGen] Remove default CostKind arguments on inner/impl TTI overrides
Based off a discussion on D110100, we should be avoiding default CostKinds whenever possible.
This initial patch removes them from the 'inner' target implementation callbacks - these should only be used by the main TTI calls, so this should guarantee that we don't cause changes in CostKind by missing it in an inner call. This exposed a few missing arguments in getGEPCost and reduction cost calls that I've cleaned up.
Differential Revision: https://reviews.llvm.org/D110242
hyeongyu kim [Wed, 22 Sep 2021 13:39:54 +0000 (22:39 +0900)]
[InstCombine] Update InstCombine to use poison instead of undef for shufflevector's placeholder (1/3)
This patch is for fixing potential shufflevector-related bugs like D93818.
As D93818, this patch change shufflevector's default placeholder to poison.
To reduce risk, it was divided into several patches, and this patch is for InstCombineCasts.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D110226
Sander de Smalen [Fri, 17 Sep 2021 14:14:24 +0000 (15:14 +0100)]
[AArch64][SVE] NFC: Move extract_subvector tests around.
This patch splits up sve-extract-vector.ll into
* sve-extract-fixed-vector.ll
* sve-extract-scalable-vector.ll
For testing extracts of a fixed-width or scalable sub-vector from a
scalable source vector, respectively.
Joseph Huber [Wed, 22 Sep 2021 13:20:49 +0000 (09:20 -0400)]
[OpenMP] Make sure the Thread ID function is not removed
Summary:
The thread ID function was reintroduced in D110195, but could
potentially be removed by the optimizer. Make the function noinline to
preserve the call sites and add it to the externalization RAII so its
definition is not removed by the attributor.
Joseph Tremoulet [Wed, 22 Sep 2021 14:12:16 +0000 (10:12 -0400)]
[mailmap] Add entry for myself
Sander de Smalen [Wed, 22 Sep 2021 13:25:14 +0000 (14:25 +0100)]
[AArch64][SVE] Add extract_subvector patterns for unpacked fp16 and bfloat types.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D110163
Sander de Smalen [Wed, 22 Sep 2021 12:34:00 +0000 (13:34 +0100)]
[SelectionDAG] Remove PromoteIntOp_EXTRACT_SUBVECTOR.
This code seems untested and is likely obsolete, because this case
should already be handled by the code that legalizes the result type
of EXTRACT_SUBVECTOR.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D110061
Tim Northover [Wed, 22 Sep 2021 12:06:55 +0000 (13:06 +0100)]
AArch64: use indivisible cmpxchg for 128-bit atomic loads at O0
Like normal atomicrmw operations, at -O0 the simple register-allocator can
insert spills into the LL/SC loop if it's expanded and visible when regalloc
runs. This can cause the operation to never succeed by repeatedly clearing the
monitor. Instead expand to a cmpxchg, which has a pseudo-instruction for -O0.
Andrew Ng [Mon, 20 Sep 2021 18:13:30 +0000 (19:13 +0100)]
[ELF][test] Restore important part of ICF alignment test
Restore the checking of addresses in ICF test which was testing the
behaviour of ICF with regards to different alignments of otherwise
identical sections. Also make the test more robust to layout changes.
Differential Revision: https://reviews.llvm.org/D110090
Alexey Bataev [Wed, 22 Sep 2021 12:50:14 +0000 (05:50 -0700)]
[SLP][NFC]Rename function in the test for better matching of the
transformation.
Stefan Gränitz [Wed, 22 Sep 2021 11:54:26 +0000 (13:54 +0200)]
[lldb] JITLoaderGDB tests can use lli in ORC greedy mode
At first, lli only supported lazy mode for ORC. Greedy mode was added with
e1579894d205 and is the default settings now. JITLoaderGDB tests don't rely on laziness, so we can switch them to greedy and remove some complexity.
Sander de Smalen [Wed, 22 Sep 2021 09:59:21 +0000 (10:59 +0100)]
[SelectionDAG] Add PromoteIntOp_INSERT_SUBVECTOR.
This is required to codegen something like:
<vscale x 8 x i16> @llvm.experimental.vector.insert(<vscale x 8 x i16> %vec,
<vscale x 2 x i16> %subvec,
i64 %idx)
where the output vector is legal, but the input vector needs promoting.
It implements this by performing the whole operation on the promoted type,
and then truncating the result.
Reviewed By: david-arm, craig.topper
Differential Revision: https://reviews.llvm.org/D110059
LLVM GN Syncbot [Wed, 22 Sep 2021 12:20:22 +0000 (12:20 +0000)]
[gn build] Port
7a320b279d07
Nico Weber [Wed, 22 Sep 2021 12:20:12 +0000 (08:20 -0400)]
[gn build] (manually) port
f8b1cc365786
Florian Hahn [Wed, 22 Sep 2021 11:29:48 +0000 (12:29 +0100)]
[Passes] Run vector-combine early with -fenable-matrix.
IR with matrix intrinsics is likely to also contain large vector
operations, which can benefit from early simplifications.
This is the last step in a series of changes to improve code-gen for
code using matrix subscript operators with the C/C++ matrix extension in
CLang, like
using matrix_t = double __attribute__((matrix_type(15, 15)));
void foo(unsigned i, matrix_t &A, matrix_t &B) {
for (unsigned j = 0; j < 4; ++j)
for (unsigned k = 0; k < i; k++)
B[k][j] -= A[k][j] * B[i][j];
}
https://clang.godbolt.org/z/6dKxK1Ed7
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D102496
Sanjay Patel [Wed, 22 Sep 2021 11:44:17 +0000 (07:44 -0400)]
Revert "[InstCombine] fold cast of right-shift if high bits are not demanded"
This reverts commit
2f6b07316f560a1f6d225919019dff2e5d6346e5.
This caused several bots to hit an infinite loop at stage 2,
so it needs to be reverted while figuring out how to fix that.
Sanjay Patel [Wed, 22 Sep 2021 11:42:12 +0000 (07:42 -0400)]
Revert "[CodeGen] regenerate test checks; NFC"
This reverts commit
52832cd917af00e2b9c6a9d1476ba79754dcabff.
The motivating commit
2f6b07316f5 caused several bots to hit
an infinite loop at stage 2, so that needs to be reverted too
while figuring out how to fix that.
Florian Hahn [Wed, 22 Sep 2021 09:28:36 +0000 (10:28 +0100)]
[Matrix] Emit assumption that matrix indices are valid.
The matrix extension requires the indices for matrix subscript
expression to be valid and it is UB otherwise.
extract/insertelement produce poison if the index is invalid, which
limits the optimizer to not be bale to scalarize load/extract pairs for
example, which causes very suboptimal code to be generated when using
matrix subscript expressions with variable indices for large matrixes.
This patch updates IRGen to emit assumes to for index expression to
convey the information that the index must be valid.
This also adjusts the order in which operations are emitted slightly, so
indices & assumes are added before the load of the matrix value.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D102478
Martin Storsjö [Tue, 14 Sep 2021 10:50:41 +0000 (13:50 +0300)]
[lldb] [Windows] Fix continuing from breakpoints and singlestepping on ARM/AArch64
Based on suggestions by Eric Youngdale.
This fixes https://llvm.org/PR51673.
Differential Revision: https://reviews.llvm.org/D109777
David Green [Wed, 22 Sep 2021 11:07:52 +0000 (12:07 +0100)]
[ARM] Allow smaller VMOVL in tail predicated loops
This allows VMOVL in tail predicated loops so long as the the vector
size the VMOVL is extending into is less than or equal to the size of
the VCTP in the tail predicated loop. These cases represent a
sign-extend-inreg (or zero-extend-inreg), which needn't block tail
predication as in https://godbolt.org/z/hdTsEbx8Y.
For this a vecsize has been added to the TSFlag bits of MVE
instructions, which stores the size of the elements that the MVE
instruction operates on. In the case of multiple size (such as a
MVE_VMOVLs8bh that extends from i8 to i16, the largest size was be
chosen). The sizes are encoded as 00 = i8, 01 = i16, 10 = i32 and 11 =
i64, which often (but not always) comes from the instruction encoding
directly. A unit test was added, and although only a subset of the
vecsizes are currently used, the rest should be useful for other cases.
Differential Revision: https://reviews.llvm.org/D109706
Raphael Isemann [Wed, 22 Sep 2021 10:14:50 +0000 (12:14 +0200)]
Unbreak module builds by making InstructionWorklist.h non-modular
This regressed in D110181 and apparently the header intentionally requires
DEBUG_TYPE to be defined by the including file. Just exclude the header from
the module to unbreak the build.
Yi Kong [Wed, 22 Sep 2021 07:50:12 +0000 (15:50 +0800)]
Don't fold (select C, (gep Ptr, Idx), Ptr) if C is vector but Idx is scalar
The folding rule (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C,
Idx, 0)) creates a malformed SELECT IR if C is a vector while Idx is scalar.
SELECT VecC, ScalarIdx, 0
We could splat Idx to a vector but it defeats the purpose of
optimisation. Don't apply the folding rule in this case.
This fixes a regression from commit
d561b6fbdbe6d1da05fd92003a4ac1e37bf4b8bc.
Florian Mayer [Wed, 15 Sep 2021 09:10:11 +0000 (10:10 +0100)]
[hwasan] also omit safe mem[cpy|mov|set].
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D109816
Sander de Smalen [Wed, 22 Sep 2021 08:47:16 +0000 (09:47 +0100)]
[SelectionDAG] Make WidenVecRes_Convert work for scalable vectors.
Most of the code wasn't yet scalable safe, although most of the
code conceptually just works for scalable vectors. This change
makes the algorithm work on ElementCount, where appropriate,
and leaves the fixed-width only code to use `getFixedNumElements`.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D110058
Simon Pilgrim [Wed, 22 Sep 2021 09:08:14 +0000 (10:08 +0100)]
[LoopVectorize][X86] Add operands to make it more obvious what line the CHECK concerns
As we're checking the cost debug analysis these should match the original IR line - so we shouldn't have any variable naming issues.
I'm investigating v4i32 mul -> PMADDDW costs handling (for PR47437) and these CHECK lines were proving tricky to keep track of
Florian Hahn [Wed, 22 Sep 2021 08:30:53 +0000 (09:30 +0100)]
[VectorCombine] Switch to using a worklist.
This patch updates VectorCombine to use a worklist to allow iterative
simplifications where a combine enables other combines.
Suggested in D100302.
The main use case at the moment is foldSingleElementStore and
scalarizeLoadExtract working together to improve scalarization.
Note that we now also do not run SimplifyInstructionsInBlock on the
whole function if there have been changes. This means we fail to
remove/simplify instructions not related to any of the vector combines.
IMO this is fine, as simplifying the whole function seems more like a
workaround for not tracking the changed instructions.
Compile-time impact looks neutral:
NewPM-O3: +0.02%
NewPM-ReleaseThinLTO: -0.00%
NewPM-ReleaseLTO-g: -0.02%
http://llvm-compile-time-tracker.com/compare.php?from=
52832cd917af00e2b9c6a9d1476ba79754dcabff&to=
e66520a4637290550a945d528e3e59573485dd40&stat=instructions
Reviewed By: spatel, lebedev.ri
Differential Revision: https://reviews.llvm.org/D110171
Sander de Smalen [Tue, 21 Sep 2021 11:44:02 +0000 (12:44 +0100)]
[AArch64][SVE] Add missing load/store patterns for unpacked bfloat vectors.
Reviewed By: c-rhodes
Differential Revision: https://reviews.llvm.org/D110063
Jay Foad [Tue, 21 Sep 2021 12:03:23 +0000 (13:03 +0100)]
[AMDGPU] Convert mac/fmac to mad/fma when folding output modifiers
Use of output modifiers forces VOP3 encoding for a VOP2 mac/fmac
instruction, so we might as well convert it to the more flexible VOP3-
only mad/fma form.
With this change, the only way we should emit VOP3-encoded mac/fmac is
if regalloc chooses registers that require the VOP3 encoding, e.g. sgprs
for both src0 and src1. In all other cases the mac/fmac should either be
converted to mad/fma or shrunk to VOP2 encoding.
Differential Revision: https://reviews.llvm.org/D110156
Jay Foad [Thu, 16 Sep 2021 13:36:51 +0000 (14:36 +0100)]
[AMDGPU] Divergence-driven instruction selection for mul i32
Differential Revision: https://reviews.llvm.org/D109881
David Green [Wed, 22 Sep 2021 08:33:36 +0000 (09:33 +0100)]
[ARM] Add additional tests for VMOVL in tail predicated loops.
Dmitry Vyukov [Tue, 21 Sep 2021 11:09:31 +0000 (13:09 +0200)]
tsan: write uptime in mem profile
Write uptime in real time seconds for every mem profile record.
Uptime is useful to make more sense out of the profile,
compare random lines, etc.
Depends on D110153.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110154
Dmitry Vyukov [Tue, 21 Sep 2021 09:54:03 +0000 (11:54 +0200)]
tsan: remove stale comment
We do query it every 100ms now.
(GetRSS was fixed to not be dead slow IIRC)
Depends on D110152.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110153
Dmitry Vyukov [Tue, 21 Sep 2021 09:50:09 +0000 (11:50 +0200)]
tsan: move mem profile initialization into separate function
BackgroundThread function is quite large,
move mem profile initialization into a separate function.
Depends on D110151.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110152
Dmitry Vyukov [Tue, 21 Sep 2021 09:38:52 +0000 (11:38 +0200)]
tsan: include internal allocator info in mem profile
We allocate things from the internal allocator,
it's useful to know how much it consumes.
Depends on D110150.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110151
Dmitry Vyukov [Tue, 21 Sep 2021 09:31:18 +0000 (11:31 +0200)]
tsan: make mem profile data more consistent
We currently query number of threads before reading /proc/self/smaps.
But reading /proc/self/smaps can take lots of time for huge processes
and it's retries several times with different buffer sizes.
Overall it can take tens of seconds. This can make number of threads
significantly inconsistent with the rest of the stats.
So query it after reading /proc/self/smaps.
Depends on D110149.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110150
Dmitry Vyukov [Tue, 21 Sep 2021 08:49:32 +0000 (10:49 +0200)]
tsan: include MBlock/SyncObj stats into mem profile
Include info about MBlock/SyncObj memory consumption in the memory profile.
Depends on D110148.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110149
Dmitry Vyukov [Tue, 21 Sep 2021 08:37:33 +0000 (10:37 +0200)]
tsan: account for mid app range in mem profile
We account low and high ranges, but forgot abount the mid range.
Account mid range as well.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D110148
Sebastian Neubauer [Tue, 21 Sep 2021 14:31:00 +0000 (16:31 +0200)]
[Utils] Replace llc with cat for tests
Make the update_llc_test_checks script test independant of llc behavior
by using cat with static files to simulate llc output.
This allows changing llc without breaking the script test case.
The update script is executed in a temporary directory, so the
llc-generated assembly files are copied there. %T is deprecated, but it
allows copying a file with a predictable filename.
Differential Revision: https://reviews.llvm.org/D110143
Balázs Kéri [Wed, 22 Sep 2021 07:15:29 +0000 (09:15 +0200)]
[clang][ASTImporter] Generic attribute import handling (first step).
Import of Attr objects was incomplete in ASTImporter.
This change introduces support for a generic way of importing an attribute.
For an usage example import of the attribute AssertCapability is
added to ASTImporter.
Updating the old attribute import code and adding new attributes or extending
the generic functions (if needed) is future work.
Reviewed By: steakhal, martong
Differential Revision: https://reviews.llvm.org/D109608
Florian Hahn [Wed, 22 Sep 2021 07:19:01 +0000 (08:19 +0100)]
[InstCombine] Move InstCombineWorklist to Utils to allow reuse (NFC).
InstCombine's worklist can be re-used by other passes like
VectorCombine. Move it to llvm/Transform/Utils and rename it to
InstructionWorklist.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D110181
Diana Picus [Tue, 21 Sep 2021 08:57:38 +0000 (08:57 +0000)]
[flang] Change complex type define in runtime for clang-cl
When compiling the runtime with a version of clang-cl newer than 12, we
define CMPLXF as __builtin_complex, which returns a float _Complex type.
This errors out in contexts where the result of CMPLXF is expected to be
a float_Complex_t. This is defined as _Fcomplex whenever _MSC_VER is
defined (and as float _Complex otherwise).
This patch defines float_Complex_t & friends as _Fcomplex only when
we're using "true" MSVC, and not just clang-pretending-to-be-MSVC. This
should only affect clang-cl >= 12.
Differential Revision: https://reviews.llvm.org/D110139
Jonas Devlieghere [Wed, 22 Sep 2021 05:08:48 +0000 (22:08 -0700)]
[lldb] Add --stack option to `target symbols add` command
Currently you can ask the target symbols add command to locate the debug
symbols for the current frame. This patch add an options to do that for
the whole call stack.
Differential revision: https://reviews.llvm.org/D110011
Dmitry Vyukov [Tue, 21 Sep 2021 19:26:13 +0000 (21:26 +0200)]
tsan: prepare for trace mapping removal
Don't test for presence of the trace mapping,
it will be removed soon.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D110194