Chuanqi Xu [Fri, 22 Oct 2021 01:49:04 +0000 (09:49 +0800)]
[Coroutines] Ignore partial lifetime markers refer of an alloca
When I playing with Coroutines, I found that it is possible to generate
following IR:
```
%struct = alloca ...
%sub.element = getelementptr %struct, i64 0, i64 index ; index is not
%zero
lifetime.marker.start(%sub.element)
% use of %sub.element
lifetime.marker.end(%sub.element)
store %struct to xxx ; %struct is escaping!
<suspend points>
```
Then the AllocaUseVisitor would collect the lifetime marker for
sub.element and treat it as the lifetime markers of the alloca! So it
judges that the alloca could be put on the stack instead of the frame by
judging the lifetime markers only.
The root cause for the bug is that AllocaUseVisitor collects wrong
lifetime markers.
This patch fixes this.
Reviewed By: lxfind
Differential Revision: https://reviews.llvm.org/D112216
LLVM GN Syncbot [Fri, 22 Oct 2021 01:36:03 +0000 (01:36 +0000)]
[gn build] Port
2e97236aacbb
Vitaly Buka [Fri, 22 Oct 2021 01:34:29 +0000 (18:34 -0700)]
[libcxxabi] Fix build after D111947
Vitaly Buka [Thu, 21 Oct 2021 03:59:28 +0000 (20:59 -0700)]
[msan] Don't use TLS slots of noundef args
Transformations may strip the attribute from the
argument, e.g. for unused, which will result in
shadow offsets mismatch between caller and
callee.
Stripping noundef for used arguments can be
a problem, as TLS is not going to be set
by caller. However this is not the goal of the
patch and I am not aware if that's even
possible.
Differential Revision: https://reviews.llvm.org/D112197
Stanislav Mekhanoshin [Wed, 13 Oct 2021 22:47:07 +0000 (15:47 -0700)]
[AMDGPU] Allow to use a whole register file on gfx90a for VGPRs
In a kernel which does not have calls or AGPR usage we can allocate
the whole vector register budget for VGPRs and have no AGPRs as
long as VGPRs stay addressable (i.e. below 256).
Differential Revision: https://reviews.llvm.org/D111764
Matthias Springer [Fri, 22 Oct 2021 00:58:41 +0000 (09:58 +0900)]
[mlir][linalg][bufferize] Support scf::IfOp
This commit adds support for scf::IfOp to comprehensive bufferization. Support is currently limited to cases where both branches yield tensors that bufferize to the same buffer.
To keep the analysis simple, scf::IfOp are treated as memory writes for analysis purposes, even if no op inside any branch is writing. (scf::ForOps are handled in the same way.)
Differential Revision: https://reviews.llvm.org/D111929
Nico Weber [Thu, 21 Oct 2021 17:33:47 +0000 (13:33 -0400)]
[gn build] Make 'compiler-rt' depend on include dir
That way, the headers in llvm/utils/gn/secondary/compiler-rt/include
are copied when running `ninja compiler-rt`. (Previously, they were
only copied when running `check-hwasan` or when building the
compiler-rt/include target.)
(Since they should be copied only once, depend on the target in the
host toolchain. I think default_toolchain should work just as well,
it just needs to be a single fixed toolchain. check-hwasan depends
through host_toolchain, so let's use that here too.)
Prevents errors like
testing/fuzzed_data_provider.h:8:10: fatal error: 'fuzzer/FuzzedDataProvider.h' file not found
when building with locally-built clang. (For now, you still have to
explicitly build the 'compiler-rt' target. Maybe we should make the
clang target depend on that in the GN build?)
Differential Revision: https://reviews.llvm.org/D112238
Luís Ferreira [Fri, 22 Oct 2021 00:31:53 +0000 (17:31 -0700)]
[Demangle] Rename OutputStream to OutputString
This patch is a refactor to implement prepend afterwards. Since this changes a lot of files and to conform with guidelines, I will separate this from the implementation of prepend. Related to the discussion in https://reviews.llvm.org/D111414 , so please read it for more context.
Reviewed By: #libc_abi, dblaikie, ldionne
Differential Revision: https://reviews.llvm.org/D111947
Jonas Devlieghere [Fri, 22 Oct 2021 00:32:02 +0000 (17:32 -0700)]
[lldb] Include unistd.h for sleep in profile_vrs_detach
Jack Anderson [Fri, 22 Oct 2021 00:29:34 +0000 (17:29 -0700)]
[DebugInfo] Expand ability to load 2-byte addresses in dwarf sections
Some dwarf loaders in LLVM are hard-coded to only accept 4-byte and 8-byte address sizes. This patch generalizes acceptance into `DWARFContext::isAddressSizeSupported` and provides a common way to generate rejection errors.
The MSP430 target has been given new tests to cover dwarf loading cases that previously failed due to 2-byte addresses.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D111953
Jonas Devlieghere [Thu, 21 Oct 2021 23:45:48 +0000 (16:45 -0700)]
[lldb] Always set the minimum OS version in the Darwin builder
Tom Stellard [Thu, 21 Oct 2021 23:11:41 +0000 (16:11 -0700)]
compiler-rt: Fix arch detection for ppc64le
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D110377
Craig Topper [Thu, 21 Oct 2021 23:02:42 +0000 (16:02 -0700)]
[RISCV] Remove Zvamo C intrinsics and builtins.
Zvamo is not part of the 1.0 V spec. Remove the intrinsics
for now. This helps reduce clang binary size and lit test time.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D111692
Tom Stellard [Thu, 21 Oct 2021 23:04:51 +0000 (16:04 -0700)]
[docs] Remove Makefile.sphinx files
Does anyone still use these? I want to make some changes to the sphinx
html generation and I don't want to have to implement the changes in
two places.
Reviewed By: sylvestre.ledru, #libc, ldionne
Differential Revision: https://reviews.llvm.org/D112030
Craig Topper [Thu, 21 Oct 2021 22:23:41 +0000 (15:23 -0700)]
[TargetLowering] Simplify the interface for expandCTPOP/expandCTLZ/expandCTTZ.
There is no need to return a bool and have an SDValue output
parameter. Just return the SDValue and let the caller check if it
is null.
I have another patch to add more callers of these so I thought
I'd clean up the interface first.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D112267
Valentin Clement [Thu, 21 Oct 2021 22:25:59 +0000 (00:25 +0200)]
[fir] Remove unused function in CharacterTest
Craig Topper [Thu, 21 Oct 2021 22:16:41 +0000 (15:16 -0700)]
[LegalizeVectorOps][X86] Don't defer BITREVERSE expansion to LegalizeDAG.
By expanding early it allows the shifts to be custom lowered in
LegalizeVectorOps. Then a DAG combine is able to run on them before
LegalizeDAG handles the BUILD_VECTORS for the masks used.
v16Xi8 shift lowering on X86 requires a mask to be applied to a v8i16
shift. The BITREVERSE expansion applied an AND mask before SHL ops and
after SRL ops. This was done to share the same mask constant for both shifts.
It looks like this patch allows DAG combine to remove the AND mask added
after v16i8 SHL by X86 lowering. This maintains the mask sharing that
BITREVERSE was trying to achieve. Prior to this patch it looks like
we kept the mask after the SHL instead which required an extra constant
pool or a PANDN to invert it.
This is dependent on D112248 because RISCV will end up scalarizing the BSWAP
portion of the BITREVERSE expansion if we don't disable BSWAP scalarization in
LegalizeVectorOps first.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D112254
Stanislav Mekhanoshin [Thu, 21 Oct 2021 22:15:54 +0000 (15:15 -0700)]
[InstCombine] Precommit new and-xor-or.ll tests. NFC.
Volodymyr Sapsai [Fri, 24 Sep 2021 21:51:21 +0000 (14:51 -0700)]
[modules] Update visibility for merged ObjCInterfaceDecl definitions.
We keep using the first encountered definition and need to take into
account visibility from subsequent definitions. For example, if the
first definition is hidden and the second is visible, we need to make
the first one visible too.
rdar://
82263843
Differential Revision: https://reviews.llvm.org/D110453
Martin Storsjö [Mon, 31 May 2021 09:32:21 +0000 (09:32 +0000)]
[libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc with explanation
This test doesn't fail in mingw mode (which uses the same Itanium
name mangling and ABI as other platforms).
Differential Revision: https://reviews.llvm.org/D112210
David Blaikie [Sun, 25 Jul 2021 18:47:01 +0000 (11:47 -0700)]
PR18733: Remove -Wweak-template-vtables
It isn't really pulling its weight and I think splitting it out from
-Wweak-vtables was the wrong call: I think it was just a bug in the
original warning, which was trying to not diagnose template
instantiations, implicit or explicit.
Mogball [Thu, 21 Oct 2021 21:42:10 +0000 (21:42 +0000)]
[MLIR] Fix FloorDivSIOpConverter that was failing for index type after the arithmetic op refactor
ConstantOp should be used instead of ConstantIntOp to be able to support index type.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D112191
Matthias Kramm [Thu, 21 Oct 2021 21:41:15 +0000 (21:41 +0000)]
Make genAttributeVerifier escape the summary.
The summary can contain references to e.g. attribute defaults, which
can contain special characters. So these strings need to be C++
escaped.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D112249
David Blaikie [Thu, 21 Oct 2021 20:40:29 +0000 (13:40 -0700)]
Remove unused parallel-libs project
Differential Revision: https://reviews.llvm.org/D112265
Craig Topper [Thu, 21 Oct 2021 21:31:43 +0000 (14:31 -0700)]
[TargetLowering][RISCV] Prevent scalarization of fixed vector bswap.
It's better to do the ands, shifts, ors in the vector domain than
to scalarize it and do those operations on each element.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D112248
Matthias Kramm [Thu, 21 Oct 2021 21:30:31 +0000 (21:30 +0000)]
Fix escaping in RewriterGen.cpp.
When we escape strings for C++, make sure we use C++ escape
sequences. (In particular, \x22 instead of \22)
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D112269
Greg Clayton [Thu, 21 Oct 2021 21:21:36 +0000 (14:21 -0700)]
Fix buildbots after https://reviews.llvm.org/D111686
thomasraoux [Thu, 21 Oct 2021 21:05:27 +0000 (14:05 -0700)]
[mlir][linalg] Remove special case for contraction vectorization
Handle contraction op like all the other generic op reductions. This
simpifies the code. We now rely on contractionOp canonicalization to
keep the same code quality.
Differential Revision: https://reviews.llvm.org/D112171
thomasraoux [Thu, 21 Oct 2021 20:20:52 +0000 (13:20 -0700)]
[mlir][vector] Add patterns to convert multidimreduce to vector.contract
add several patterns that will simplify contraction vectorization in the
future. With those canonicalizationns we will be able to remove the special
case for contration during vectorization and rely on those transformations to
avoid materizalizing broadcast ops.
Differential Revision: https://reviews.llvm.org/D112121
Jessica Paquette [Mon, 4 Oct 2021 18:53:37 +0000 (11:53 -0700)]
[AArch64][GlobalISel] Fold 64-bit cmps with 64-bit adds
G_ICMP is selected to an arithmetic overflow op (ADDS/SUBS/etc) with a dead
destination + a CSINC instruction.
We have a fold which allows us to combine 32-bit adds with G_ICMP.
The problem with G_ICMP is that we model it as always having a 32-bit
destination even though it can be a 64-bit operation. So, we were missing some
opportunities for 64-bit folds.
This patch teaches the fold to recognize 64-bit G_ICMPs + refactors some of
the code surrounding CSINC accordingly.
(Later down the line, I think we should probably change the way we handle G_ICMP
in general.)
Differential Revision: https://reviews.llvm.org/D111088
Valentin Clement [Thu, 21 Oct 2021 20:40:09 +0000 (22:40 +0200)]
[fir] Remove createConcatenate test temporarily
This test is makeing one buildbot fail for unknown reason. Remove
it until we can investifate further.
Martin Storsjö [Fri, 1 Oct 2021 21:29:46 +0000 (00:29 +0300)]
[libcxx] [test] Add a specific XFAIL for a MinGW env failure that is fixed in Clang 14
This issue only occurs when linked statically in MinGW configurations,
and has been fixed for Clang 14 by https://reviews.llvm.org/D109651.
Differential Revision: https://reviews.llvm.org/D112214
Martin Storsjö [Fri, 27 Aug 2021 10:12:53 +0000 (10:12 +0000)]
[libcxx] [test] Add an XFAIL for the timespec test for MinGW targets
MinGW headers/libs lack timespec_get.
Differential Revision: https://reviews.llvm.org/D112213
David Blaikie [Thu, 21 Oct 2021 20:00:35 +0000 (13:00 -0700)]
Stanislav Mekhanoshin [Thu, 21 Oct 2021 18:45:42 +0000 (11:45 -0700)]
Add test to check we can instcombine after reassociate. NFC.
The pattern became optimized after
b92412fb286b.
Differential Revision: https://reviews.llvm.org/D112258
LLVM GN Syncbot [Thu, 21 Oct 2021 19:18:49 +0000 (19:18 +0000)]
[gn build] Port
d7b338537cf3
Greg Clayton [Wed, 20 Oct 2021 21:49:09 +0000 (14:49 -0700)]
Modify "statistics dump" to dump JSON.
This patch is a smaller version of a previous patch https://reviews.llvm.org/D110804.
This patch modifies the output of "statistics dump" to be able to get stats from the current target. It adds 3 new stats as well. The output of "statistics dump" is now emitted as JSON so that it can be used to track performance and statistics and the output could be used to populate a database that tracks performance. Sample output looks like:
(lldb) statistics dump
{
"expressionEvaluation": {
"failures": 0,
"successes": 0
},
"firstStopTime": 0.
34164492800000001,
"frameVariable": {
"failures": 0,
"successes": 0
},
"launchOrAttachTime": 0.
31969605400000001,
"targetCreateTime": 0.
0040863039999999998
}
The top level keys are:
"expressionEvaluation" which replaces the previous stats that were emitted as plain text. This dictionary contains the success and fail counts.
"frameVariable" which replaces the previous stats for "frame variable" that were emitted as plain text. This dictionary contains the success and fail counts.
"targetCreateTime" contains the number of seconds it took to create the target and load dependent libraries (if they were enabled) and also will contain symbol preloading times if that setting is enabled.
"launchOrAttachTime" is the time it takes from when the launch/attach is initiated to when the first private stop occurs.
"firstStopTime" is the time in seconds that it takes to stop at the first stop that is presented to the user via the LLDB interface. This value will only have meaning if you set a known breakpoint or stop location in your code that you want to measure as a performance test.
This diff is also meant as a place to discuess what we want out of the "statistics dump" command before adding more funcionality. It is also meant to clean up the previous code that was storting statistics in a vector of numbers within the lldb_private::Target class.
Differential Revision: https://reviews.llvm.org/D111686
Yonghong Song [Tue, 21 Sep 2021 06:35:58 +0000 (23:35 -0700)]
BPF: emit BTF_KIND_DECL_TAG for typedef types
If a typedef type has __attribute__((btf_decl_tag("str"))) with
bpf target, emit BTF_KIND_DECL_TAG for that type in the BTF.
Differential Revision: https://reviews.llvm.org/D112259
Volodymyr Sapsai [Fri, 24 Sep 2021 20:57:23 +0000 (13:57 -0700)]
[modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.
With the old approach we were updating `ObjCInterfaceType.Decl` to the
last encountered definition. But during loading modules
`ASTDeclReader::VisitObjCInterfaceDecl` keeps the *first* encountered
definition. So with multiple definitions imported there would be a
disagreement between expected definition in `ObjCInterfaceType.Decl` and
actual definition `ObjCInterfaceDecl::getDefinition` which can lead to
incorrect diagnostic.
Fix by not tracking definition in `ObjCInterfaceType` explicitly but by
getting it from redeclaration chain.
Partially reverted
919fc50034b44c48aae8b80283f253ec2ee17f45 keeping the
modified test case as the correct behavior is achieved in a different
way.
Differential Revision: https://reviews.llvm.org/D110452
AndreyChurbanov [Thu, 21 Oct 2021 18:51:33 +0000 (21:51 +0300)]
[OpenMP][NFC] skip atomic tests for non-x86 arch
Nikita Popov [Thu, 21 Oct 2021 18:47:13 +0000 (20:47 +0200)]
[InstCombine] Add additional store forwarding test (NFC)
Variant where the load is larger than the store. Make sure we
don't forward this.
Arthur Eubanks [Thu, 21 Oct 2021 18:14:29 +0000 (11:14 -0700)]
[test] Make sure plugin actually runs in clear-ast-before-backend-plugins.c
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D112253
David Blaikie [Wed, 20 Oct 2021 18:05:40 +0000 (11:05 -0700)]
Enable libc++ in the build for libcxx initializerlist pretty printers
Differential Revision: https://reviews.llvm.org/D112163
David Blaikie [Thu, 14 Oct 2021 21:52:47 +0000 (14:52 -0700)]
Recommit: Compress formatting of array type names (int [4] -> int[4])
Based on post-commit review discussion on
2bd84938470bf2e337801faafb8a67710f46429d with Richard Smith.
Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
they're all around pointer/reference types where the pointer/reference
token will appear at the rightmost side of the left side of the type
name, so they make nested types (eg: the "int" in "int *") behave as
though there is a non-empty placeholder (because the "*" is essentially
the placeholder as far as the "int" is concerned).
This was originally committed in
277623f4d5a672d707390e2c3eaf30a9eb4b075c
Reverted in
f9ad1d1c775a8e264bebc15d75e0c6e5c20eefc7 due to breakages
outside of clang - lldb seems to have some strange/strong dependence on
"char [N]" versus "char[N]" when printing strings (not due to that name
appearing in DWARF, but probably due to using clang to stringify type
names) that'll need to be addressed, plus a few other odds and ends in
other subprojects (clang-tools-extra, compiler-rt, etc).
Fangrui Song [Thu, 21 Oct 2021 18:32:29 +0000 (11:32 -0700)]
[Triple] Don't repeat the function name in comments. NFC
Nikita Popov [Tue, 19 Oct 2021 19:05:09 +0000 (21:05 +0200)]
[CodeMetrics] Don't require speculatability for ephemeral values
As discussed in D112016, our current requirement of speculatability
for ephemeral is overly strict: What we really care about is that
the instruction will be DCEd once the assume is dropped. For that
it is sufficient that the instruction is side-effect free and not
a terminator.
In particular, this allows non-dereferenceable loads to be ephemeral
values.
Differential Revision: https://reviews.llvm.org/D112179
Kirill Bobyrev [Thu, 21 Oct 2021 18:13:37 +0000 (20:13 +0200)]
Follow-up on https://github.com/llvm/llvm-project/commit/
88303693ce97cf842f0714068c2cae44cd6515e1
Use hash code instead of unsigned for the hash return value.
Pirama Arumuga Nainar [Thu, 21 Oct 2021 17:56:43 +0000 (10:56 -0700)]
Revert "[compiler-rt/profile] Hide __llvm_profile_raw_version"
This reverts commit
69708477be258dbea2711f6a35c02685659b49d3 to unblock
instrprof-darwin-exports.c failure on MacOS bots.
Craig Topper [Thu, 21 Oct 2021 16:44:59 +0000 (09:44 -0700)]
[RISCV] Expand scalable vector CTTZ/CTLZ/CTPOP.
Differential Revision: https://reviews.llvm.org/D112233
Arthur Eubanks [Thu, 21 Oct 2021 17:48:41 +0000 (10:48 -0700)]
Revert "[IPT] Restructure cache to allow lazy update following invalidation [NFC]"
This reverts commit
baea663a6e9bc52f80995d02bb8149934c825612.
Causes crashes, e.g. https://lab.llvm.org/buildbot/#/builders/77/builds/10715.
Aaron Ballman [Thu, 21 Oct 2021 17:38:02 +0000 (13:38 -0400)]
Add the papers that were applied to the latest C2x working draft
Petr Hosek [Thu, 21 Oct 2021 17:32:01 +0000 (10:32 -0700)]
Revert "[CMake] Cache the compiler-rt library search results"
This reverts commit
0eed292fbae22a8856682b07e1cb968424b49941, there
are compiler-rt build failures that appear to have been introduced
by this change.
Florian Hahn [Thu, 16 Sep 2021 15:49:52 +0000 (16:49 +0100)]
[SLP] Add additional tests which caused crashes with versioning.
River Riddle [Thu, 21 Oct 2021 17:07:18 +0000 (17:07 +0000)]
[mlir:GreedyPatternRewriter] Add debug logging for pattern rewriter actions
This effectively mirrors the logging in dialect conversion, which has proven
very useful for understanding the pattern application process.
Differential Revision: https://reviews.llvm.org/D112120
River Riddle [Thu, 21 Oct 2021 17:07:07 +0000 (17:07 +0000)]
[NFC] Clean up a few methods within GreedyPatternRewriter
Move a few methods out of line and clean up comments.
Ahmed Taei [Wed, 20 Oct 2021 00:56:55 +0000 (17:56 -0700)]
Avoid infinity arithmetics when computing exp approximations
Otherwise this can result a poison value on some platforms see https://bugs.llvm.org/show_bug.cgi?id=51204
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D112115
Ben Langmuir [Thu, 21 Oct 2021 17:01:23 +0000 (10:01 -0700)]
[test][ORC-RT] Disable x86_64 tests when target arch does not match
When cross-compiling, these tests will fail. For now leave the host arch
check that was already there since I don't know why it was added.
Valentin Clement [Thu, 21 Oct 2021 16:44:47 +0000 (18:44 +0200)]
[fir] Add Character helper
This patch is extracted from D111337. It introduce the
CharacterExprHelper that helps dealing with character in FIR.
Reviewed By: schweitz, awarzynski
Differential Revision: https://reviews.llvm.org/D112140
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Sanjay Patel [Thu, 21 Oct 2021 16:21:37 +0000 (12:21 -0400)]
[VectorCombine] fold shuffle-of-binops with common operand
shuf (bo X, Y), (bo X, W) --> bo (shuf X), (shuf Y, W)
This is motivated by an example in D111800
(although that patch avoids the problem for that particular example).
The pattern is shown in reduced form with:
https://llvm.org/PR52178
https://alive2.llvm.org/ce/z/d8zB4D
There is no difference on the PhaseOrdering test from D111800
because the aarch64 cost model says that the shuffle cost is 3 while
the fadd cost is 2.
Differential Revision: https://reviews.llvm.org/D111901
Arthur Eubanks [Wed, 6 Oct 2021 20:57:29 +0000 (13:57 -0700)]
Reland [clang] Pass -clear-ast-before-backend in Clang::ConstructJob()
This clears the memory used for the Clang AST before we run LLVM passes.
https://llvm-compile-time-tracker.com/compare.php?from=
d0a5f61c4f6fccec87fd5207e3fcd9502dd59854&to=
b7437fee79e04464dd968e1a29185495f3590481&stat=max-rss
shows significant memory savings with no slowdown (in fact -O0 slightly speeds up).
For more background, see
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068930.html.
Turn this off for the interpreter since it does codegen multiple times.
Relanding with fix for -print-stats: D111973
Relanding with fix for plugins: D112190
If you'd like to use this even with plugins, consider using the features
introduced in D112096.
This can be turned off with -Xclang -no-clear-ast-before-backend.
Differential Revision: https://reviews.llvm.org/D111270
Fraser Cormack [Thu, 21 Oct 2021 14:21:38 +0000 (15:21 +0100)]
[RISCV] Add a test showing incorrect VSETVLI insertion
This test case, reduced from an internal test failure, shows how we may
incorrectly skip the insertion of VSETVLI instructions when doing
cross-basic-block analysis.
The entry block ends in a `e32,mf2`. Its single successor, %bb.1, ends with a
`e8,mf8`, but for a mask-type instruction, so is considered compatible.
This means that the info %bb.1 is merged into its predecessor so
produces a `e32,mf2`. When it comes to the last block, which requires a
`e32,mf2`, we skip the insertion of a vsetvli because all predecessors
were determined to preserve the right vtype.
However, when %bb.1 is actually laid out it does actually need a
`e8,mf8` vsetvli, since the previous instruction has a different tail
policy. This means that when execution flows from %bb.1 to %bb.3, the
`vadd.vx` is misconfigured.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D112223
Philip Reames [Thu, 21 Oct 2021 16:15:08 +0000 (09:15 -0700)]
[IPT] Restructure cache to allow lazy update following invalidation [NFC]
This change restructures the cache used in IPT to point not to the first special instruction, but to the first instruction which *could* be special. That is, the cached reference is always equal to the first special, or comes before it in the block.
This avoids expensive block scans when we are removing special instructions from the beginning of the block. At the moment, this case is not heavily used, though it does trigger in GVN when doing CSE of calls. The main motivation was a change I'm no longer planning to move forward with, but the cache optimization seemed worthwhile as a minor perf win at low cost.
Differential Revision: https://reviews.llvm.org/D111768
Aaron Ballman [Thu, 21 Oct 2021 16:14:44 +0000 (12:14 -0400)]
Update the title and encoding for the C++ status page
Aaron Ballman [Thu, 21 Oct 2021 16:13:19 +0000 (12:13 -0400)]
Update the C++ and C status pages now that Clang 13 has been released
Arthur Eubanks [Wed, 20 Oct 2021 22:43:10 +0000 (15:43 -0700)]
[clang] Don't clear AST if we have consumers running after the main action
Downstream users may have Clang plugins. By default these plugins run
after the main action if they are specified on the command line.
Since these plugins are ASTConsumers, presumably they inspect the AST.
So we shouldn't clear it if any plugins run after the main action.
Reviewed By: dblaikie, hans
Differential Revision: https://reviews.llvm.org/D112190
Ben Langmuir [Wed, 20 Oct 2021 17:37:32 +0000 (10:37 -0700)]
Reapply [ORC-RT] Configure the ORC runtime for more architectures and platforms
Reapply
5692ed0cce8c95, but with the ORC runtime disabled explicitly on
CrossWinToARMLinux to match the other compiler-rt runtime libraries.
Differential Revision: https://reviews.llvm.org/D112229
---
Enable building the ORC runtime for 64-bit and 32-bit ARM architectures,
and for all Darwin embedded platforms (iOS, tvOS, and watchOS). This
covers building the cross-platform code, but does not add TLV runtime
support for the new architectures, which can be added independently.
Incidentally, stop building the Mach-O TLS support file unnecessarily on
other platforms.
Differential Revision: https://reviews.llvm.org/D112111
Kazu Hirata [Thu, 21 Oct 2021 15:58:19 +0000 (08:58 -0700)]
[clang] Use StringRef::contains (NFC)
Yonghong Song [Tue, 21 Sep 2021 00:08:46 +0000 (17:08 -0700)]
[DebugInfo] Support typedef with btf_decl_tag attributes
Clang patch ([1]) added support for btf_decl_tag attributes with typedef
types. This patch added llvm support including dwarf generation.
For example, for typedef
typedef unsigned * __u __attribute__((btf_decl_tag("tag1")));
__u u;
the following shows llvm-dwarfdump result:
0x00000033: DW_TAG_typedef
DW_AT_type (0x00000048 "unsigned int *")
DW_AT_name ("__u")
DW_AT_decl_file ("/home/yhs/work/tests/llvm/btf_tag/t.c")
DW_AT_decl_line (1)
0x0000003e: DW_TAG_LLVM_annotation
DW_AT_name ("btf_decl_tag")
DW_AT_const_value ("tag1")
0x00000047: NULL
[1] https://reviews.llvm.org/D110127
Differential Revision: https://reviews.llvm.org/D110129
Yonghong Song [Tue, 21 Sep 2021 02:53:19 +0000 (19:53 -0700)]
[Clang] Support typedef with btf_decl_tag attributes
Previously, btf_del_tag attribute supports record, field, global variable,
function and function parameter ([1], [2]). This patch added support for typedef.
The main reason is for typedef of an anonymous struct/union, we can only apply
btf_decl_tag attribute to the anonymous struct/union like below:
typedef struct { ... } __btf_decl_tag target_type
In this case, the __btf_decl_tag attribute applies to anonymous struct,
which increases downstream implementation complexity. But if
typedef with btf_decl_tag attribute is supported, we can have
typedef struct { ... } target_type __btf_decl_tag
which applies __btf_decl_tag to typedef "target_type" which make it
easier to directly associate btf_decl_tag with a named type.
This patch permitted btf_decl_tag with typedef types with this reason.
[1] https://reviews.llvm.org/D106614
[2] https://reviews.llvm.org/D111588
Differential Revision: https://reviews.llvm.org/D110127
Mark de Wever [Sun, 10 Oct 2021 13:40:50 +0000 (15:40 +0200)]
[libc++] Use addressof in vector.
This addresses the usage of `operator&` in `<vector>`.
I now added tests for the current offending cases. I wonder whether it
would be better to add one addressof test per directory and test all
possible violations. Also to guard against possible future errors?
(Note there are still more headers with the same issue.)
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D111961
Jez Ng [Thu, 21 Oct 2021 15:23:34 +0000 (11:23 -0400)]
[lld-macho] Simplify lc-linker-option.ll and re-enable it on Windows
While attempting to simplify it, I discovered a concerning discrepancy
between our handling of LC_LINKER_OPTION vs ld64's. In particular, ld64
does not appear to check for `-all_load` nor `-ObjC` when processing
those options. Thus, if/when we fix this behavior, no duplicate symbol
error will be expected regardless of the use-after-free. As such, I've
removed the test logic that tries to induce the duplicate symbol error.
We can just rely on ASAN to do the verification.
In order to make the test run on Windows, I've removed the symlink
logic. Both ld64 and LLD handle this un-symlinked framework just fine.
I also capitalized the framework name, since that's the typical
convention.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D112195
Lang Hames [Wed, 20 Oct 2021 20:51:50 +0000 (13:51 -0700)]
[ORC-RT] Remove stray printf debugging output.
These were accidentally picked up in an earlier commit.
Nicolas Vasilache [Wed, 20 Oct 2021 19:51:21 +0000 (19:51 +0000)]
[mlir][Linalg] Improve conv vectorization for the stride==1 case.
In the stride == 1 case, conv1d reads contiguous data along the input dimension. This can be advantageaously used to bulk memory transfers and compute while avoiding unrolling. Experimentally, this can yield speedups of up to 50%.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D112139
Jon Chesterfield [Thu, 21 Oct 2021 15:14:28 +0000 (16:14 +0100)]
[libomptarget][DeviceRTL] Generalise and simplify cmakelists
Step towards building the DeviceRTL for amdgpu.
Mostly replaces cuda-specific toolchain finding logic with the
generic logic currently found in the amdgpu deviceRTL cmake. Also
deletes dead code and changes the default to build on systems
without cuda installed, as the library doesn't use cuda and the
amdgpu-only systems generally won't have cuda installed.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D111983
Sanjay Patel [Thu, 21 Oct 2021 14:37:16 +0000 (10:37 -0400)]
[InstCombine] generalize reassociated Demorgan folds
This updates the recent D112108 /
b92412fb286be26d
to handle the flipped logic ('or') sibling:
https://alive2.llvm.org/ce/z/Y2L6Ch
Sanjay Patel [Thu, 21 Oct 2021 14:07:01 +0000 (10:07 -0400)]
[InstCombine] add tests for DeMorgan with reassociation; NFC
These are direct mutations of the tests added for D112108 -
we should handle the sibling folds for 'or'.
Kirill Bobyrev [Thu, 21 Oct 2021 14:21:10 +0000 (16:21 +0200)]
Do not downcast uint64_t to unsigned in UniqueID hash computation
Context: https://reviews.llvm.org/D110925#inline-1070046
Louis Dionne [Tue, 12 Oct 2021 19:59:08 +0000 (15:59 -0400)]
[runtimes] Properly handle the sysroot/triple/gcc-toolchain
In 395271a, I simplified how we handled the target triple for the
runtimes. However, in doing so, we stopped considering the default
in CMAKE_CXX_COMPILER_TARGET, so we'd use the LLVM_DEFAULT_TARGET_TRIPLE
(which is the host triple) even if CMAKE_CXX_COMPILER_TARGET was specified.
This commit fixes that problem and also refactors the code so that it's
easy to see what the default value is.
The fact that nobody seems to have been broken by this makes me think
that perhaps nobody is using CMAKE_CXX_COMPILER_TARGET to specify the
triple -- but it should still work.
Differential Revision: https://reviews.llvm.org/D111672
Anirudh Prasad [Thu, 21 Oct 2021 13:48:21 +0000 (09:48 -0400)]
[SystemZ][z/OS] Initial implementation for lowerCall on z/OS
- This patch provides the initial implementation for lowering a call on z/OS according to the XPLINK64 calling convention
- A series of changes have been made to SystemZCallingConv.td to account for these additional XPLINK64 changes including adding a new helper function to shadow the stack along with allocation of a register wherever appropriate
- For the cases of copying a f64 to a gr64 and a f128 / 128-bit vector type to a gr64, a `CCBitConvertToType` has been added and has been bitcasted appropriately in the lowering phase
- Support for the ADA register (R5) will be provided in a later patch.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D111662
Sanjay Patel [Thu, 21 Oct 2021 13:06:37 +0000 (09:06 -0400)]
[DAGCombiner] fold bit-hack form of usubsat
(i8 X ^ 128) & (i8 X s>> 7) --> usubsat X, 128
I haven't found a generalization of this identity:
https://alive2.llvm.org/ce/z/_sriEQ
Note: I was actually looking at the first form of the pattern in that link,
but that's part of a long chain of potential missed transforms in codegen
and IR....that I hope ends here!
The predicates for when this is profitable are a bit tricky. This version of
the patch excludes multi-use but includes custom lowering (as opposed to
legal only).
On x86 for example, we have custom lowering for some vector types, and that
uses umax and sub. So to enable that fold, we need add use checks to avoid
regressions. Even with legal-only lowering, we could see code with extra
reg move instructions for extra uses, so that constraint would have to be
eased very carefully to avoid penalties.
Differential Revision: https://reviews.llvm.org/D112085
Anirudh Prasad [Thu, 21 Oct 2021 13:45:33 +0000 (09:45 -0400)]
[SystemZ][z/OS] Additional test coverage for validating dialect instructions for SystemZ
- There are certain instructions most notably those with extended mnemonics that restricted to only the gnu/att variant
- There are also certain instruction aliases/mnemonic aliases that are restricted only to the HLASM variant (see https://reviews.llvm.org/D97581, https://reviews.llvm.org/D94250 and https://reviews.llvm.org/D92185 for reference)
- This patch adds a few tests to check for the behaviour introduced in the above patches. The testing coverage could not be added in at the same time, due to parallel work being done introducing the HLASM syntax
Reviewed By: uweigand, abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D112172
Alexey Bataev [Wed, 15 Sep 2021 14:47:17 +0000 (07:47 -0700)]
[SLP]Unify vectorization of PHI and store nodes with improved tiny tree vectorization.
Vectorization of PHIs and stores very similar, it might be beneficial to
try to revectorize stores (like PHIs) if the total number of stores with
the same/alternate opcode is less than the vector size but number of
stores with the same type is larger than the vector size.
Differential Revision: https://reviews.llvm.org/D109831
Matthias Springer [Thu, 21 Oct 2021 13:16:36 +0000 (22:16 +0900)]
[mlir][linalg][bufferize] Fix bufferizesToMemoryWrite for TiledLoopOp
This is the same fix as for scf.for.
Differential Revision: https://reviews.llvm.org/D112218
Matthias Springer [Thu, 21 Oct 2021 12:54:54 +0000 (21:54 +0900)]
[mlir][linalg][bufferize] Fix bug in getInplaceableOpResult
Differential Revision: https://reviews.llvm.org/D112123
Matthias Springer [Thu, 21 Oct 2021 12:45:34 +0000 (21:45 +0900)]
[mlir][linalg][bufferize] Avoid creating copies that are never read
Differential Revision: https://reviews.llvm.org/D111956
Matthias Springer [Thu, 21 Oct 2021 12:33:07 +0000 (21:33 +0900)]
[mlir][linalg][bufferize] Eliminate InitTensorOps of InsertSliceOp sources
An InitTensorOp is replaced with an ExtractSliceOp on the InsertSliceOp's destination. This optimization is applied after analysis and only to InsertSliceOps that were decided to bufferize inplace. Another analysis on the new ExtractSliceOp is needed after the rewrite.
Differential Revision: https://reviews.llvm.org/D111955
Jon Chesterfield [Thu, 21 Oct 2021 12:09:55 +0000 (13:09 +0100)]
Relax assert in ExprConstant to a return None.
Fixes a compiler assert on passing a compile time integer to atomic builtins.
Assert introduced in D61522
Function changed from ->bool to ->Optional in D76646
Simplifies call sites to getIntegerConstantExpr to elide the now-redundant
isValueDependent checks.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D112159
Jan Svoboda [Thu, 21 Oct 2021 11:10:18 +0000 (13:10 +0200)]
[clang][deps] Make resource directory deduction configurable
The `clang-scan-deps` CLI tool invokes the compiler with `-print-resource-dir` in case the `-resource-dir` argument is missing from the compilation command line. This is to enable running the tool on compilation databases that use compiler from a different toolchain than `clang-scan-deps` itself. While this doesn't make sense when scanning modular builds (due to the `-cc1` arguments the tool generates), the tool can can be used to efficiently scan for file dependencies of non-modular builds too.
This patch stops deducing the resource directory by invoking the compiler by default. This mode can still be enabled by invoking `clang-scan-deps` with `--resource-dir-recipe invoke-compiler`. The new default is `--resource-dir-recipe modify-compiler-path` which relies on the resource directory deduction taking place in `Driver::Driver` which is based on the compiler path. This makes the default more aligned with the intended usage of the tool while still allowing it to serve other use-cases.
Note that this functionality was also influenced by D108979, where the dependency scanner stopped going through `ClangTool::run`. The function tried to deduce the resource directory based on the current executable path, which might not be what the users expect when invoked from within a shared library.
Depends on D108979.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D108366
Pavel Labath [Thu, 21 Oct 2021 12:01:24 +0000 (14:01 +0200)]
[lldb] Fix a thinko in
2ace1e57
An empty plugin name means we should try everything.
Picked up by the windows bot.
Kerry McLaughlin [Thu, 21 Oct 2021 10:30:31 +0000 (11:30 +0100)]
[SVE] Fix selection failure when splitting extended masked loads
When splitting a masked load, `GetDependentSplitDestVTs` is used to get the
MemVTs of the high and low parts. If the masked load is extended, this
may return VTs with different element types which are used to create the
high & low masked load instructions.
This patch changes `GetDependentSplitDestVTs` to ensure we return VTs with
the same element type.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D111996
YunQiang Su [Thu, 21 Oct 2021 07:46:22 +0000 (10:46 +0300)]
[MIPS] Fix switching between 32/64-bit variants of r6 target triples
If clang driver gets 64-bit r6 target triple like `mipsisa64r6` and
additional option forces switching to generation of 32-bit code, it
loses r6 abi and generates 32-bit r2-r5 abi code.
```
$ clang -target mipsisa64r6-linux-gnu -mabi=32
```
This patch fixes the problem.
- Add optional `SubArchType` argument to the `Triple::setArch()` method.
- Implement generation of mips r6 target triples in the
`Triple::getArchName()` method.
Differential Revision: https://reviews.llvm.org/D110514.diff
David Green [Thu, 21 Oct 2021 12:03:18 +0000 (13:03 +0100)]
[ARM] Add new abs test. NFC
Jan Svoboda [Thu, 21 Oct 2021 11:51:22 +0000 (13:51 +0200)]
[clang][deps] NFC: Rename building CompilerInvocation
The dependency scanner works with multiple instances of `Compiler{Instance,Invocation}`. From names of the variables/members, their purpose is not obvious.
This patch gives descriptive name to the generated `CompilerInvocation` that can be used to derive the command-line to build a modular dependency.
Depends on D111725.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D111728
Jan Svoboda [Thu, 21 Oct 2021 11:50:57 +0000 (13:50 +0200)]
[clang][deps] NFC: Rename scanning CompilerInstance
The dependency scanner works with multiple instances of `Compiler{Instance,Invocation}`. From names of the variables/members, their purpose is not obvious.
This patch gives a distinct name to the `CompilerInstance` that's used to run the implicit build during dependency scan.
Depends on D111724.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D111725
Jan Svoboda [Thu, 21 Oct 2021 11:50:42 +0000 (13:50 +0200)]
[clang][deps] NFC: Remove redundant CompilerInstance reference
The `ModuleDepCollectorPP` class holds a reference to `ModuleDepCollector` as well as `ModuleDepCollector`'s `CompilerInstance`. The fact that these refer to the same object is non-obvious.
This patch removes the `CompilerInvocation` reference from `ModuleDepCollectorPP` and accesses it through `ModuleDepCollector` instead.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D111724
Jan Svoboda [Thu, 21 Oct 2021 11:28:05 +0000 (13:28 +0200)]
[clang][deps] Ensure reported context hash is strict
One of main goals of the dependency scanner is to be strict about module compatibility. This is achieved through strict context hash. This patch ensures that strict context hash is enabled not only during the scan itself (and its minimized implicit build), but also when actually reporting the dependency.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D111720
Aaron Ballman [Thu, 21 Oct 2021 11:08:18 +0000 (07:08 -0400)]
Revert "AddGlobalAnnotations for function with or without function body."
This reverts commit
121b2252de0eed68f2ddf5f09e924a6c35423d47.
The following code causes a crash in some circumstances:
struct k {
~k() __attribute__((annotate(""))) {}
};
void m() { k(); }
Benjamin Kramer [Thu, 21 Oct 2021 10:58:10 +0000 (12:58 +0200)]
[lldb] Silence -Wpessimizing-move warning
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3635:10: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
return std::move(merged);
^
Pavel Labath [Mon, 18 Oct 2021 08:39:58 +0000 (10:39 +0200)]
[lldb] Remove ConstString from GetPluginNameStatic of some plugins
This patch deals with ObjectFile, ObjectContainer and OperatingSystem
plugins. I'll convert the other types in separate patches.
In order to enable piecemeal conversion, I am leaving some ConstStrings
in the lowest PluginManager layers. I'll convert those as the last step.
Differential Revision: https://reviews.llvm.org/D112061
Benjamin Kramer [Thu, 21 Oct 2021 09:57:16 +0000 (11:57 +0200)]
[mlir] Fix a crash when creating a 1d zero element LLVM constant
Fixes a regression introduced in
f9be7a7afda3c90b99c9f50e5eff1624da5a6511
Differential Revision: https://reviews.llvm.org/D112208