Martin Storsjö [Sat, 13 Jun 2020 20:04:40 +0000 (23:04 +0300)]
[clang] Enable -mms-bitfields by default for mingw targets
This matches GCC, which enabled -mms-bitfields by default for
mingw targets in 4.7 [1].
[1] https://www.gnu.org/software/gcc/gcc-4.7/changes.html
Differential Revision: https://reviews.llvm.org/D81795
Martin Storsjö [Sat, 13 Jun 2020 19:29:52 +0000 (22:29 +0300)]
[clang] Don't emit warn_cxx_ms_struct when MSBitfields is enabled globally
This diagnostic (which defaults to an error, added in
95833f33bda6c92e746e0b0007b69c2c30bfc693) was intended to clearly
point out cases where the C++ ABI won't match the Microsoft C++ ABI,
for cases when this is enabled via a pragma over a region of code.
The MSVC compatible struct layout feature can also be enabled via a
compiler option (-mms-bitfields). If enabled that way, one essentially
can't compile any C++ code unless also building with
-Wno-incompatible-ms-struct (which GCC doesn't support, and projects
developed with GCC aren't setting).
For the MinGW target, it's expected that the C++ ABI won't match
the MSVC one, if this option is used for getting the struct
layout to match MSVC.
Differential Revision: https://reviews.llvm.org/D81794
Martin Storsjö [Sat, 30 May 2020 21:05:13 +0000 (00:05 +0300)]
[clang] [MinGW] Link kernel32 once after the last instance of msvcrt
The msvcrt library isn't a pure import library; it does contain
regular object files with wrappers/fallbacks, and these can require
linking against kernel32.
This only makes a difference when linking with ld.bfd, as lld
always searches all static libraries.
This matches a similar change made recently in gcc in
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=
850533ab160ef40eccfd039e1e3b138cf26e76b8,
although clang adds --start-group --end-group around these libraries
if -static is specified, which gcc doesn't. But try to match gcc's
linking order in any case, for consistency.
Differential Revision: https://reviews.llvm.org/D80880
Igor Kudrin [Wed, 17 Jun 2020 05:57:54 +0000 (12:57 +0700)]
[DebugInfo] Support parsing and dumping of DWARF64 macro units.
Differential Revision: https://reviews.llvm.org/D81844
Sameer Sahasrabuddhe [Wed, 17 Jun 2020 02:44:50 +0000 (08:14 +0530)]
[DA] propagate loop live-out values that get used in a branch
Values that are uniform within a loop but appear divergent to uses
outside the loop are "tainted" so that such uses are marked
divergent. But if such a use is a branch, then it's divergence needs
to be propagated. The simplest way to do that is to put the branch
back in the main worklist so that it is processed appropriately.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D81822
Itay Bookstein [Tue, 16 Jun 2020 23:17:27 +0000 (16:17 -0700)]
[IR] Add missing GlobalAlias copying of ThreadLocalMode attribute
Summary:
Previously, GlobalAlias::copyAttributesFrom did not preserve ThreadLocalMode,
causing incorrect IR generation in IR linking flows. This patch pushes the code
responsible for copying this attribute from GlobalVariable::copyAttributesFrom
down to GlobalValue::copyAttributesFrom so that it is shared by GlobalAlias.
Fixes PR46297.
Reviewers: tejohnson, pcc, hans
Reviewed By: tejohnson, hans
Subscribers: hiraditya, ibookstein, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81605
Matt Arsenault [Wed, 17 Jun 2020 02:38:33 +0000 (22:38 -0400)]
AMDGPU/GlobalISel: Fix obvious bug in ported 32-bit udiv/urem
This was hidden by the IR expansion in AMDGPUCodeGenPrepare, which I
forgot to turn off.
Richard Smith [Tue, 16 Jun 2020 23:55:56 +0000 (16:55 -0700)]
DR458: Search template parameter scopes in the right order.
C++ unqualified name lookup searches template parameter scopes
immediately after finishing searching the entity the parameters belong
to. (Eg, for a class template, you search the template parameter scope
after looking in that class template and its base classes and before
looking in the scope containing the class template.) This is complicated
by the fact that scope lookup within a template parameter scope looks in
a different sequence of places prior to reaching the end of the
declarator-id in the template declaration.
We used to approximate the proper lookup rule with a hack in the scope /
decl context walk inside name lookup. Now we instead compute the lookup
parent for each template parameter scope. This gets the right answer and
as a bonus is substantially simpler and more uniform.
In order to get this right, we now make sure to enter a distinct Scope
for each template parameter scope. (The fact that we didn't before was
already a bug, but not really observable most of the time, since
template parameters can't shadow each other.)
Richard Smith [Wed, 17 Jun 2020 02:27:54 +0000 (19:27 -0700)]
Don't assert if we find a dependently-typed variable in the
redeclaration chain for an array.
A prior attempt to fix this in r280330 didn't handle the case where the
old variable is dependent and the new one is not.
It is notable and worrying that the test case in this example forms a
redeclaration chain for a non-dependent variable that includes a
declaration with a dependent type. We should probably fix that too.
Chen Zheng [Mon, 15 Jun 2020 08:03:32 +0000 (04:03 -0400)]
[PowerPC] remove wrong added FIXME in testcases, NFC
remove the wrong added comments as xsmaddasp is introduced in PWR8
Jez Ng [Wed, 17 Jun 2020 00:27:28 +0000 (17:27 -0700)]
[lld-macho] Use uint64_t for getSize() instead of size_t
Summary:
So things work on 32-bit machines. (@vzakhari reported the
breakage starting from D80177).
Reviewers: #lld-macho, vzakhari
Subscribers: llvm-commits, vzakhari
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81982
Xing GUO [Wed, 17 Jun 2020 01:29:04 +0000 (09:29 +0800)]
[ObjectYAML][DWARF] Let writeVariableSizedInteger() return Error.
This patch helps change the return type of `writeVariableSizedInteger()` from `void` to `Error`.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D81915
Matt Arsenault [Wed, 17 Jun 2020 00:45:15 +0000 (20:45 -0400)]
AMDGPU: Remove intermediate DAG node for trig_preop intrinsic
We weren't doing anything with this, and keeping it would just add
more boilerplate for GlobalISel.
Fangrui Song [Wed, 17 Jun 2020 00:57:59 +0000 (17:57 -0700)]
[lld-macho][test] Fix dylink-lazy.s after
0a5228a02c32cb5b10d43cb154d6d0abaf360ba7
Fangrui Song [Wed, 17 Jun 2020 00:46:22 +0000 (17:46 -0700)]
[builtins][test] Delete unneeded file headers
We don't add file headers to tests. The comments are useless as well -
their purpose can be easily inferred from the filenames.
Jun Ma [Tue, 16 Jun 2020 06:30:36 +0000 (14:30 +0800)]
[CodeGen][TLS] Set TLS Model for __tls_guard as well.
Differential Revision: https://reviews.llvm.org/D81543
Saleem Abdulrasool [Wed, 17 Jun 2020 00:05:29 +0000 (17:05 -0700)]
test: add library search path to repair the test
Update the test to no longer rely on the testing workaround in the
linker and use the external libSystem stub.
Daniel Sanders [Tue, 16 Jun 2020 21:52:50 +0000 (14:52 -0700)]
[gicombiner] Allow disable-rule option to disable all-except-...
Summary:
Adds two features to the generated rule disable option:
- '*' - Disable all rules
- '!<foo>' - Re-enable rule(s)
- '!foo' - Enable rule named 'foo'
- '!5' - Enable rule five
- '!4-9' - Enable rule four to nine
- '!foo-bar' - Enable rules from 'foo' to (and including) 'bar'
(the '!' is available to the generated disable option but is not part of the underlying and determines whether to call setRuleDisabled() or setRuleEnabled())
This is intended to support unit testing of combine rules so
that you can do:
GeneratedCfg.setRuleDisabled("*")
GeneratedCfg.setRuleEnabled("foo")
to ensure only a specific rule is in effect. The rule is still
required to be included in a combiner though
Also added --...-only-enable-rule=X,Y which is effectively an
alias for --...-disable-rule=*,!X,!Y and as such interacts
properly with disable-rule.
Reviewers: aditya_nandakumar, bogner, volkan, aemerson, paquette, arsenm
Subscribers: wdng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81889
Lucy Fox [Tue, 16 Jun 2020 22:23:10 +0000 (15:23 -0700)]
[MLIR] Add an Op util which returns its name with the dialect stripped.
Differential Revision: https://reviews.llvm.org/D81435
Christopher Tetreault [Tue, 16 Jun 2020 22:49:32 +0000 (15:49 -0700)]
[SVE] Generalize size checks in Verifier to use getElementCount
Summary:
Attempts to call getNumElements on scalable vectors identified by test
LLVM.Other::scalable-vectors-core-ir.ll. Since these checks are all
attempting to find if two vectors are the same size, calling
getElementCount will only increase safety.
Reviewers: efriedma, aprantl, reames, kmclaughlin, sdesmalen
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81895
Saleem Abdulrasool [Mon, 8 Jun 2020 19:07:34 +0000 (12:07 -0700)]
lld: remove old test support path
This removes the stub library that lld injected to satisfy the
dependency on the libSystem. Now with TBD support, we can provide the
stub library to permit the tests to function properly as they would on a
real system.
Reviewed By: smeenai
Differential Revision: https://reviews.llvm.org/D81418
Christopher Tetreault [Tue, 16 Jun 2020 22:29:22 +0000 (15:29 -0700)]
[NFC] Use EXPECT_FALSE(...) in test rather than EXPECT_EQ(false, ...)
Summary: Silence GCC -Wconversion-null warning from GTest
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81976
Jonas Devlieghere [Tue, 16 Jun 2020 22:45:46 +0000 (15:45 -0700)]
[lldb/Test] Cleanup TestJITLoaderGDB and make it compatible with reproducers
Eric Schweitz [Fri, 12 Jun 2020 20:54:04 +0000 (13:54 -0700)]
[flang] Upstream the Mangler module from lowering.
This upstreams the internal name mangling used in the bridge to generate
unique names from symbols.
Replace InternalNamesTest with the actual, functional unittest.
Differential revision: https://reviews.llvm.org/D81764
Christopher Tetreault [Tue, 16 Jun 2020 21:55:32 +0000 (14:55 -0700)]
[SVE] Deprecate default false variant of VectorType::get
Reviewers: efriedma, fpetrogalli, kmclaughlin, huntergr
Reviewed By: fpetrogalli
Subscribers: cfe-commits, tschuett, rkruppe, psnobl, llvm-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D80342
Geoffrey Martin-Noble [Tue, 16 Jun 2020 22:06:32 +0000 (18:06 -0400)]
[mlir] Fix case in MLIRGPUtoSPIRVTransforms
This patch changes the casing of MLIRGPUtoSPIRVTransforms
to be consistent with other transforms libraries.
Differential Revision: https://reviews.llvm.org/D81902
Aaron Smith [Tue, 16 Jun 2020 22:10:05 +0000 (15:10 -0700)]
[SelectionDAG] Add MVT::bf16 to getConstantFP()
Summary:
This was probably overlooked in recent bfloat patches.
Needed to handle bf16 constants in SelectionDAG.
ConstantFP:bf16<APFloat(0)>
Reviewers: stuij
Reviewed By: stuij
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81779
Fangrui Song [Tue, 16 Jun 2020 21:55:02 +0000 (14:55 -0700)]
[llvm-cov gcov] Don't suppress .gcov output if .gcda is corrupted
If .gcda is corrupted, gcov continues to produce a .gcov and just
assumes execution counts are zeros. This is reasonable, because the
program can corrupt its .gcda output. The code path should be similar to
the code path without .gcda.
Michael Park [Tue, 16 Jun 2020 20:29:23 +0000 (13:29 -0700)]
Remove the try/catch codepath if `swap` is `noexcept`.
Summary:
In the case where `swap` is `noexcept`, we should avoid the extension to provide strong-exception guarantee.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46342
Reviewers: #libc, ldionne
Reviewed By: #libc, ldionne
Subscribers: dexonsmith, mclow.lists, miscco, ldionne, zoecarver, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D81954
Daniel Sanders [Tue, 16 Jun 2020 21:15:36 +0000 (14:15 -0700)]
[gicombiner] Allow generated combiners to store additional members
Summary:
Adds the ability to add members to a generated combiner via
a State base class. In the current AArch64PreLegalizerCombiner
this is used to make Helper available without having to
provide it to every call.
As part of this, split the command line processing into a
separate object so that it still only runs once even though
the generated combiner is constructed more frequently.
Depends on D81862
Reviewers: aditya_nandakumar, bogner, volkan, aemerson, paquette, arsenm
Reviewed By: arsenm
Subscribers: jvesely, wdng, nhaehnle, kristof.beyls, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81863
Christopher Tetreault [Tue, 16 Jun 2020 21:05:21 +0000 (14:05 -0700)]
[SVE] Remove invalid calls to VectorType::getNumElements from BasicTTIImpl
Summary:
Most of these operations are reasonable for scalable vectors. Due to
this, we have decided not to change the interface to specifically take
FixedVectorType despite the fact that the current implementations make
fixed width assumptions. Instead, we cast to FixedVectorType and assert
in the body. If a developer makes some change in the future that causes
one of these asserts to fire, they should either change their code or
make the function they are trying to call handle scalable vectors.
Reviewers: efriedma, samparker, RKSimon, craig.topper, sdesmalen, c-rhodes
Reviewed By: efriedma
Subscribers: tschuett, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81495
Kirill Naumov [Tue, 16 Jun 2020 18:39:54 +0000 (18:39 +0000)]
[CallPrinter] Adding heat coloring to CallPrinter
This patch introduces the heat coloring of the Call Printer which is based
on the relative "hotness" of each function. The patch is a part of sequence of
three patches, related to graphs Heat Coloring.
Another feature added is the flag similar to "-cfg-dot-filename-prefix",
which allows to write the graph into a named .pdf
Reviewers: rcorcs, apilipenko, davidxl, sfertile, fedor.sergeev, eraman, bollu
Differential Revision: https://reviews.llvm.org/D77172
Fangrui Song [Tue, 16 Jun 2020 21:13:51 +0000 (14:13 -0700)]
[gcov] Add -i --intermediate-format
Between gcov 4.9~8, `gcov -i $file` prints coverage information to
$file.gcov in an intermediate text format (single file, instead of
$source.gcov for each source file).
lcov newer than 2019-05-24 detects -i support and uses it to increase
processing speed. gcov 9 (GCC r265587) removed --intermediate-format
and -i was changed to mean --json-format. However, we consider this
format still useful and support it. geninfo (part of lcov) supports this
format even if we announce that we are compatible with gcov 9.0.0
Fangrui Song [Tue, 16 Jun 2020 20:53:16 +0000 (13:53 -0700)]
[gcov] Refactor llvm-cov gcov and add SourceInfo
Daniel Sanders [Tue, 16 Jun 2020 20:41:38 +0000 (13:41 -0700)]
[gicombiner] Allow generated CombinerHelpers to have additional arguments
Summary:
This allows combiners to delegate to other helpers or depend
on additional information. It's not great as an overall
solution though as callers must provide the argument on every call, even for
static data like an additional helper. Another patch will follow to
support additional members of the generated combiner.
Reviewers: aditya_nandakumar, bogner, aemerson, paquette, volkan, arsenm
Reviewed By: aditya_nandakumar
Subscribers: wdng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81862
Frederik Gossen [Tue, 16 Jun 2020 21:04:57 +0000 (21:04 +0000)]
[MLIR][Standard] Fix use of `dyn_cast_or_null`
The value may be a function argument in which case `getDefiningOp` will return a
`nullptr`.
Differential Revision: https://reviews.llvm.org/D81965
Davide Italiano [Tue, 16 Jun 2020 21:04:40 +0000 (14:04 -0700)]
[CGP] Add `--match-full-lines` to make sure we don't have a dbg attachment.
Alexey Bataev [Tue, 16 Jun 2020 21:00:14 +0000 (17:00 -0400)]
Revert "[OPENMP50]Codegen for scan directive in for simd regions."
This reverts commit
6e78a3086a7f563cc55d2ba83a8697b3320857fb to solve
the problem with mem leak.
Frederik Gossen [Tue, 16 Jun 2020 20:56:30 +0000 (20:56 +0000)]
[MLIR][Standard] Lower `std.dim` with dynamic dimension operand to LLVM
Implement the missing lowering from `std.dim` to the LLVM dialect in case of a
dynamic dimension.
Differential Revision: https://reviews.llvm.org/D81834
Jonas Devlieghere [Tue, 16 Jun 2020 20:54:03 +0000 (13:54 -0700)]
[lldb/Test] Pass the lldb_tool_dir when setting the lldb-repro substitutions
Otherwise LIT can't find the lldb-repro script in standalone builds.
Christopher Tetreault [Tue, 16 Jun 2020 20:42:58 +0000 (13:42 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from AArch64
Reviewers: efriedma, c-rhodes, david-arm, samparker, greened
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81518
Christopher Tetreault [Tue, 16 Jun 2020 20:19:15 +0000 (13:19 -0700)]
[NFC] Bail out for scalable vectors before calling getNumElements
Summary:
Move the bail out logic to before constructing the Result and Lane
vectors. This is both potentially faster, and avoids calling
getNumElements on a potentially scalable vector
Reviewers: efriedma, sunfish, chandlerc, c-rhodes, fpetrogalli
Reviewed By: fpetrogalli
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81619
Christopher Tetreault [Tue, 16 Jun 2020 19:52:13 +0000 (12:52 -0700)]
[SVE] Fix bad FixedVectorType cast in simplifyDivRem
Summary:
simplifyDivRem attempts to walk a VectorType elementwise. Ensure that it
only does so for FixedVectorType
Reviewers: efriedma, spatel, lebedev.ri, david-arm, kmclaughlin
Reviewed By: spatel, david-arm
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81856
Alexey Bataev [Thu, 11 Jun 2020 14:16:16 +0000 (10:16 -0400)]
[OPENMP50]Codegen for scan directive in for simd regions.
Summary:
Added codegen for scan directives in parallel for regions.
Emits the code for the directive with inscan reductions.
Original code:
```
#pragma omp for simd reduction(inscan, op : ...)
for(...) {
<input phase>;
#pragma omp scan (in)exclusive(...)
<scan phase>
}
```
is transformed to something:
```
size num_iters = <num_iters>;
<type> buffer[num_iters];
#pragma omp for simd
for (i: 0..<num_iters>) {
<input phase>;
buffer[i] = red;
}
#pragma omp barrier
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
buffer[i] op= buffer[i-pow(2,k)];
#pragma omp for simd
for (0..<num_iters>) {
red = InclusiveScan ? buffer[i] : buffer[i-1];
<scan phase>;
}
```
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81658
Yuanfang Chen [Tue, 16 Jun 2020 20:05:53 +0000 (13:05 -0700)]
Revert "remove gold linker"
This reverts commit
719c87edc58018a0e9f3ee04305e081d4b582c2b.
Checked in by accident. Sorry.
Yuanfang Chen [Tue, 16 Jun 2020 20:00:14 +0000 (13:00 -0700)]
[Clang] Add a "#pragma unroll" test case for correct error reporting
For PR46336.
Yuanfang Chen [Wed, 10 Jun 2020 16:38:33 +0000 (09:38 -0700)]
remove gold linker
Alexey Bataev [Tue, 16 Jun 2020 17:16:08 +0000 (13:16 -0400)]
[OPENMP]Fix PR46347: several ordered directives in a single region.
Summary:
According to OpenMP, During execution of an iteration of a worksharing-loop or a loop nest within a worksharing-loop, simd, or worksharing-loop SIMD region, a thread must not execute more than one ordered region corresponding to an ordered construct without a depend clause.
Need to report an error in this case.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81951
Christopher Tetreault [Tue, 16 Jun 2020 19:35:51 +0000 (12:35 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Vectorize
Reviewers: efriedma, fhahn, spatel, sdesmalen, kmclaughlin
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81521
Matt Arsenault [Tue, 16 Jun 2020 15:39:44 +0000 (11:39 -0400)]
GlobalISel: Fix not failing on widening G_INSERT_VECTOR_ELT
This doesn't actually handled type idx 0, but was reporting Legalized
on it. No test changes because nothing was trying to use this.
Ahsan Saghir [Tue, 16 Jun 2020 19:39:18 +0000 (14:39 -0500)]
[PowerPC] Add -m[no-]power10-vector clang and llvm option
Summary: This patch adds command line option for enabling power10-vector support.
Reviewers: hfinkel, nemanjai, lei, amyk, #powerpc
Reviewed By: lei, amyk, #powerpc
Subscribers: wuzish, kbarton, hiraditya, shchenz, cfe-commits, llvm-commits
Tags: #llvm, #clang, #powerpc
Differential Revision: https://reviews.llvm.org/D80758
Florian Hahn [Tue, 16 Jun 2020 16:02:09 +0000 (17:02 +0100)]
[Matrix] Add align info to some more loads/stores (NFC).
Some tests were missing alignment info. Subsequent changes properly
preserve the set alignment. Set it properly beforehand, to avoid
unnecessary test changes.
Julian Lettner [Tue, 16 Jun 2020 19:15:16 +0000 (12:15 -0700)]
[lit] Improve consistency for showing result groups
Before this change we showed all result groups with a code that was not
explicitly hard-coded set. This set missed the FLAKYPASS result code.
Let's generalize the code to always show failures and the additionally
requested result codes.
Tom Stellard [Tue, 16 Jun 2020 18:20:20 +0000 (11:20 -0700)]
Driver: Accept multiple --config options if filenames are the same
Summary:
We're trying to use the --config options to pass distro specific
options for Fedora via the CFLAGS variable. However, some projects
end up using the CFLAGS variable multiple times in their command line,
which leads to an error when --config is used.
This patch resolves this issue by allowing more than one --config option
on the command line as long as the file names are the same.
Reviewers: sepavloff, hfinkel
Reviewed By: sepavloff
Subscribers: cfe-commits, llvm-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81424
Alex Zinenko [Tue, 16 Jun 2020 12:22:54 +0000 (14:22 +0200)]
[mlir] refactor Linalg LoopNestBuilder to use common infra
Recent work has introduced support for constructing loops via `::build` with
callbacks that construct loop bodies using only the core OpBuilder. This is now
supported on all loop types that Linalg lowers to. Refactor LoopNestBuilder in
Linalg to rely on this functionality instead of using a custom EDSC-based
approach to creating loop nests.
The specialization targeting parallel loops is also simplified by factoring out
the recursive call into a separate static function and considering only two
alternatives: top-level loop is parallel or sequential.
This removes the last remaining in-tree use of edsc::LoopBuilder, which is now
deprecated and will be removed soon.
Differential Revision: https://reviews.llvm.org/D81873
Alex Zinenko [Tue, 16 Jun 2020 12:22:49 +0000 (14:22 +0200)]
[mlir] Introduce callback-based builders to SCF Parallel and Reduce ops
Similarly to `scf::ForOp`, introduce additional `function_ref` arguments to
`::build` functions of SCF `ParallelOp` and `ReduceOp`. The provided functions
will be called to construct the body of the respective operations while
constructing the operation itself. Exercise them in LoopUtils.
Differential Revision: https://reviews.llvm.org/D81872
Matt Arsenault [Tue, 16 Jun 2020 00:59:50 +0000 (20:59 -0400)]
GlobalISel: Use early return and reduce indentation
Tim Shen [Tue, 16 Jun 2020 18:38:26 +0000 (11:38 -0700)]
[MLIR] Add documentation for generate-check-lines.py
Matt Arsenault [Tue, 16 Jun 2020 15:32:52 +0000 (11:32 -0400)]
GlobalISel: Make special case handling clearer
The special case here is really G_UNMERGE_VALUES, not G_EXTRACT. The
other opcodes can hardcode index 1 like G_EXTRACT.
Matt Arsenault [Tue, 16 Jun 2020 15:32:16 +0000 (11:32 -0400)]
GlobalISel: Use Register
Tim Shen [Tue, 16 Jun 2020 18:28:36 +0000 (11:28 -0700)]
[MLIR] Remove generated spaces at eof for generate-test-checks.py.
Tim Shen [Tue, 16 Jun 2020 02:41:03 +0000 (19:41 -0700)]
[MLIR] Rework generate-test-checks.py to attach CHECK lines to the source (test) file.
Summary:
This patch adds --source flag to indicate the source file. Then it tries to find insert
points in the source file and insert corresponding checks at those places.
Example output from Tensorflow XLA:
// -----
// CHECK-LABEL: func @main.3(
// CHECK-SAME: %[[VAL_0:.*]]: memref<2x2xf32> {xla_lhlo.params = 0 : index},
// CHECK-SAME: %[[VAL_1:.*]]: memref<16xi8> {xla_lhlo.alloc = 0 : index, xla_lhlo.liveout = true}) {
// CHECK: %[[VAL_2:.*]] = constant 0 : index
// CHECK: %[[VAL_3:.*]] = constant 0 : index
// CHECK: %[[VAL_4:.*]] = std.view %[[VAL_1]]{{\[}}%[[VAL_3]]][] : memref<16xi8> to memref<2x2xf32>
// CHECK: "xla_lhlo.tanh"(%[[VAL_0]], %[[VAL_4]]) : (memref<2x2xf32>, memref<2x2xf32>) -> ()
// CHECK: return
// CHECK: }
func @main(%value0: tensor<2x2xf32>) -> tensor<2x2xf32> {
%res = "xla_hlo.tanh"(%value0) : (tensor<2x2xf32>) -> tensor<2x2xf32>
return %res : tensor<2x2xf32>
}
Differential Revision: https://reviews.llvm.org/D81903
Stanislav Mekhanoshin [Tue, 16 Jun 2020 17:21:09 +0000 (10:21 -0700)]
Fix ubsan error in tblgen with signed left shift
UBSAN complains when tblgen performs SHL of a negative
value.
Differential Revision: https://reviews.llvm.org/D81952
Hiroshi Yamauchi [Wed, 10 Jun 2020 21:06:25 +0000 (14:06 -0700)]
[TLI] Add four C++17 delete variants.
Summary:
delete(void*, unsigned int, align_val_t)
delete(void*, unsigned long, align_val_t)
delete[](void*, unsigned int, align_val_t)
delete[](void*, unsigned long, align_val_t)
Differential Revision: https://reviews.llvm.org/D81853
David Tenty [Tue, 16 Jun 2020 18:00:32 +0000 (14:00 -0400)]
[AIX][compiler-rt] Pick the right form of COMPILER_RT_ALIAS for AIX
Summary: we use the alias attribute, similar to what is done for ELF.
Reviewers: ZarkoCA, jasonliu, hubert.reinterpretcast, sfertile
Reviewed By: jasonliu
Subscribers: dberris, aheejin, mstorsjo, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D81120
Jonas Devlieghere [Tue, 16 Jun 2020 18:02:00 +0000 (11:02 -0700)]
[lldb/Python] Fix the infinitely looping Python prompt bug
Executing commands below will get you bombarded by a wall of Python
command prompts (>>> ).
$ echo 'foo' | ./bin/lldb -o script
$ cat /tmp/script
script
print("foo")
$ lldb --source /tmp/script
The issue is that our custom input reader doesn't handle EOF. According
to the Python documentation, file.readline always includes a trailing
newline character unless the file ends with an incomplete line. An empty
string signals EOF. This patch raises an EOFError when that happens.
[1] https://docs.python.org/2/library/stdtypes.html#file.readline
Differential revision: https://reviews.llvm.org/D81898
Sanjay Patel [Tue, 16 Jun 2020 17:30:40 +0000 (13:30 -0400)]
[VectorCombine] scalarize compares with insertelement operand(s)
Generalize scalarization (recently enhanced with D80885)
to allow compares as well as binops.
Similar to binops, we are avoiding scalarization of a loaded
value because that could avoid a register transfer in codegen.
This requires 1 extra predicate that I am aware of: we do not
want to scalarize the condition value of a vector select. That
might also invert a transform that we do in instcombine that
prefers a vector condition operand for a vector select.
I think this is the final step in solving PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463
Differential Revision: https://reviews.llvm.org/D81661
Louis Dionne [Mon, 8 Jun 2020 20:16:01 +0000 (16:16 -0400)]
[libc++] Don't trigger unsigned conversion warnings in std::advance
The Standard documents the signature of std::advance as
template <class Iter, class Distance>
constexpr void advance(Iter& i, Distance n);
Furthermore, it does not appear to put any restriction on what the type
of Distance should be. While it is understood that it should usually
be std::iterator_traits::difference_type, I couldn't find any wording
that mandates that. Similarly, I couldn't find wording that forces the
distance to be a signed type.
This patch changes std::advance to accept any type in the second argument,
which appears to be what the Standard mandates. We then coerce it to the
iterator's difference type, but that's an implementation detail.
Differential Revision: https://reviews.llvm.org/D81425
Yuanfang Chen [Tue, 16 Jun 2020 17:13:44 +0000 (10:13 -0700)]
[Clang] Skip adding begin source location for PragmaLoopHint'd loop when
the range start is already set
The range start could be set already in some invalid cases. Fixes
PR46336.
Jessica Paquette [Mon, 15 Jun 2020 23:32:01 +0000 (16:32 -0700)]
[AArch64][GlobalISel] Avoid creating redundant ubfx when selecting G_ZEXT
When selecting 32 b -> 64 b G_ZEXTs, we don't have to always emit the extend.
If the instruction feeding into the G_ZEXT implicitly zero extends the high
half of the register, we can just emit a SUBREG_TO_REG instead.
Differential Revision: https://reviews.llvm.org/D81897
Jonas Devlieghere [Tue, 16 Jun 2020 16:39:57 +0000 (09:39 -0700)]
[lldb/Test] Create dir if it doesn't yet exist in getReproducerArtifact
The type test use this method to store the golden output. This currently
fails if the reproducer directory hasn't yet been created.
Alexey Bataev [Tue, 16 Jun 2020 16:24:09 +0000 (12:24 -0400)]
[OPENMP][DOCS]Update status of the supported constrcuts, NFC.
Sam McCall [Tue, 16 Jun 2020 16:05:01 +0000 (18:05 +0200)]
[Format] Add more proto enclosing function names
Alexander Belyaev [Tue, 16 Jun 2020 13:07:59 +0000 (15:07 +0200)]
[mlir][shape] Add a func to populate ShapeToShape patterns.
Differential Revision: https://reviews.llvm.org/D81933
Kirstóf Umann [Fri, 12 Jun 2020 16:15:20 +0000 (18:15 +0200)]
[analyzer][MallocChecker] PR46253: Correctly recognize standard realloc
https://bugs.llvm.org/show_bug.cgi?id=46253
This is an obvious hack because realloc isn't any more affected than other
functions modeled by MallocChecker (or any user of CallDescription really),
but the nice solution will take some time to implement.
Differential Revision: https://reviews.llvm.org/D81745
Fangrui Song [Tue, 16 Jun 2020 15:32:09 +0000 (08:32 -0700)]
[GlobalISel] Delete unused variable after r353432
Leandro Vaz [Thu, 21 May 2020 15:24:07 +0000 (16:24 +0100)]
Fix debug line info when line markers are present inside macros.
Compiling assembly files when newlines are reduced to line markers within a `.macro` context will generate wrong information in `.debug_line` section.
This patch fixes this issue by evaluating line markers within the macro scope but not when they are used and evaluated.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D80381
Matt Arsenault [Sun, 7 Jun 2020 14:04:31 +0000 (10:04 -0400)]
GlobalISel: Add a note to G_BITCAST documentation
This is currently different from the IR rules.
Matt Arsenault [Sun, 7 Jun 2020 00:27:02 +0000 (20:27 -0400)]
GlobalISel: Make LLT constructors constexpr
Joachim Protze [Mon, 15 Jun 2020 16:39:47 +0000 (18:39 +0200)]
[OpenMP][OMPT] Add callbacks for doacross loops
Adds the callbacks for ordered with source/sink dependencies.
The test for task dependencies changed, because callbach.h now actually prints
the passed dependencies and the test also checks for the address.
Reviewed by: hbae
Differential Revision: https://reviews.llvm.org/D81807
Nicolas Vasilache [Tue, 16 Jun 2020 13:14:42 +0000 (09:14 -0400)]
[mlir][Linalg] Retire C++ MatmulOp in favor of a linalg-ods-gen'd op.
Summary:
This revision replaces MatmulOp, now that DRR rules have been dropped.
This revision also fixes minor parsing bugs and a plugs a few holes to get e2e paths working (e.g. library call emission).
During the replacement the i32 version had to be dropped because only the EDSC operators +, *, etc support type inference.
Deciding on a type-polymorphic behavior, and implementing it, is left for future work.
Reviewers: aartbik
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D81935
Florian Hahn [Tue, 16 Jun 2020 14:24:39 +0000 (15:24 +0100)]
[Matrix] Specify missing alignment in tests (NFC).
Some tests were missing alignment info. Subsequent changes properly
preserve the set alignment. Set it properly beforehand, to avoid
unnecessary test changes.
It also updates cases where an alignment of 16 was specified, instead of
the vector element type alignment.
Kiran Chandramohan [Tue, 16 Jun 2020 14:26:25 +0000 (15:26 +0100)]
[MLIR][NFC] Inline lambda to workaround gcc 9.1,9.2 bug
gcc 9.1/9.2 has a bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90538)
which leads to an incorrect error when expanding parameter packs multiple
times in a lambda. Inlining this lambda to work around this issue.
Reviewed By: rriddle, CarolineConcatto
Differential Revision: https://reviews.llvm.org/D81828
Luke Geeson [Tue, 9 Jun 2020 18:44:33 +0000 (19:44 +0100)]
[AArch64]: BFloat MatMul Intrinsics&CodeGen
This patch upstreams support for BFloat Matrix Multiplication Intrinsics
and Code Generation from __bf16 to AArch64. This includes IR intrinsics. Unittests are
provided as needed. AArch32 Intrinsics + CodeGen will come after this
patch.
This patch is part of a series implementing the Bfloat16 extension of
the
Armv8.6-a architecture, as detailed here:
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a
The bfloat type, and its properties are specified in the Arm
Architecture
Reference Manual:
https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile
The following people contributed to this patch:
Luke Geeson
- Momchil Velikov
- Mikhail Maltsev
- Luke Cheeseman
Reviewers: SjoerdMeijer, t.p.northover, sdesmalen, labrinea, miyuki,
stuij
Reviewed By: miyuki, stuij
Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits,
llvm-commits, miyuki, chill, pbarrio, stuij
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D80752
Change-Id: I174f0fd0f600d04e3799b06a7da88973c6c0703f
Luke Geeson [Tue, 9 Jun 2020 13:51:03 +0000 (14:51 +0100)]
[AArch64]: BFloat Load/Store Intrinsics&CodeGen
This patch upstreams support for ld / st variants of BFloat intrinsics
in from __bf16 to AArch64. This includes IR intrinsics. Unittests are
provided as needed.
This patch is part of a series implementing the Bfloat16 extension of
the
Armv8.6-a architecture, as detailed here:
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a
The bfloat type, and its properties are specified in the Arm
Architecture
Reference Manual:
https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile
The following people contributed to this patch:
- Luke Geeson
- Momchil Velikov
- Luke Cheeseman
Reviewers: fpetrogalli, SjoerdMeijer, sdesmalen, t.p.northover, stuij
Reviewed By: stuij
Subscribers: arsenm, pratlucas, simon_tatham, labrinea, kristof.beyls,
hiraditya, danielkiss, cfe-commits, llvm-commits, pbarrio, stuij
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D80716
Change-Id: I22e1dca2a8a9ec25d1e4f4b200cb50ea493d2575
Michael Liao [Tue, 2 Jun 2020 19:39:52 +0000 (15:39 -0400)]
[clang][amdgpu] Prefer not using `fp16` conversion intrinsics.
Reviewers: yaxunl, arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, kerbowa, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81849
Valeriy Savchenko [Tue, 16 Jun 2020 09:02:11 +0000 (12:02 +0300)]
[analyzer] Fix StdLibraryFunctionsChecker crash on macOS
Summary:
EOF macro token coming from a PCH file on macOS while marked as literal,
doesn't contain any literal data. This causes crash on every project
using PCHs.
This commit doesn't resolve the problem with PCH (maybe it was
designed like this for a purpose) or with `tryExpandAsInteger`, but
rather simply shoots off a crash itself.
Differential Revision: https://reviews.llvm.org/D81916
Nathan James [Tue, 16 Jun 2020 12:54:48 +0000 (13:54 +0100)]
[clang-tidy] simplify-bool-expr ignores template instantiations
Ignore template instantiations in the matchers, Addresses [[ https://bugs.llvm.org/show_bug.cgi?id=46226 | readability-simplify-boolean-expr false-positive for bool from template. ]]
Reviewed By: aaron.ballman, lebedev.ri
Differential Revision: https://reviews.llvm.org/D81336
Georgii Rymar [Tue, 9 Jun 2020 13:58:21 +0000 (16:58 +0300)]
[DebugInfo/DWARF] - Report .eh_frame sections of version != 1.
Specification (https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#AEN1349)
says that the value of Version field for .eh_frame should be 1.
Though we accept other values and might perform an attempt to read
it as a .debug_frame because of that, what is wrong.
This patch adds a version check.
Differential revision: https://reviews.llvm.org/D81469
Georgii Rymar [Mon, 15 Jun 2020 12:18:29 +0000 (15:18 +0300)]
[llvm-readelf] - Do not omit a zero symbol value when printing relocations.
Previously we only printed a symbol value when it has a non-empty name
or non-zero value.
This patch changes the behavior. Now we only omit a symbols value when
a relocation does not reference a symbol (i.e. symbol index == 0).
Seems it is what GNU readelf does, looking on its output.
Differential revision: https://reviews.llvm.org/D81842
David Truby [Fri, 5 Jun 2020 15:01:15 +0000 (16:01 +0100)]
[mlir][OpenMP] Add custom parser and pretty printer for parallel construct
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, sstefan1, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D81264
Tyker [Tue, 16 Jun 2020 12:34:31 +0000 (14:34 +0200)]
Revert "[AssumeBundles] add cannonicalisation to the assume builder"
This reverts commit
90c50cad1983c5e29107a78382dead0fe2a9562c.
Georgii Rymar [Mon, 15 Jun 2020 11:54:46 +0000 (14:54 +0300)]
[llvm-readelf] - Do not crash when relocation references a STT_SECTION symbol for the null section.
Currently, llvm-readelf crashes when there is a STT_SECTION symbol for the null section
and this symbol is used in a relocation.
Differential revision: https://reviews.llvm.org/D81840
Ayke van Laethem [Tue, 21 Apr 2020 12:17:21 +0000 (14:17 +0200)]
[AVR] Remove faulty stack pushing behavior
An instruction like this will need to allocate some stack space for the
last parameter:
%x = call addrspace(1) i16 @bar(i64 undef, i64 undef, i16 undef, i16 0)
This worked fine when passing an actual value (in this case 0). However,
when passing undef, no value was pushed to the stack and therefore no
push instructions were created. This caused an unbalanced stack leading
to interesting results.
This commit fixes that by replacing the push logic with a regular stack
adjustment and stack-relative load/stores. This is less efficient but at
least it correctly compiles the code.
I can think of a few improvements in the future:
* The stack should have been adjusted in the function prologue when
there are no allocas in the function.
* Many (if not most) stack adjustments can be replaced by
pushing/popping the values directly. Exactly like the previous code
attempted but didn't do correctly.
* Small stack adjustments can be done more efficiently with a few
push/pop instructions (pushing/popping bogus values), both for code
size and for speed.
All in all, as long as there are no allocas in the function I think that
it is almost always more efficient to emit regular push/pop
instructions. This is however left for future optimizations.
Differential Revision: https://reviews.llvm.org/D78581
Ayke van Laethem [Tue, 21 Apr 2020 18:19:56 +0000 (20:19 +0200)]
[AVR] Fix stack size in functions with a frame pointer
This patch fixes a bug in stack save/restore code. Because the frame
pointer was saved/restored manually (not by marking it as clobbered) the
StackSize variable was not updated accordingly. Most code still worked,
but code that tried to load a parameter passed on the stack did not.
This commit fixes this by marking the frame pointer as a
callee-clobbered register. This will let it be saved without any effort
in prolog/epilog code and will make sure the correct address is
calculated for loading parameters that are passed on the stack.
This approach is used by most other targets (such as X86, AArch64 and
RISC-V).
Differential Revision: https://reviews.llvm.org/D78579
Alexander Belyaev [Tue, 16 Jun 2020 11:49:54 +0000 (13:49 +0200)]
[mlir][shape] Fix the comment in ShapeToStandard.cpp.
Ilya Leoshkevich [Tue, 16 Jun 2020 11:45:07 +0000 (13:45 +0200)]
[LSan] Enable for SystemZ
Summary: Add runtime support, adjust the tests and enable LSan.
Reviewers: vitalybuka, eugenis, uweigand, jonpa
Reviewed By: uweigand
Subscribers: mgorny, cfe-commits, #sanitizers
Tags: #clang, #sanitizers
Differential Revision: https://reviews.llvm.org/D78644
David Green [Tue, 16 Jun 2020 09:14:07 +0000 (10:14 +0100)]
[ARM] Fix crash trying to generate i1 immediates
These code patterns attempt to call isVMOVModifiedImm on a splat of i1
values, leading to an unreachable being hit. I've guarded the call on a
more specific set of sizes, as i1 vectors are legal under MVE.
Differential Revision: https://reviews.llvm.org/D81860
sstefan1 [Tue, 16 Jun 2020 11:11:03 +0000 (13:11 +0200)]
[NFC][Attributor] Expose getOrCreateAAFor and lookupAAFor
We are starting to use the Attributor outside the Attributor itself and
we need these to be able to seed and querry AAs.
Simon Pilgrim [Tue, 16 Jun 2020 09:32:43 +0000 (10:32 +0100)]
Fix comment typo - Uexpected -> Unexpected. NFC.