Marcos Horro [Thu, 1 Jul 2021 10:49:24 +0000 (11:49 +0100)]
[llvm-mca] Fix JSON output (PR50922)
Based on the discussion in PR50922, minor changes have been done to properly
output a valid JSON. Removed "not implemented" keys.
Differential Revision: https://reviews.llvm.org/D105064
Jon Chesterfield [Thu, 1 Jul 2021 11:53:03 +0000 (12:53 +0100)]
[libomptarget][nfc] Move grid size computation
Change getLaunchVals to return the integers used for launch
Reviewed By: pdhaliwal
Differential Revision: https://reviews.llvm.org/D105237
Nicolas Vasilache [Wed, 30 Jun 2021 21:18:13 +0000 (21:18 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for ConstantOp (13/n)
ConstantOp are only supported in the ModulePass because they require a GlobalCreator object that must be constructed from a ModuleOp.
If the standlaone FunctionPass encounters a ConstantOp, bufferization fails.
Differential revision: https://reviews.llvm.org/D105156
Nicolas Vasilache [Wed, 30 Jun 2021 21:10:26 +0000 (21:10 +0000)]
[mlir][Linalg] Drop comprehensive-func-bufferize (12/n)
This revision drops the comprehensive bufferization Function pass, which has issues when trying to bufferize constants.
Instead, only support the comprehensive-module-bufferize by default.
Differential Revision: https://reviews.llvm.org/D105228
Hussain Kadhem [Thu, 1 Jul 2021 09:30:49 +0000 (11:30 +0200)]
[VP] Implementation of intrinsic and SDNode definitions for VP load, store, gather, scatter.
This patch adds intrinsic definitions and SDNodes for predicated
load/store/gather/scatter, based on the work done in D57504.
Reviewed By: simoll, craig.topper
Differential Revision: https://reviews.llvm.org/D99355
Nicolas Vasilache [Tue, 29 Jun 2021 12:53:09 +0000 (12:53 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for linalg::InitTensor and tensor::CastOp (11/n)
Also add an integration test that connects all the dots end to end, including with cast to unranked tensor for external library calls.
Differential Revision: https://reviews.llvm.org/D105106
Bradley Smith [Mon, 7 Jun 2021 13:34:03 +0000 (14:34 +0100)]
[AArch64][SVE] Add support for fixed length MSCATTER/MGATHER
Since gather lowering can now lower to nodes that may need expansion via
the vector legalizer, do MGATHER lowering via vector legalizer.
Additionally, as part of adding passthru support for fixed typed
gathers, fix passthru support for scalable types.
Depends on D104910
Differential Revision: https://reviews.llvm.org/D104217
David Spickett [Wed, 30 Jun 2021 13:26:07 +0000 (13:26 +0000)]
[llvm][docs] Bump release number from 12 -> 13
This seems to have been forgotten. The result was the title
of pages like https://llvm.org/docs/ReleaseNotes.html
Was:
<title>LLVM 13.0.0 Release Notes — LLVM 12 documentation</title>
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D105189
Simon Pilgrim [Thu, 1 Jul 2021 10:39:59 +0000 (11:39 +0100)]
[CostModel][X86] getCastInstrCost - attempt to match custom cast/conversion before legalized types.
Move the (SSE-only) generic, legalized type conversion matching after the specific,custom conversion cases, allowing us to properly provide cost overrides.
The next step will be to clean up some of the weird existing costs and then to enable AVX+ legalized costs, which will let us strip out a lot of the cost tables entries.
Nicolas Vasilache [Tue, 29 Jun 2021 12:05:59 +0000 (12:05 +0000)]
[mlir][Linalg] Add support for CallOp bufferization (10/n)
Cross function boundary bufferization support is added.
This is enabled by cross-function boundary alias analysis, for which the bufferization process is extended: it can now modify the BufferizationAliasInfo as new ops are introduced.
A number of simplifying assumptions are made:
1. by default we bufferize to the most dynamic strided memref type, further memref::CastOp canonicalizations are expected to clean up the IR.
2. in the current implementation, the stride information is always erased at function boundaries. A subsequent pass will be required to analyze the meet of all call ops to a function and decide whether more static buffer types can be used. This will potentially clone functions when it is deemed profitable to do so (e.g. when the stride-1 dimension may vary).
3. external function always bufferize to the most dynamic strided memref version. This may require special annotations for specifying that particular operands of top-level functions have contiguous buffer layout.
An alternative to point 3. would be to support tensor layout annotations, which is currently not supported in MLIR.
Differential revision: https://reviews.llvm.org/D104873
Benjamin Kramer [Thu, 1 Jul 2021 10:24:55 +0000 (12:24 +0200)]
[mlir][async] Remove unused variable. NFC.
Jeremy Morse [Thu, 1 Jul 2021 09:59:22 +0000 (10:59 +0100)]
[DebugInfo][InstrRef][1/4] Support transformations that widen values
Very late in compilation, backends like X86 will perform optimisations like
this:
$cx = MOV16rm $rax, ...
->
$rcx = MOV64rm $rax, ...
Widening the load from 16 bits to 64 bits. SEeing how the lower 16 bits
remain the same, this doesn't affect execution. However, any debug
instruction reference to the defined operand now refers to a 64 bit value,
nto a 16 bit one, which might be unexpected. Elsewhere in codegen, there's
often this pattern:
CALL64pcrel32 @foo, implicit-def $rax
%0:gr64 = COPY $rax
%1:gr32 = COPY %0.sub_32bit
Where we want to refer to the definition of $eax by the call, but don't
want to refer the copies (they don't define values in the way
LiveDebugValues sees it). To solve this, add a subregister field to the
existing "substitutions" facility, so that we can describe a field within
a larger value definition. I would imagine that this would be used most
often when a value is widened, and we need to refer to the original,
narrower definition.
Differential Revision: https://reviews.llvm.org/D88891
Matheus Izvekov [Mon, 14 Jun 2021 11:23:18 +0000 (13:23 +0200)]
[clang] Apply P1825 as Defect Report from C++11 up to C++20.
This extends the effects of [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1825r0.html | P1825 ]] to all C++ standards from C++11 up to C++20.
According to Motion 23 from Cologne 2019, P1825R0 was accepted as a Defect Report, so we retroactively apply this all the way back to C++11.
Note that we also remove implicit moves from C++98 as an extension
altogether, since the expanded first overload resolution from P1825
can cause some meaning changes in C++98.
For example it can change which copy constructor is picked when both const
and non-const ones are available.
This also rips out warn_return_std_move since there are no cases where it would be worthwhile to suggest it.
This also fixes a bug with bailing into the second overload resolution
when encountering a non-rvref qualified conversion operator.
This was unnoticed until now, so two new test cases cover these.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D104500
Christian Kühnel [Mon, 28 Jun 2021 12:29:50 +0000 (14:29 +0200)]
added some example code for llvm::Expected<T>
Since I had some fun understanding how to properly use llvm::Expected<T> I added some code examples that I would have liked to see when learning to use it.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D105014
mydeveloperday [Thu, 1 Jul 2021 09:45:59 +0000 (10:45 +0100)]
[clang-format] PR50727 C# Invoke Lamda Expression indentation incorrect
https://bugs.llvm.org/show_bug.cgi?id=50727
When processing C# Lambda expression in the indentation can goes a little wrong,
resulting the the closing } being at the wrong indentation level and meaning the remaining part of the file is
incorrectly indented.
This can be a fairly common pattern for when C# wants to peform a UI action from a thread,
and it wants to invoke that action on the main thread
Reviewed By: exv, jbcoe
Differential Revision: https://reviews.llvm.org/D104388
Chen Zheng [Thu, 1 Jul 2021 09:22:42 +0000 (09:22 +0000)]
[PowerPC] add a testcase for byval parameter; NFC
Florian Hahn [Thu, 1 Jul 2021 08:48:07 +0000 (09:48 +0100)]
[BasicAA] Fix typo ScaleForGDC -> ScaleForGCD.
Balazs Benics [Thu, 1 Jul 2021 08:54:28 +0000 (10:54 +0200)]
[analyzer][NFC] Inline ExprEngine::handleLVectorSplat()
It seems like ExprEngine::handleLVectorSplat() was used at only 2
places. It might be better to directly inline them for readability.
It seems like these cases were not covered by tests according to my
coverage measurement, so I'm adding tests as well, demonstrating that no
behavior changed.
Besides that, I'm handling CK_MatrixCast similarly to how the rest of
the unhandled casts are evaluated.
Differential Revision: https://reviews.llvm.org/D105125
Reviewed by: NoQ
Balazs Benics [Thu, 1 Jul 2021 08:54:22 +0000 (10:54 +0200)]
[analyzer] LValueToRValueBitCasts should evaluate to an r-value
Previously `LValueToRValueBitCast`s were modeled in the same way how
a regular `BitCast` was. However, this should not produce an l-value.
Modeling bitcasts accurately is tricky, so it's probably better to
model this expression by binding a fresh conjured value.
The following code should not result in a diagnostic:
```lang=C++
__attribute__((always_inline))
static inline constexpr unsigned int_castf32_u32(float __A) {
return __builtin_bit_cast(unsigned int, __A); // no-warning
}
```
Previously, it reported
`Address of stack memory associated with local variable '__A' returned
to caller [core.StackAddressEscape]`.
Differential Revision: https://reviews.llvm.org/D105017
Reviewed by: NoQ, vsavchenko
LLVM GN Syncbot [Thu, 1 Jul 2021 08:31:00 +0000 (08:31 +0000)]
[gn build] Port
39f64c4c8375
Andrzej Warzynski [Thu, 1 Jul 2021 08:27:31 +0000 (08:27 +0000)]
[flang] Revert "PoC for Flang Driver Plugins"
This patch has not been reviewed and was commited by accident.
This reverts commit
788a5d4afe6407e647454a9832a7b4a27fba06bf.
Lang Hames [Sat, 19 Jun 2021 07:36:47 +0000 (17:36 +1000)]
[ORC] Add wrapper-function support methods to ExecutorProcessControl.
Adds support for both synchronous and asynchronous calls to wrapper functions
using SPS (Simple Packed Serialization). Also adds support for wrapping
functions on the JIT side in SPS-based wrappers that can be called from the
executor.
These new methods simplify calls between the JIT and Executor, and will be used
in upcoming ORC runtime patches to enable communication between ORC and the
runtime.
Andrzej Warzynski [Mon, 14 Jun 2021 14:26:58 +0000 (14:26 +0000)]
[flang][docs] Add documentation for the new Flang driver
Differential Revision: https://reviews.llvm.org/D104229
Stuart Ellis [Wed, 23 Jun 2021 17:05:29 +0000 (18:05 +0100)]
PoC for Flang Driver Plugins
Tobias Gysi [Thu, 1 Jul 2021 06:41:52 +0000 (06:41 +0000)]
[mlir][linalg][python] Update integration of OpDSL doc (NFC).
Move the OpDSL doc to a linalg sub folder and updated the integration in the main linalg documentation.
Differential Revision: https://reviews.llvm.org/D105188
Sam McCall [Thu, 1 Jul 2021 07:33:22 +0000 (09:33 +0200)]
[clangd] Fix gRPC build due to missing include path
Fabian Schuiki [Mon, 28 Jun 2021 11:12:36 +0000 (13:12 +0200)]
[MLIR] Add argument insertion helpers for FunctionLike
Add helpers to facilitate adding arguments and results to operations
that implement the `FunctionLike` trait. These operations already have a
convenient argument and result *erasure* mechanism, but a corresopnding
utility for insertion is missing. This introduces such a utility.
Jan Kratochvil [Thu, 1 Jul 2021 07:14:28 +0000 (09:14 +0200)]
[lldb] Fix Recognizer/assert.test with glibc-2.33.9000-31.fc35.x86_64
While on regular Linux system (Fedora 34 GA, not updated):
* thread #1, name = '1', stop reason = hit program assert
frame #0: 0x00007ffff7e242a2 libc.so.6`raise + 322
frame #1: 0x00007ffff7e0d8a4 libc.so.6`abort + 278
frame #2: 0x00007ffff7e0d789 libc.so.6`__assert_fail_base.cold + 15
frame #3: 0x00007ffff7e1ca16 libc.so.6`__assert_fail + 70
* frame #4: 0x00000000004011bd 1`main at assert.c:7:3
On Fedora 35 pre-release one gets:
* thread #1, name = '1', stop reason = signal SIGABRT
* frame #0: 0x00007ffff7e48ee3 libc.so.6`pthread_kill@GLIBC_2.2.5 + 67
frame #1: 0x00007ffff7dfb986 libc.so.6`raise + 22
frame #2: 0x00007ffff7de5806 libc.so.6`abort + 230
frame #3: 0x00007ffff7de571b libc.so.6`__assert_fail_base.cold + 15
frame #4: 0x00007ffff7df4646 libc.so.6`__assert_fail + 70
frame #5: 0x00000000004011bd 1`main at assert.c:7:3
I did not write a testcase as one needs the specific glibc. An
artificial test would just copy the changed source.
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D105133
Roman Lebedev [Thu, 1 Jul 2021 07:09:24 +0000 (10:09 +0300)]
[NFC][PassBuilder] addVectorPasses(): clarify that 'IsLTO' is actually 'IsFullLTO'
I.e. it will be `false` for thin lto.
Qiu Chaofan [Thu, 1 Jul 2021 06:31:47 +0000 (14:31 +0800)]
[NFC][Scheduler] Refactor tryCandidate to return boolean
This patch changes return type of tryCandidate from void to bool:
1. Methods in some targets already follow this convention.
2. This would help if some target wants to re-use generic code.
3. It looks more intuitive if these try-method returns the same type.
We may need to change return type of them from bool to some enum
further, to make it less confusing.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D103951
Corentin Jabot [Thu, 1 Jul 2021 04:26:55 +0000 (04:26 +0000)]
Add list of LWG papers accepted by WG21 during the June 2021 plenary
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D105103
Jacob Hegna [Wed, 23 Jun 2021 05:22:18 +0000 (05:22 +0000)]
Fail gracefully if no inlining model is available to download.
Differential Revision: https://reviews.llvm.org/D104829
LLVM GN Syncbot [Thu, 1 Jul 2021 04:00:13 +0000 (04:00 +0000)]
[gn build] Port
28b01c59c93d
Brian Cain [Thu, 1 Jul 2021 03:44:27 +0000 (22:44 -0500)]
[hexagon] Add {hvx,}hexagon_{protos,circ_brev...}
Add definitions for Hexagon, Hexagon circular/bit-reverse and HVX
intrinsics.
theidexisted [Thu, 1 Jul 2021 03:48:23 +0000 (20:48 -0700)]
[Compiler-rt] Add delete for noncopyable
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D105077
LLVM GN Syncbot [Thu, 1 Jul 2021 03:45:41 +0000 (03:45 +0000)]
[gn build] Port
662c55442f17
Vitaly Buka [Wed, 30 Jun 2021 21:46:03 +0000 (14:46 -0700)]
[GWP_ASAN] Enable ARM tests
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D105233
Vitaly Buka [Wed, 30 Jun 2021 21:42:41 +0000 (14:42 -0700)]
[scudo] GWP_ASAN runs on untagged pointers
It's already covered by multiple tests, but to trigger
this path we need MTE+GWP which disabled.
Reviewed By: hctim, pcc
Differential Revision: https://reviews.llvm.org/D105232
Lang Hames [Thu, 1 Jul 2021 01:53:18 +0000 (11:53 +1000)]
[ORC] Rename TargetProcessControl to ExecutorProcessControl. NFC.
This is a first step towards consistently using the term 'executor' for the
process that executes JIT'd code. I've opted for 'executor' as the preferred
term over 'target' as target is already heavily overloaded ("the target
machine for the executor" is much clearer than "the target machine for the
target").
Chuanqi Xu [Thu, 1 Jul 2021 02:59:57 +0000 (10:59 +0800)]
[Coroutine] Recommit Add statistics for the number of elided coroutine
Now we lack a benchmark to measure the performance change for each
commit.
Since coro elide is the main optimization in coroutine module, I wonder
it may be an estimation to count the number of elided coroutine in
private code bases.
e.g., for a certain commit, if we found that the number of elided goes
down, we could find it before the commit check-in.
Reviewed By: lxfind
Differential Revision: https://reviews.llvm.org/D105095
Jez Ng [Thu, 1 Jul 2021 02:38:07 +0000 (22:38 -0400)]
[llvm-objdump/mac] Print symbols at the same address deterministically
By using stable_sort.
Added a test case which previously failed when expensive checks were
enabled.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D105240
Geoffrey Martin-Noble [Thu, 1 Jul 2021 00:52:27 +0000 (17:52 -0700)]
[Bazel] add missing load to submodule example
I missed this in https://reviews.llvm.org/D105245
Reviewed By: chandlerc
Differential Revision: https://reviews.llvm.org/D105252
Jun Ma [Tue, 29 Jun 2021 10:04:28 +0000 (18:04 +0800)]
[clang][AArch64][SVE] Handle PRValue under VLAT <-> VLST cast
This change fixes the crash that PRValue cannot be handled by
EmitLValue.
Differential Revision: https://reviews.llvm.org/D105097
Jun Ma [Fri, 18 Jun 2021 03:55:01 +0000 (11:55 +0800)]
[AArch64][SVEIntrinsicOpts] Convect cntb/h/w/d to vscale intrinsic or constant.
As is mentioned above
Differential Revision: https://reviews.llvm.org/D104852
Matthias Springer [Thu, 1 Jul 2021 00:58:48 +0000 (09:58 +0900)]
[mlir][tensor] Add tensor.dim operation
* Split memref.dim into two operations: memref.dim and tensor.dim. Both ops have the same builder interface and op argument names, so that they can be used with templates in patterns that apply to both tensors and memrefs (e.g., some patterns in Linalg).
* Add constant materializer to TensorDialect (needed for folding in affine.apply etc.).
* Remove some MemRefDialect dependencies, make some explicit.
Differential Revision: https://reviews.llvm.org/D105165
Fangrui Song [Thu, 1 Jul 2021 00:52:55 +0000 (17:52 -0700)]
[AArch64] Remove unneeded ExternalSymbolSDNode code for machine constraint "S". NFC
ExternalSymbolSDNode is implicitly generated libcalls but with an address taking
operation we cannot reference an ExternalSymbolSDNode.
Richard Smith [Thu, 1 Jul 2021 00:25:55 +0000 (17:25 -0700)]
Add a target triple to fix failures on MS build bots.
-ast-dump=json tries to mangle every declaration, and under the MS ABI
there are still a few things we can't mangle, which caused this test to
assert.
Dhruva Chakrabarti [Thu, 1 Jul 2021 00:08:29 +0000 (17:08 -0700)]
Revert "[libomptarget] [amdgpu] Fix default setting of max flat workgroup size"
This reverts commit
2240b41ee4f30fe938975677a0a5a2c5c26d271b.
A value of 0 for KernDescVal WG_Size implies it is unknown, so it should be
set to the default. The above change was made without this assumption.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D105250
Min-Yih Hsu [Thu, 1 Jul 2021 00:12:47 +0000 (17:12 -0700)]
Reapply "[M68k][GloballSel] Formal arguments lowering in IRTranslator"
Implementation of formal arguments lowering in the IRTranslator for the
M68k backend
Differential Revision: https://reviews.llvm.org/D104542
Richard Smith [Thu, 1 Jul 2021 00:11:32 +0000 (17:11 -0700)]
Fix test following Clang change ef227b3.
Geoffrey Martin-Noble [Mon, 28 Jun 2021 20:09:48 +0000 (13:09 -0700)]
[Bazel] Rework LLVM target selection
This patch introduces a custom rule for expanding the LLVM target
enumeration .def files. This provides a slightly cleaner API for these
rules, but is mostly to permit selects to be used when determining which
LLVM targets to build. Right now the target list is generated at Bazel
configure time, but this will allows us to add functionality to also
control which targets are built based on config settings.
Tested: Ran `bazel test --config=rbe ... @llvm-project//...`
Reviewed By: chandlerc
Differential Revision: https://reviews.llvm.org/D104969
Geoffrey Martin-Noble [Wed, 30 Jun 2021 23:46:55 +0000 (16:46 -0700)]
[Bazel] Update README with examples
Reviewed By: chandlerc
Differential Revision: https://reviews.llvm.org/D105245
thomasraoux [Wed, 30 Jun 2021 23:22:31 +0000 (16:22 -0700)]
[mlir][vector] Extend vector distribution to all elementwise and contract
Uses elementwise interface to generalize canonicalization pattern and add a new
pattern for vector.contract case.
Differential Revision: https://reviews.llvm.org/D104343
Sanjay Patel [Wed, 30 Jun 2021 21:27:10 +0000 (17:27 -0400)]
[InstCombine] fold icmp ult of offset value with constant
This is one sibling of the fold added with
c7b658aeb526 .
(X + C2) <u C --> X >s ~C2 (if C == C2 + SMIN)
I'm still not sure how to describe it best, but we're
translating 2 constants from an unsigned range comparison
to signed because that eliminates the offset (add) op.
This could be extended to handle the more general (non-constant)
pattern too:
https://alive2.llvm.org/ce/z/K-fMBf
define i1 @src(i8 %a, i8 %c2) {
%t = add i8 %a, %c2
%c = add i8 %c2, 128 ; SMIN
%ov = icmp ult i8 %t, %c
ret i1 %ov
}
define i1 @tgt(i8 %a, i8 %c2) {
%not_c2 = xor i8 %c2, -1
%ov = icmp sgt i8 %a, %not_c2
ret i1 %ov
}
Sanjay Patel [Wed, 30 Jun 2021 21:10:54 +0000 (17:10 -0400)]
[InstCombine][test] add tests for icmp ult with constant and offset; NFC
This is the 'ult' sibling pattern for:
c7b658aeb526c3e6
Jez Ng [Wed, 30 Jun 2021 22:55:38 +0000 (18:55 -0400)]
[lld-macho] Only enable `__DATA_CONST` for newer platforms
Matches ld64.
Reviewed By: #lld-macho, alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D105080
Jez Ng [Wed, 30 Jun 2021 22:55:36 +0000 (18:55 -0400)]
[lld-macho] -section_rename should work on synthetic sections too
Previously, we only applied the renames to
ConcatOutputSections.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D105079
Siva Chandra Reddy [Wed, 30 Jun 2021 06:28:42 +0000 (06:28 +0000)]
[libc][NFC] Remove few deprecated FPUtil header files and test patterns.
Few tests have been converted to the new test patterns to facilitate
this.
Jeremy Morse [Wed, 30 Jun 2021 16:48:19 +0000 (17:48 +0100)]
[LiveDebugValues][InstrRef][2/2] Emit entry value variable locations
This patch adds support to the instruction-referencing LiveDebugValues
implementation for emitting entry values. The instruction referencing
implementations tracking by value rather than location means that we can
get around two of the issues with VarLocs. DBG_VALUE instructions that
re-assign the same value to a variable are no longer a problem, because we
can "see through" to the value being assigned. We also don't need to do
anything special during the dataflow stages: the "variable value problem"
doesn't need to know whether a value is available most of the time, and the
times it deoes need to know are always when entry values need to be
terminated.
The patch modifies the "TransferTracker" class, adding methods to identify
when a variable ias an entry value candidate, and when a machine value is
an entry value. recoverAsEntryValue tests these two things and emits an
entry-value expression if they're true. It's used when we clobber or
otherwise lose a value and can't find a replacement location for the value
it contained.
Differential Revision: https://reviews.llvm.org/D88406
Matt Arsenault [Wed, 9 Jun 2021 00:22:45 +0000 (20:22 -0400)]
GlobalISel: Use LLT in memory legality queries
This enables proper lowering of non-byte sized loads. We still aren't
faithfully preserving memory types everywhere, so the legality checks
still only consider the size.
Jon Chesterfield [Wed, 30 Jun 2021 21:40:06 +0000 (22:40 +0100)]
[libomptarget][nfc] Replace out arguments with struct return
A step towards making this function adequately self contained that it
can be tested easily. No functional change intended here, left variable
names unchanged.
Reviewed By: ronlieb
Differential Revision: https://reviews.llvm.org/D105229
Arthur O'Dwyer [Wed, 30 Jun 2021 21:37:43 +0000 (17:37 -0400)]
[libc++] graph_header_deps.py: Detect files that include themselves.
This wasn't happening before, which led to one slipping in.
Artem Belevich [Wed, 30 Jun 2021 20:12:57 +0000 (13:12 -0700)]
[Clang] allow overriding -fbasic-block-sections
We should not error out on non-x86 targets if `-fbasic-block-sections=none` is in effect.
Also, filter it out for GPU-side compilations, as we do with other options not
supported on the GPU.
Differential Revision: https://reviews.llvm.org/D105226
Richard Smith [Wed, 30 Jun 2021 21:05:34 +0000 (14:05 -0700)]
Add dumping support for RequiresExpr.
In passing, fix an ast-print bug that inserted a spurious extra `;`
after a concept definition.
Jon Chesterfield [Wed, 30 Jun 2021 21:23:34 +0000 (22:23 +0100)]
[libomptarget][amdgpu][nfc] Fix build warnings, drop some headers
Removes stdarg header, drops uses of iostream, fix some format string errors.
Also changes a C style struct to C++ style to avoid a warning from clang/
Reviewed By: pdhaliwal
Differential Revision: https://reviews.llvm.org/D104923
Matt Arsenault [Tue, 8 Jun 2021 21:11:12 +0000 (17:11 -0400)]
GlobalISel: Lower non-byte loads and stores
Previously we didn't preserve the memory type and had to blindly
interpret a number of bytes. Now that non-byte memory accesses are
representable, we can handle these correctly.
Ported from DAG version (minus some weird special case i1 legality
checking which I don't fully understand, and we don't have a way to
query for)
For now, this is NFC and the test changes are placeholders. Since the
legality queries are still relying on byte-flattened memory sizes, the
legalizer can't actually see these non-byte accesses. This keeps this
change self contained without merging it with the larger patch to
switch to LLT memory queries.
Matt Arsenault [Wed, 9 Jun 2021 13:19:36 +0000 (09:19 -0400)]
GlobalISel: Preserve memory type when reducing load/store width
Matt Arsenault [Wed, 9 Jun 2021 02:46:49 +0000 (22:46 -0400)]
AMDGPU/GlobalISel: Remove some problematic testcases
These testcases are a bit nonsensical and won't be handled correctly
for a long time. Remove them to unblock load/store legalization work.
Jonas Paulsson [Mon, 28 Jun 2021 23:18:25 +0000 (18:18 -0500)]
[MCStreamer] Move emission of attributes section into MCELFStreamer
Enable the emission of a GNU attributes section by reusing the code for
emitting the ARM build attributes section.
The GNU attributes follow the exact same section format as the ARM
BuildAttributes section, so this can be factored out and reused for GNU
attributes generally.
The immediate motivation for this is to emit a GNU attributes section for the
vector ABI on SystemZ (https://reviews.llvm.org/D105067).
Review: Logan Chien, Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D102894
Aleksandr Platonov [Wed, 30 Jun 2021 20:40:13 +0000 (21:40 +0100)]
[clangd][nfc] Show more information in logs when compiler instance prepare fails
Without this patch clangd silently process compiler instance prepare failure and only LSP errors "Invalid AST" could be found in logs.
E.g. the reason of the problem https://github.com/clangd/clangd/issues/734 is impossible to understand without verbose logs or with disabled background index.
This patch adds more information into logs to help understand the reason of such failures.
Logs without this patch:
```
E[...] Could not build a preamble for file test.cpp version 1
```
Logs with this patch:
```
E[...] Could not build a preamble for file test.cpp version 1: CreateTargetInfo() return null
..
E[...] Failed to prepare a compiler instance: unknown target ABI 'lp64'
```
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D104056
Matt Arsenault [Thu, 20 May 2021 02:25:51 +0000 (22:25 -0400)]
CodeGen: Print/parse LLTs in MachineMemOperands
This will currently accept the old number of bytes syntax, and convert
it to a scalar. This should be removed in the near future (I think I
converted all of the tests already, but likely missed a few).
Not sure what the exact syntax and policy should be. We can continue
printing the number of bytes for non-generic instructions to avoid
test churn and only allow non-scalar types for generic instructions.
This will currently print the LLT in parentheses, but accept parsing
the existing integers and implicitly converting to scalar. The
parentheses are a bit ugly, but the parser logic seems unable to deal
without either parentheses or some keyword to indicate the start of a
type.
Siva Chandra [Wed, 30 Jun 2021 20:45:38 +0000 (13:45 -0700)]
[libc][NFC] Clear all exceptions in exception_flags_test before raising another.
This is because, raising some exceptions can raise other ones. For
example, raising FE_OVERFLOW can raise FE_INEXACT. So, we need to clear all
exceptions if we want a clean slate.
Martin Storsjö [Tue, 29 Jun 2021 20:49:31 +0000 (23:49 +0300)]
[CMake] Don't use -Bsymbolic-functions for MinGW targets
This is an ELF specific option which isn't supported for Windows/MinGW
targets, even if the MinGW linker otherwise uses an ld.bfd like linker
interface.
Differential Revision: https://reviews.llvm.org/D105148
Valentin Churavy [Wed, 30 Jun 2021 19:44:54 +0000 (21:44 +0200)]
[Orc] Run the examples as part of the tests
Enable the Orc C-Bindings for testing.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D104637
Valentin Churavy [Wed, 30 Jun 2021 19:39:34 +0000 (21:39 +0200)]
[Orc] Fix name of LLVMOrcIRTransformLayerSetTransform
In https://reviews.llvm.org/D103855 we added access to IRTransformLayer, but I
just noticed that the function name is following the wrong pattern.
Differential Revision: https://reviews.llvm.org/D104840
Shilei Tian [Wed, 30 Jun 2021 19:39:43 +0000 (15:39 -0400)]
[OpenMP][Offloading] Replace all calls to `isSPMDMode` with `__kmpc_is_spmd_exec_mode`
In our ongoing work, we are using `AbstractAttributor` to deduct execution model
of device functions, and potententially remove unnecessary function calls to
`__kmpc_is_spmd_exec_mode`. In current device runtime, we have mixed use of
`isSPMDMode` and `__kmpc_is_spmd_exec_mode`, but in fact in `__kmpc_is_spmd_exec_mode`
it simply calls `isSPMDMode`. Since all functions starting with `__kmpc` is C
function, which doesn't have things like name mangling. It is more optimization
friendly. In this patch, we simply replaced all calls to `isSPMDMode` with
`__kmpc_is_spmd_exec_mode` to pave the way for the optimization.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D105211
Jon Roelofs [Wed, 30 Jun 2021 00:56:18 +0000 (17:56 -0700)]
[GISel] Support llvm.memcpy.inline
Differential revision: https://reviews.llvm.org/D105072
Suraj Sudhir [Wed, 30 Jun 2021 19:22:38 +0000 (12:22 -0700)]
[mlir][tosa] Use 3D tensors in tosa.matmul
Signed-off-by: Suraj Sudhir <suraj.sudhir@arm.com>
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D105213
Florian Hahn [Wed, 30 Jun 2021 18:41:57 +0000 (19:41 +0100)]
[BasicAA] Use separate scale variable for GCD.
Use separate variable for adjusted scale used for GCD computations. This
fixes an issue where we incorrectly determined that all indices are
non-negative and returned noalias because of that.
Follow up to
91fa3565da16.
Florian Hahn [Wed, 30 Jun 2021 17:00:36 +0000 (18:00 +0100)]
[BasicAA] Add test for incorrectly inferring noalias due to scale sign.
This patch adds a test where we currently incorrectly determine noalias,
because the sign of Scale is adjusted after
91fa3565da16.
LLVM GN Syncbot [Wed, 30 Jun 2021 18:49:16 +0000 (18:49 +0000)]
[gn build] Port
381ded345bdd
Nico Weber [Wed, 30 Jun 2021 18:49:00 +0000 (14:49 -0400)]
[gn build] (manually) port
f617ab104451 (DoublerPlugin)
Philip Reames [Wed, 30 Jun 2021 18:47:30 +0000 (11:47 -0700)]
autogen two tests for ease of update
Stanislav Mekhanoshin [Mon, 28 Jun 2021 20:24:24 +0000 (13:24 -0700)]
[AMDGPU] Add S_MOV_B64_IMM_PSEUDO for wide constants
This is to allow 64 bit constant rematerialization. If a constant
is split into two separate moves initializing sub0 and sub1 like
now RA cannot rematerizalize a 64 bit register.
This gives 10-20% uplift in a set of huge apps heavily using double
precession math.
Fixes: SWDEV-292645
Differential Revision: https://reviews.llvm.org/D104874
Xun Li [Wed, 30 Jun 2021 18:38:14 +0000 (11:38 -0700)]
[Coroutines] Add the newly generated SCCs back to the CGSCC work queue after CoroSplit actually happened
Relevant discussion can be found at: https://lists.llvm.org/pipermail/llvm-dev/2021-January/148197.html
In the existing design, An SCC that contains a coroutine will go through the folloing passes:
Inliner -> CoroSplitPass (fake) -> FunctionSimplificationPipeline -> Inliner -> CoroSplitPass (real) -> FunctionSimplificationPipeline
The first CoroSplitPass doesn't do anything other than putting the SCC back to the queue so that the entire pipeline can repeat.
As you can see, we run Inliner twice on the SCC consecutively without doing any real split, which is unnecessary and likely unintended.
What we really wanted is this:
Inliner -> FunctionSimplificationPipeline -> CoroSplitPass -> FunctionSimplificationPipeline
(note that we don't really need to run Inliner again on the ramp function after split).
Hence the way we do it here is to move CoroSplitPass to the end of the CGSCC pipeline, make it once for real, insert the newly generated SCCs (the clones) back to the pipeline so that they can be optimized, and also add a function simplification pipeline after CoroSplit to optimize the post-split ramp function.
This approach also conforms to how the new pass manager works instead of relying on an adhoc post split cleanup, making it ready for full switch to new pass manager eventually.
By looking at some of the changes to the tests, we can already observe that this changes allows for more optimizations applied to coroutines.
Reviewed By: aeubanks, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D95807
Ahmed Taei [Tue, 22 Jun 2021 19:50:10 +0000 (12:50 -0700)]
Add linalg.batch_matvec named op
Similarly to batch_mat vec outer most dim is a batching dim
and this op does |b| matrix-vector-products :
C[b, i] = sum_k(A[b, i, k] * B[b, k])
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D104739
Fangrui Song [Wed, 30 Jun 2021 18:35:50 +0000 (11:35 -0700)]
[ELF] Preserve section order within an INSERT AFTER command
For
```
SECTIONS {
text.0 : {}
text.1 : {}
text.2 : {}
} INSERT AFTER .data;
```
the current order is `.data text.2 text.1 text.0`. It makes more sense to
preserve the specified order and thus improve compatibility with GNU ld.
For
```
SECTIONS { text.0 : {} } INSERT AFTER .data;
SECTIONS { text.3 : {} } INSERT AFTER .data;
```
GNU ld somehow collects sections with `INSERT AFTER .data` together (IMO
inconsistent) but I think it makes more sense to execute the commands in order
and get `.data text.3 text.0` instead.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D105158
Leonard Chan [Wed, 30 Jun 2021 18:20:49 +0000 (11:20 -0700)]
[clang][Fuchsia] Remove relative-vtables multilibs
As of D102374, relative vtables is enabled on Fuchsia by default, so we don't need any of the RV multilibs.
Differential revision: https://reviews.llvm.org/D105145
David Green [Wed, 30 Jun 2021 18:19:03 +0000 (19:19 +0100)]
[ARM] Set the immediate cost of GEP operands to 0
This prevents constant gep operands from being hoisted by the Constant
Hoisting pass, leaving them to CodegenPrepare which can usually do a
better job at splitting large offsets. This can, in general, improve
performance and decrease codesize, especially for v6m where many
constants have a high cost.
Differential Revision: https://reviews.llvm.org/D104877
Michael Liao [Wed, 30 Jun 2021 18:03:14 +0000 (14:03 -0400)]
Fix shared build.
zhijian [Wed, 30 Jun 2021 17:56:37 +0000 (13:56 -0400)]
[AIX][XCOFF][BUG-Fixed] need to switch back to text section after emit a dumy eh structure
Summary:
in the patch https://reviews.llvm.org/D103651 [AIX][XCOFF] generate eh_info when vector registers are saved according to the traceback table.
when generate eh_info, it switch to other section, when it done, it need to switch back to text section again.
Reviewers: Jason Liu
Differential Revision: https://reviews.llvm.org/105195
Simon Pilgrim [Wed, 30 Jun 2021 15:22:53 +0000 (16:22 +0100)]
[X86] Canonicalize SGT/UGT compares with constants to use SGE/UGE to reduce the number of EFLAGs reads. (PR48760)
This demonstrates a possible fix for PR48760 - for compares with constants, canonicalize the SGT/UGT condition code to use SGE/UGE which should reduce the number of EFLAGs bits we need to read.
As discussed on PR48760, some EFLAG bits are treated independently which can require additional uops to merge together for certain CMOVcc/SETcc/etc. modes.
I've limited this to cases where the constant increment doesn't result in a larger encoding or additional i64 constant materializations.
Differential Revision: https://reviews.llvm.org/D101074
Sanjay Patel [Wed, 30 Jun 2021 17:32:53 +0000 (13:32 -0400)]
[InstCombine] fold icmp of offset value with constant
There must be a better way to describe this pattern in words?
(X + C2) >u C --> X <s -C2 (if C == C2 + SMAX)
This could be extended to handle the more general (non-constant)
pattern too:
https://alive2.llvm.org/ce/z/rdfNFP
define i1 @src(i8 %a, i8 %c1) {
%t = add i8 %a, %c1
%c2 = add i8 %c1, 127 ; SMAX
%ov = icmp ugt i8 %t, %c2
ret i1 %ov
}
define i1 @tgt(i8 %a, i8 %c1) {
%neg_c1 = sub i8 0, %c1
%ov = icmp slt i8 %a, %neg_c1
ret i1 %ov
}
The pattern was noticed as a by-product of D104932.
Sanjay Patel [Wed, 30 Jun 2021 17:00:08 +0000 (13:00 -0400)]
[InstCombine][test] add tests for icmp with constant and offset; NFC
Siva Chandra Reddy [Mon, 28 Jun 2021 07:25:21 +0000 (07:25 +0000)]
[libc] Allow reading and writing __FE_DENORM if available on x86_64.
Some libcs define __FE_DENORM on x86_64. This change allows reading the
bits corresponding to that non-standard exception.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D105004
Siva Chandra Reddy [Tue, 29 Jun 2021 06:37:56 +0000 (06:37 +0000)]
[libc] Clear all exceptions before setting in fesetexceptflag.
Previously, exceptions from the flag were being added. This patch
changes it such that only the exceptions in the flag will be set.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D105085
Philip Reames [Wed, 30 Jun 2021 17:25:41 +0000 (10:25 -0700)]
[instcombine] Precommit tests for umin(a,b) ne/eq 0 fold
Siva Chandra Reddy [Mon, 28 Jun 2021 23:52:01 +0000 (23:52 +0000)]
[libc] Fix feclearexcept for x86_64.
Previously, feclearexcept cleared all exceptions irrespective of the
argument. This change brings it in line with the aarch64 flavors wherein
only those exceptions listed in the argument will be cleared.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D105081
Philip Reames [Wed, 30 Jun 2021 17:18:38 +0000 (10:18 -0700)]
[instcombine] umin(x, 1) == zext(x != 0)
We already implemented this for the select form, but the intrinsic form was missing. Note that this doesn't change poison behavior as 1 is non-poison, and the optimized form is still poison exactly when x is.
Tomas Matheson [Fri, 25 Jun 2021 13:37:02 +0000 (14:37 +0100)]
[NPM] Resolve llvmGetPassPluginInfo to the plugin being loaded
Dynamically loaded plugins for the new pass manager are initialised by
calling llvmGetPassPluginInfo. This is defined as a weak symbol so that
it is continually redefined by each plugin that is loaded. When loading
a plugin from a shared library, the intention is that
llvmGetPassPluginInfo will be resolved to the definition in the most
recent plugin. However, using a global search for this resolution can
fail in situations where multiple plugins are loaded.
Currently:
* If a plugin does not define llvmGetPassPluginInfo, then it will be
silently resolved to the previous plugin's definition.
* If loading the same plugin twice with another in between, e.g. plugin
A/plugin B/plugin A, then the second load of plugin A will resolve to
llvmGetPassPluginInfo in plugin B.
* The previous case can also occur when a dynamic library defines both
NPM and legacy plugins; the legacy plugins are loaded first and then
with `-fplugin=A -fpass-plugin=B -fpass-plugin=A`: A will be loaded as
a legacy plugin and define llvmGetPassPluginInfo; B will be loaded
and redefine it; and finally when A is loaded as an NPM plugin it will
be resolved to the definition from B.
Instead of searching globally, restrict the symbol lookup to the library
that is currently being loaded.
Differential Revision: https://reviews.llvm.org/D104916