David Truby [Wed, 17 Mar 2021 08:55:42 +0000 (08:55 +0000)]
[MLIR][OpenMP] Pretty printer and parser for omp.wsloop
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D92327
Simon Pilgrim [Thu, 18 Mar 2021 13:31:20 +0000 (13:31 +0000)]
[X86][SSE] Regenerate PR18054 test case
Matt Arsenault [Sun, 14 Mar 2021 14:26:31 +0000 (10:26 -0400)]
GlobalISel: Preserve source value information for outgoing byval args
Pass through the original argument IR value in order to preserve the
aliasing information in the memcpy memory operands.
Matt Arsenault [Fri, 12 Mar 2021 16:06:18 +0000 (11:06 -0500)]
GlobalISel: Insert memcpy for outgoing byval arguments
byval requires an implicit copy between the caller and callee such
that the callee may write into the stack area without it modifying the
value in the parent. Previously, this was passing through the raw
pointer value which would break if the callee wrote into it.
Most of the time, this copy can be optimized out (however we don't
have the optimization SelectionDAG does yet).
This will trigger more fallbacks for AMDGPU now, since we don't have
legalization for memcpy yet (although we should stop using byval
anyway).
Alexey Bataev [Fri, 12 Mar 2021 15:39:53 +0000 (07:39 -0800)]
[SLP]Fix crash on extending scheduling region.
If SLP vectorizer tries to extend the scheduling region and runs out of
the budget too early, but still extends the region to the new ending
instructions (i.e., it was able to extend the region for the first
instruction in the bundle, but not for the second), the compiler need to
recalculate dependecies in full, just like if the extending was
successfull. Without it, the schedule data chunks may end up with the
wrong number of (unscheduled) dependecies and it may end up with the
incorrect function, where the vectorized instruction does not dominate
on the extractelement instruction.
Differential Revision: https://reviews.llvm.org/D98531
Alexey Lapshin [Sun, 27 Dec 2020 13:07:20 +0000 (16:07 +0300)]
[llvm-objcopy][NFC][Wasm] Do not use internal buffer while writing into the output.
This patch is follow-up for D91028. It implements direct writing into the
output stream for wasm.
Depends on D91028
Differential Revision: https://reviews.llvm.org/D95478
Martin Storsjö [Thu, 11 Mar 2021 21:44:16 +0000 (23:44 +0200)]
[compiler-rt] Produce the right arch suffix for arm libraries
If producing libraries with an arch suffix (i.e. if
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR isn't set), we append the
architecture name. However, for arm, clang doesn't look for libraries
with the full architecture name, but only looks for "arm" and "armhf".
Try to deduce what the full target triple might have been, and use
that for deciding between "arm" and "armhf".
This tries to reapply this bit from D98173, that had to be reverted
in
7b153b43d3a14d76975039408c4b922beb576735 due to affecting how
the builtins themselves are compiled, not only affecting the output
file name.
Differential Revision: https://reviews.llvm.org/D98452
Max Kazantsev [Thu, 18 Mar 2021 11:50:55 +0000 (18:50 +0700)]
[NFC] One more use case for evaluatePredicate
Max Kazantsev [Thu, 18 Mar 2021 11:48:10 +0000 (18:48 +0700)]
[NFC] Use evaluatePredicate in eliminateComparison
Just makes code simpler.
Max Kazantsev [Thu, 18 Mar 2021 11:28:14 +0000 (18:28 +0700)]
[SCEV][NFC] API for predicate evaluation
Provides API that allows to check predicate for being true or
false with one call. Current implementation is naive and just
calls isKnownPredicate twice, but further we can rework this
logic trying to use one check to prove both facts.
Thomas Preud'homme [Thu, 18 Mar 2021 10:45:55 +0000 (10:45 +0000)]
[test] Fix incorrect use of string variable use
LLVM test CodeGen/AArch64/machine-outliner-retaddr-sign-thunk.ll uses
a string substitution block that contains a regex matching block. This
seems like as a copy/paste from other similar test where the match also
defines a variable, hence the [[]] syntax. In this case however this is
a CHECK-NOT variable so nothing should match. No variable definition is
thus expected and the square brackets can be dropped.
Reviewed By: chill
Differential Revision: https://reviews.llvm.org/D98853
Sven van Haastregt [Thu, 18 Mar 2021 12:17:12 +0000 (12:17 +0000)]
[OpenCL] Remove spurious atomic_fetch tablegen builtins
The `int` and `long` versions of these builtins already provide the
necessary overloads for `intptr_t` and `uintptr_t` arguments, as
`ASTContext` defines `atomic_(u)intptr_t` in terms of the `int` or
`long` types.
Prior to this patch, calls to those builtins with particular argument
types resulted in call-is-ambiguous errors.
Differential Revision: https://reviews.llvm.org/D98520
Thomas Preud'homme [Thu, 18 Mar 2021 10:36:15 +0000 (10:36 +0000)]
[test] Fix variable definition in acle_sve_ld1.sh
Clang test acle_sve_ld1.sh is missing the colon in one of the string
variable definition separating the variable name from the regex. This
leads the substitution block to be parsed as a numeric variable use.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D98852
Sanjay Patel [Thu, 18 Mar 2021 12:09:28 +0000 (08:09 -0400)]
[LoopVectorize] relax FMF constraint for FP induction
This makes the induction part of the loop vectorizer match the reduction part.
We do not need all of the fast-math-flags. For example, there are some that
clearly are not in play like arcp or afn.
If we want to make FMF constraints consistent across the IR optimizer, we
might want to add nsz too, but that's up for debate (users can't expect
associative FP math and preservation of sign-of-zero at the same time?).
The calling code was fixed to avoid miscompiles with:
1bee549737ac
Differential Revision: https://reviews.llvm.org/D98708
Balazs Benics [Thu, 18 Mar 2021 12:06:38 +0000 (13:06 +0100)]
[clang][ASTImporter] Fix import of VarDecl regarding thread local storage spec
After the import, we did not copy the `TSCSpec`.
This commit resolves that.
Reviewed By: balazske
Differential Revision: https://reviews.llvm.org/D98707
Valeriy Savchenko [Thu, 18 Mar 2021 11:22:45 +0000 (14:22 +0300)]
[-Wcalled-once-parameter][NFC] Fix GCC compilation error
Elizabeth Andrews [Thu, 18 Mar 2021 09:58:35 +0000 (02:58 -0700)]
[Reland] "Do not apply calling conventions to MSVC entry points"
This patch is a second attempt at fixing a link error for MSVC
entry points when calling conventions are specified using a flag.
Calling conventions specified using flags should not be applied to MSVC
entry points. The default calling convention is set in this case. The
default calling convention for MSVC entry points main and wmain is cdecl.
For WinMain, wWinMain and DllMain, the default calling convention is
stdcall on 32 bit Windows.
Explicitly specified calling conventions are applied to MSVC entry points.
For MinGW, the default calling convention for all MSVC entry points is
cdecl.
First attempt:
4cff1b40dacf6
Revert of first attempt:
bebfc3b92d5e8
Differential Revision: https://reviews.llvm.org/D97941
Simon Pilgrim [Thu, 18 Mar 2021 11:15:44 +0000 (11:15 +0000)]
[AMDGPU] Regenerate atomic_optimizations_global_pointer.ll tests
Simon Pilgrim [Thu, 18 Mar 2021 11:07:16 +0000 (11:07 +0000)]
[ARM] Regenerate select-imm.ll tests
Alexey Lapshin [Thu, 11 Mar 2021 22:31:06 +0000 (01:31 +0300)]
[llvm-objcopy] remove split dwo file creation from executeObjcopyOnBinary.
This patch removes creation of the resulting file from the
executeObjcopyOnBinary() function. For the most use cases, the
executeObjcopyOnBinary receives output file as a parameter
- raw_ostream &Out. The splitting .dwo file is implemented differently:
file containg .dwo tables is created inside executeObjcopyOnBinary().
When objcopy functionality would be moved into separate library,
current implementation will become inconvenient. The goal of that
refactoring is to separate concerns: It might be convenient to
to do dwo tables splitting but to create resulting file differently.
Differential Revision: https://reviews.llvm.org/D98582
Simon Pilgrim [Thu, 18 Mar 2021 10:26:46 +0000 (10:26 +0000)]
[DAG] SelectionDAG::isSplatValue - add ISD::ABS handling
Add ISD::ABS to the existing unary instructions handling for splat detection
This is similar to D83605, but doesn't appear to need to touch any of the wasm refactoring.
Differential Revision: https://reviews.llvm.org/D98778
Fraser Cormack [Mon, 8 Feb 2021 15:33:23 +0000 (15:33 +0000)]
[RISCV] Support scalable-vector masked scatter operations
This patch adds support for masked scatter intrinsics on scalable vector
types. It is mostly an extension of the earlier masked gather support
introduced in D96263, since the addressing mode legalization is the
same.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D96486
Nigel Perks [Mon, 14 Sep 2020 17:17:11 +0000 (18:17 +0100)]
[Test][DebugInfo] Check for backend object emission support.
The XCore backend does not support object emission. Several tests fail for this
reason when XCore is the default target. See staging buildbot builder:
clang-xcore-ubuntu-20-x64.
So check for backend object emission before running the tests requiring it.
Incorporate isConfigurationSupported functionality in isObjectEmissionSupported,
to avoid calling them both in the same tests.
Differential Revision: https://reviews.llvm.org/D98400
Fraser Cormack [Thu, 4 Feb 2021 09:56:01 +0000 (09:56 +0000)]
[RISCV] Support scalable-vector masked gather operations
This patch supports the masked gather intrinsics in RVV.
The RVV indexed load/store instructions only support the "unsigned unscaled"
addressing mode; indices are implicitly zero-extended or truncated to XLEN and
are treated as byte offsets. This ISA supports the intrinsics directly, but not
the majority of various forms of the MGATHER SDNode that LLVM combines to. Any
signed or scaled indexing is extended to the XLEN value type and scaled
accordingly. This is done during DAG combining as widening the index types to
XLEN may produce illegal vectors that require splitting, e.g.
nxv16i8->nxv16i64.
Support for scalable-vector CONCAT_VECTORS was added to avoid spilling via the
stack when lowering split legalized index operands.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D96263
Valeriy Savchenko [Thu, 11 Mar 2021 11:22:47 +0000 (14:22 +0300)]
[-Wcalled-once-parameter] Fix false positives for cleanup attr
Cleanup attribute allows users to attach a destructor-like functions
to variable declarations to be called whenever they leave the scope.
The logic of such functions is not supported by the Clang's CFG and
is too hard to be reasoned about. In order to avoid false positives
in this situation, we assume that we didn't see ALL of the executtion
paths of the function and, thus, can warn only about multiple call
violation.
rdar://
74441906
Differential Revision: https://reviews.llvm.org/D98694
Vladislav Vinogradov [Wed, 3 Mar 2021 09:04:08 +0000 (12:04 +0300)]
[mlir][ODS] Get rid of limitations in rewriters generator
Do not limit the number of arguments in rewriter pattern.
Introduce separate `FmtStrVecObject` class to handle
format of variadic `std::string` array.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D97839
Wang, Pengfei [Thu, 18 Mar 2021 09:01:06 +0000 (17:01 +0800)]
[X86][NFC] Pre-commit test case for the fix of ldtilecfg insertion.
Bing1 Yu [Thu, 18 Mar 2021 09:07:49 +0000 (17:07 +0800)]
[X86][AMX][NFC] Give correct Passname for Tile Register Pre-configure
Valeriy Savchenko [Mon, 15 Mar 2021 19:00:07 +0000 (22:00 +0300)]
[-Wcalled-once-parameter] Harden analysis in terms of block use
This patch introduces a very simple inter-procedural analysis
between blocks and enclosing functions.
We always analyze blocks first (analysis is done as part of semantic
analysis that goes side-by-side with the parsing process), and at the
moment of reporting we don't know how that block will be actually
used.
This patch introduces new logic delaying reports of the "never called"
warnings on blocks. If we are not sure that the block will be called
exactly once, we shouldn't warn our users about that. Double calls,
however, don't require such delays. While analyzing the enclosing
function, we can actually decide what we should do with those
warnings.
Additionally, as a side effect, we can be more confident about blocks
in such context and can treat them not as escapes, but as direct
calls.
rdar://
74090107
Differential Revision: https://reviews.llvm.org/D98688
Fraser Cormack [Wed, 17 Mar 2021 12:33:59 +0000 (12:33 +0000)]
[RISCV] Support bitcasts of fixed-length mask vectors
Without this patch, bitcasts of fixed-length mask vectors would go
through the stack.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98779
Luo, Yuanke [Wed, 17 Mar 2021 11:17:18 +0000 (19:17 +0800)]
[X86] Fix compile time regression of D93594.
D93594 depend on the dominate tree and loop information. It increased
the compile time when build with -O0. However this is just to amend the
dominate tree and loop information, so that it is unnecessary to
re-analyze them again. Given the dominate tree of loop information are
absent in this pass, we can avoid amending them.
Differential Revision: https://reviews.llvm.org/D98773
Sjoerd Meijer [Tue, 16 Mar 2021 11:53:43 +0000 (11:53 +0000)]
[AArch64] Rewrite (add, csel) to cinc
Don't rewrite an add instruction with 2 SET_CC operands into a csel
instruction. The total instruction sequence uses an extra instruction and
register. Preventing this allows us to match a `(add, csel)` pattern and
rewrite this into a `cinc`.
Differential Revision: https://reviews.llvm.org/D98704
Markus Böck [Thu, 18 Mar 2021 08:24:49 +0000 (09:24 +0100)]
[CMake] Use compiler-rt location instead of resource directory to find clang-cls runtime directory
The current cmake script attempts to add the path containing clangs various runtime systems by getting the resource directory and then appending the hardcoded value /lib/windows to it. This works for a normal clang-cl build but fails for a build of clang using LLVM_ENABLE_PER_TARGET_RUNTIME_DIR, such as the builds from llvm/runtimes.
This patch instead uses -print-libgcc-file-name in conjunction with --rtlib=compiler-rt, and instead adds the containing directory as library path.
For non per-target runtime directory builds, such as the release builds, there is no change. Even if the builtins library were to be deleted or moved it would output the same path as before.
For per-target runtime builds that also have the builtins library, this now finds the correct directory containing all of clang runtime libraries.
Only case still not handled by this change, is if a per-target runtime directory build is used, but the builtins library was not built.
I believe that is the best we can do for now however, without modifying clang.
Differential Revision: https://reviews.llvm.org/D98786
Maxim Kuvyrkov [Thu, 18 Mar 2021 08:05:14 +0000 (08:05 +0000)]
Revert "[NFC] Minor cleanup to use default setting of getLastArg()"
The patch was wrong. We use "const Arg *A" at the end of
GetLinkerPath, so can't remove it.
This reverts commit
6802fdf8871f69d52b06d0a2b7f62f3af8292690.
Frederik Gossen [Thu, 18 Mar 2021 07:58:59 +0000 (08:58 +0100)]
[MLIR] Canonicalize broadcast operations on single shapes
This covers cases that are not folded away because the extent tensor type
becomes more concrete in the process.
Differential Revision: https://reviews.llvm.org/D98782
Maxim Kuvyrkov [Thu, 18 Mar 2021 07:47:16 +0000 (07:47 +0000)]
[NFC] Minor cleanup to use default setting of getLastArg()
Noticed this while I was looking at linker defaults.
Reviewed By: asl
Differential Revision: https://reviews.llvm.org/D98494
Maxim Kuvyrkov [Thu, 18 Mar 2021 07:42:41 +0000 (07:42 +0000)]
[WoA][MSVC] Use default linker setting in MSVC-compatible driver
At the moment "link.exe" is hard-coded as default linker in MSVC.cpp,
so there's no way to use LLD as default linker for MSVC driver.
This patch adds checking of CLANG_DEFAULT_LINKER to MSVC.cpp.
Reviewed By: asl
Differential Revision: https://reviews.llvm.org/D98493
Lang Hames [Thu, 18 Mar 2021 04:43:53 +0000 (21:43 -0700)]
[JITLink] Reformat an enum.
Lang Hames [Thu, 18 Mar 2021 04:19:13 +0000 (21:19 -0700)]
[JITLink] Improve out-of-range error messages.
Switches all backends to use the makeTargetOutOfRangeError function from
JITLink.h.
Artem Dergachev [Thu, 18 Mar 2021 03:34:34 +0000 (20:34 -0700)]
[analyzer] Introduce common bug category "Unused code".
This category is generic enough to hold a variety of checkers.
Currently it contains the Dead Stores checker and an alpha unreachable
code checker.
Differential Revision: https://reviews.llvm.org/D98741
Zakk Chen [Wed, 17 Mar 2021 14:56:55 +0000 (07:56 -0700)]
[RISCV][Clang] Add RVV vle/vse intrinsic functions.
Add new field PermuteOperands to mapping different operand order between
C/C++ API and clang builtin.
Reviewed By: craig.topper, rogfer01
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Differential Revision: https://reviews.llvm.org/D98388
Zakk Chen [Thu, 25 Feb 2021 08:15:14 +0000 (00:15 -0800)]
[Clang][RISCV] Add rvv vsetvl and vsetvlmax intrinsic functions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D96843
ShihPo Hung [Thu, 18 Mar 2021 02:08:46 +0000 (19:08 -0700)]
[RISCV] Fix isel pattern of masked vmslt[u]
This patch changes the operand order of masked vmslt[u]
from (mask, rs1, scalar, maskedoff, vl)
to (maskedoff, rs1, scalar, mask, vl).
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98839
Vitaly Buka [Thu, 18 Mar 2021 03:14:04 +0000 (20:14 -0700)]
[sanitizer] Grow buffer in SharedPrintfCodeNoBuffer
Krzysztof Parzyszek [Thu, 18 Mar 2021 02:37:40 +0000 (21:37 -0500)]
[ObjectYAML] Handle Hexagon V68
Vitaly Buka [Thu, 18 Mar 2021 02:40:45 +0000 (19:40 -0700)]
[NFC][sanitizer] Remove unneeded "explicit"
Krzysztof Parzyszek [Thu, 18 Mar 2021 02:14:35 +0000 (21:14 -0500)]
[Hexagon] Improve stack address base reuse for HVX spills
The offset in HVX loads/stores is only 4 bits long, so often an
extra register is needed to hold the address. Minimize the number
of such registers by "standardizing" the base addresses and reusing
preexisting base registers when replacing frame indices.
Krzysztof Parzyszek [Thu, 18 Mar 2021 01:57:37 +0000 (20:57 -0500)]
[Hexagon] Add more patterns for HVX loads and stores
In particular, add patterns for loads/stores to the stack
(with a frame index as address).
Chen Zheng [Thu, 18 Mar 2021 01:58:09 +0000 (21:58 -0400)]
[NFC] make XCOFF dwarf dump test run only on PowerPC target.
Chen Zheng [Tue, 16 Mar 2021 06:08:57 +0000 (02:08 -0400)]
[XCOFF][llvm-dwarfdump] llvm-dwarfdump support for XCOFF
Author: hubert.reinterpretcast, shchenz
Reviewed By: jasonliu, echristo
Differential Revision: https://reviews.llvm.org/D97186
Amara Emerson [Wed, 17 Mar 2021 18:34:56 +0000 (11:34 -0700)]
[GlobalISel] Don't DCE LIFETIME_START/LIFETIME_END markers.
These are pseudos without any users, so DCE was killing them in the combiner.
Marking them as having side effects doesn't seem quite right since they don't.
Gives a nice 0.3% geomean size win on CTMark -Os.
Differential Revision: https://reviews.llvm.org/D98811
Carl Ritson [Thu, 18 Mar 2021 00:31:39 +0000 (09:31 +0900)]
[AMDGPU] Avoid unnecessary graph visits during WQM marking
Avoid revisiting nodes with the same set of defined lanes by
using a unified visited set which integrates lanes into the key.
This retains the intent of the original code by still revisiting
a subgraph if a different set of lanes is defined and hence
marking might progress differently.
Note: default size of the visited set has been confirmed to
cover >99% of invocations in large array of test shaders.
Reviewed By: piotr
Differential Revision: https://reviews.llvm.org/D98772
River Riddle [Thu, 18 Mar 2021 00:36:42 +0000 (17:36 -0700)]
[mlir][Toy] Tidy up the first half of Chapter 2.
This performs a few rewordings, expands on a few parts, etc.
River Riddle [Thu, 18 Mar 2021 00:36:31 +0000 (17:36 -0700)]
[mlir][Toy] Update the tutorial to use tablegen for dialect declarations
This was missed when the feature was originally added.
Differential Revision: https://reviews.llvm.org/D87060
Rob Suderman [Wed, 17 Mar 2021 22:53:18 +0000 (15:53 -0700)]
[mlir][tosa] Add tosa.slice to std.subtensor lowering
Lowering to subtensor is added for tosa.slice operator.
Differential Revision: https://reviews.llvm.org/D98825
Alex Lorenz [Thu, 11 Mar 2021 22:54:47 +0000 (14:54 -0800)]
Revert "[CodeGenModule] Set dso_local for Mach-O GlobalValue"
This reverts commit
809a1e0ffd7af40ee27270ff8ba2ffc927330e71.
Mach-O doesn't support dso_local and this change broke XNU because of the use of dso_local.
Differential Revision: https://reviews.llvm.org/D98458
Richard Smith [Thu, 18 Mar 2021 00:20:46 +0000 (17:20 -0700)]
PR49619: Remove delayed call to noteFailed.
This would assert if we hit the evaluation step limit between starting
to delay the call and finishing. In any case, delaying the call was
largely pointless as it doesn't really matter when we mark the
evaluation as having had side effects.
Vitaly Buka [Tue, 16 Mar 2021 23:33:04 +0000 (16:33 -0700)]
[sanitizer] Remove max_len parameter from InternalScopedString
InternalScopedString uses InternalMmapVector internally
so it can be resized dynamically as needed.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D98751
Joel E. Denny [Wed, 17 Mar 2021 18:17:41 +0000 (14:17 -0400)]
[FileCheck] Fix redundant diagnostics due to numeric errors
Fixed substitution printing not to produce an empty diagnostic for
errors handled elsewhere.
Reviewed By: thopre
Differential Revision: https://reviews.llvm.org/D98088
Joel E. Denny [Wed, 17 Mar 2021 18:13:57 +0000 (14:13 -0400)]
[FileCheck] Fix numeric error propagation
A more general name might be match-time error propagation. That is,
it's conceivable we'll one day have non-numeric errors that require
the handling fixed by this patch.
Without this patch, FileCheck behaves as follows:
```
$ cat check
CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]
$ FileCheck -vv -dump-input=never check < input
check:1:54: remark: implicit EOF: expected string found in input
CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]
^
<stdin>:2:1: note: found here
^
check:1:15: error: unable to substitute variable or numeric expression: overflow error
CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]
^
$ echo $?
0
```
Notice that the exit status is 0 even though there's an error.
Moreover, FileCheck doesn't print the error diagnostic unless both
`-dump-input=never` and `-vv` are specified.
The same problem occurs when `CHECK-NOT` does have a match but a
capture fails due to overflow: exit status is 0, and no diagnostic is
printed unless both `-dump-input=never` and `-vv` are specified. The
usefulness of capturing from `CHECK-NOT` is questionable, but this
case should certainly produce an error.
With this patch, FileCheck always includes the error diagnostic and
has non-zero exit status for the above examples. It's conceivable
that this change will cause some existing tests to fail, but my
assumption is that they should fail. Moreover, with nearly every
project enabled, this patch didn't produce additional `check-all`
failures for me.
This patch also extends input dumps to include such numeric error
diagnostics for both expected and excluded patterns.
As noted in fixmes in some of the tests added by this patch, this
patch worsens an existing issue with redundant diagnostics. I'll fix
that bug in a subsequent patch.
Reviewed By: thopre, jhenderson
Differential Revision: https://reviews.llvm.org/D98086
Richard Smith [Wed, 17 Mar 2021 21:00:03 +0000 (14:00 -0700)]
PR49585: Emit the jump destination for a for loop 'continue' from within the scope of the condition variable.
The condition variable is in scope in the loop increment, so we need to
emit the jump destination from wthin the scope of the condition
variable.
For GCC compatibility (and compatibility with real-world 'FOR_EACH'
macros), 'continue' is permitted in a statement expression within the
condition of a for loop, though, so there are two cases here:
* If the for loop has no condition variable, we can emit the jump
destination before emitting the condition.
* If the for loop has a condition variable, we must defer emitting the
jump destination until after emitting the variable. We diagnose a
'continue' appearing in the initializer of the condition variable,
because it would jump past the initializer into the scope of that
variable.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D98816
Mike Rice [Wed, 17 Mar 2021 20:04:08 +0000 (13:04 -0700)]
[OPENMP51]Initial support for the use clause.
Added basic parsing/sema/serialization support for the 'use' clause.
Differential Revision: https://reviews.llvm.org/D98815
Arthur Eubanks [Wed, 17 Mar 2021 22:22:35 +0000 (15:22 -0700)]
Revert "[NewPM] Verify LoopAnalysisResults after a loop pass"
This reverts commit
6db3ab2903f42712f44000afb5aa467efbd25f35.
Causing too large of compile time regression.
Greg McGary [Sun, 14 Mar 2021 22:35:27 +0000 (15:35 -0700)]
[lld-macho][NFC] Minor refactor of Writer::run()
Move some functions closer to their uses. Move detailed address-assignment logic out of the otherwise abstract `Writer::run()`. This prepares the ground for a diff to implement branch range extension thunks.
* `SyntheticSections.cpp`
** move `needsBinding()` and `prepareBranchTarget()` into `Writer.cpp`
** move `addNonLazyBindingEntries()` adjacent to its use.
* `Writer.cpp`
** move address-assignment logic from `Writer::run()` into new function `Writer::assignAddresses()`
** move `needsBinding()` and `prepareBranchTarget()` from `SyntheticSections.cpp`
* `Target.h`
** remove orphaned decls of `prepareSymbolRelocation()` and `validateRelocationInfo()` which were moved to other files in earlier diffs.
Differential Revision: https://reviews.llvm.org/D98795
Amara Emerson [Tue, 16 Mar 2021 18:56:32 +0000 (11:56 -0700)]
[AArch64][GlobalISel] Fall back if disabling neon/fp in the translator.
The previous technique relied on early-exiting the legalizer predicate
initialization, leaving an empty rule table. That causes a fallback
for most instructions, but some have legacy rules defined like G_ZEXT
which can try continue, but then crash.
We should fall back earlier, in the translator, to avoid this issue.
Differential Revision: https://reviews.llvm.org/D98730
Steven Wu [Wed, 17 Mar 2021 22:05:51 +0000 (15:05 -0700)]
[Object][MachO] Handle end iterator in getSymbolType()
Fix a bug in MachOObjectFile::getSymbolType() that it is not checking if
the iterator is end() before deference the iterator. Instead, return
`Other` type, which aligns with the behavior of `llvm-nm`.
rdar://
75291638
Reviewed By: davide, ab
Differential Revision: https://reviews.llvm.org/D98739
Nathan James [Wed, 17 Mar 2021 22:03:07 +0000 (22:03 +0000)]
[ASTMatchers][NFC] Use move semantics when passing matchers around.
Changing matchers to use non-const members and adding r-value overloads of matcher conversions enables move optimisations.
I don't have performance figures but I can say this knocked 120k from the clang-tidy binary(86k was from the .text section) on a Release with assertions build(x86_64-unknown-linux-gnu).
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D98792
David Green [Wed, 17 Mar 2021 21:21:43 +0000 (21:21 +0000)]
[ARM] Add VREV MVE shuffle costs
This uses the shuffle mask cost from D98206 to give a better cost of MVE
VREV instructions. This helps especially in VectorCombine where the cost
of shuffles is used to reorder bitcasts, which this helps keep the phase
ordering test for fp16 reductions producing optimal code. The isVREVMask
has been moved to a header file to allow it to be used across target
transform and isel lowering.
Differential Revision: https://reviews.llvm.org/D98210
River Riddle [Wed, 17 Mar 2021 20:09:53 +0000 (13:09 -0700)]
[mlir][IR] Support parsing hex float values in the DialectSymbolParser
This has been a TODO for a while, and prevents breakages for attributes/types that contain floats that can't roundtrip outside of the hex format.
Differential Revision: https://reviews.llvm.org/D98808
Arthur Eubanks [Wed, 17 Mar 2021 19:21:59 +0000 (12:21 -0700)]
[NewPM] Verify LoopAnalysisResults after a loop pass
All loop passes should preserve all analyses in LoopAnalysisResults. Add
checks for those.
Note that due to PR44815, we don't check LAR's ScalarEvolution.
Apparently calling SE.verify() can change its results.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D98805
Ricky Taylor [Wed, 17 Mar 2021 20:30:39 +0000 (13:30 -0700)]
[M68k] Forward declare getMCInstrBeads in one place
At the moment `getMCInstrBeads` is forward-declared in a few places,
bring this together into a single header file.
This was done as part of the disassembler work, since the disassembler
would otherwise add one more forward declaration.
Differential Revision: https://reviews.llvm.org/D98533
Ricky Taylor [Wed, 17 Mar 2021 20:29:02 +0000 (13:29 -0700)]
[M68k] Use fixed asm string for MxPseudo instructions
This is required because empty strings are not allowed when generating
the assembly parser tables.
Differential Revision: https://reviews.llvm.org/D98532
Jon Roelofs [Wed, 17 Mar 2021 17:50:59 +0000 (10:50 -0700)]
[compiler-rt] -fsanitize=cfi is not supported on Darwin
This was responsible for:
Failed Tests (2):
cfi-devirt-x86_64 :: mfcall.cpp
cfi-standalone-x86_64 :: mfcall.cpp
Pavel Iliin [Wed, 17 Mar 2021 01:15:00 +0000 (01:15 +0000)]
[NFC][AArch64] Add codegen tests for various csinc-cmp sequences.
Simon Pilgrim [Wed, 17 Mar 2021 19:57:53 +0000 (19:57 +0000)]
[X86][SSE] Add SSE2/SSE42 test coverage to urem combine tests
Noticed when reviewing D88785
Nico Weber [Wed, 17 Mar 2021 15:56:13 +0000 (11:56 -0400)]
[lld-link] emit an error when writing a PDB > 4 GiB
Maybe there's a way to make them work, but until I've investigated
if tools can consume large PDBs, erroring out is better than slowly
and silently consuming all available ram due to internal invariants
being violated.
(Patch to make writing larger files work at
https://bugs.chromium.org/p/chromium/issues/detail?id=1179085#c25
but I haven't had time to check if windbg & co can consume these
large PDBs. llvm-pdbutil can't, but we can fix that one at least :) )
Differential Revision: https://reviews.llvm.org/D98788
Philip Reames [Wed, 17 Mar 2021 19:12:00 +0000 (12:12 -0700)]
[LCSSA] Extract a utility for deciding if a new use requires a new lcssa phi [NFC]
(Triggered by a review comment on D98728, but otherwise unrelated.)
Thomas Preud'homme [Tue, 15 Dec 2020 23:05:45 +0000 (23:05 +0000)]
[Test] Fix undef var in attr-speculative-load-hardening.c
Fix use of undefined variable in CHECK-NOT directive in clang test
CodeGen/attr-speculative-load-hardening.c.
Reviewed By: kristof.beyls
Differential Revision: https://reviews.llvm.org/D93347
Craig Topper [Wed, 17 Mar 2021 19:09:48 +0000 (12:09 -0700)]
[RISCV] Use getTargetExtractSubreg and getTargetInsertSubreg to simplify some code. NFCI
Jan Kratochvil [Wed, 17 Mar 2021 19:09:03 +0000 (20:09 +0100)]
[lldb/Docs] Update docs with new buildbot URLs
Michał Górny [Wed, 17 Mar 2021 18:22:58 +0000 (19:22 +0100)]
[lldb] [test] Skip vCont tests on Windows
Philip Reames [Wed, 17 Mar 2021 17:57:33 +0000 (10:57 -0700)]
[LICM] Fix a crash when sinking instructions w/token operands
It is not legal to form a phi node with token type. The generic LCSSA construction code handles this correctly - by not forming LCSSA for such cases - but the adhoc fixup implementation in LICM did not.
This was noticed in the context of PR49607, but can be demonstrated on ToT with the tweaked test case. This is not specific to gc.relocate btw, it also applies to usage of the preallocated family of intrinsics as well.
Differential Revision: https://reviews.llvm.org/D98728
Zakk Chen [Thu, 11 Mar 2021 16:01:04 +0000 (08:01 -0800)]
[RISCV] Update RVV shift intrinsic tests to use XLEN bit as shift amount.
Fix the unexpected of using op1's element type as shift amount type.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98501
David Green [Wed, 17 Mar 2021 17:46:26 +0000 (17:46 +0000)]
[TTI] Add a Mask to getShuffleCost
This adds an Mask ArrayRef to getShuffleCost, so that if an exact mask
can be provided a more accurate cost can be provided by the backend.
For example VREV costs could be returned by the ARM backend. This should
be an NFC until then, laying the groundwork for that to be added.
Differential Revision: https://reviews.llvm.org/D98206
Craig Topper [Wed, 17 Mar 2021 17:13:00 +0000 (10:13 -0700)]
[RISCV] Support masked load/store for fixed vectors.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98561
Aart Bik [Tue, 16 Mar 2021 18:05:09 +0000 (11:05 -0700)]
[mlir][cpu-runner] register all llvm ir dialects
This fixes broken JIT functionality on emulator platforms.
With Alex' recent movement towards squashing llvm ir dialects
into target specific dialects, we now must ensure these dialects
are registered to the cpu runner to ensure JIT can lower this
to proper LLVM IR before handing this off to the backend.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D98727
Aart Bik [Tue, 16 Mar 2021 20:37:34 +0000 (13:37 -0700)]
[mlir][amx] regression test for tile-muli (all zero/sign-extension combinations)
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D98742
Stephen Tozer [Wed, 17 Mar 2021 15:04:27 +0000 (15:04 +0000)]
Reapply "[DebugInfo] Handle multiple variable location operands in IR"
Fixed section of code that iterated through a SmallDenseMap and added
instructions in each iteration, causing non-deterministic code; replaced
SmallDenseMap with MapVector to prevent non-determinism.
This reverts commit
01ac6d1587e8613ba4278786e8341f8b492ac941.
Mike Rice [Mon, 15 Mar 2021 20:09:46 +0000 (13:09 -0700)]
[OPENMP51]Initial support for the interop directive.
Added basic parsing/sema/serialization support for interop directive.
Support for the 'init' clause.
Differential Revision: https://reviews.llvm.org/D98558
Bardia Mahjour [Wed, 17 Mar 2021 16:36:55 +0000 (12:36 -0400)]
[CGSCC] Print CG node itself instead of its address
Fix the debug output from cgscc
Fangrui Song [Wed, 17 Mar 2021 16:32:44 +0000 (09:32 -0700)]
[ELF] Special case --shuffle-sections=-1 to reverse input sections
If the number of sections changes, which is common for re-links after
incremental updates, the section order may change drastically.
Special case -1 to reverse input sections. This is a stable transform.
The section order is more resilient to incremental updates. Usually the
code issue (e.g. Static Initialization Order Fiasco, assuming pointer
comparison result of two unrelated objects) is due to the relative order
between two problematic input files A and B. Checking the regular order
and the reversed order is sufficient.
Differential Revision: https://reviews.llvm.org/D98445
Michał Górny [Tue, 16 Mar 2021 23:04:06 +0000 (00:04 +0100)]
[lldb] [test] Fix TestGdbRemote_vContThreads.py logic
The TestGdbRemote_vContThreads.py were introduced to test NetBSD process
plugin's capability of sending per-thread and per-process signals.
However, at some point the tests started failing. From retrospective,
it is possible that they were relying on some bug in the plugin's
original signal handling.
Fix the tests not to expect the process to terminate after receiving
the signals. Instead, scan for output indicating that the signals were
received and match thread IDs in it. Enable 'signal to all threads'
test everywhere as it works fine on Linux. Add a new test for vCont
packet without specific thread IDs. Introduce a helper function
to cover the common part of tests.
While this does not fix all the problems on NetBSD, it enables a subset
of the tests on other systems. I am planning to add more tests
to the group while implementing multiprocess extension for vCont.
Differential Revision: https://reviews.llvm.org/D98749
Eric Astor [Wed, 17 Mar 2021 16:10:11 +0000 (12:10 -0400)]
[ms] [llvm-ml] Allow the /Zs parameter as a synonym for -filetype=null
For ml.exe, /Zs implies a syntax check with no output files.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D90061
David Spickett [Wed, 17 Mar 2021 15:45:37 +0000 (15:45 +0000)]
[lldb] Correct unsigned decimal argument check in memory write
getAsInteger returns false when it succeeds.
Before:
(lldb) memory write 0x00007ffff7dd3000 99 -f "unsigned decimal"
error: '99' is not a valid unsigned decimal string value.
After:
(lldb) memory write 0x00007ffff7dd3000 99 -f "unsigned decimal"
(lldb) memory read 0x00007ffff7dd3000 0x00007ffff7dd3001
0x7ffff7dd3000: 63 c
LemonBoy [Wed, 17 Mar 2021 15:59:55 +0000 (16:59 +0100)]
[LoopVectorize] Refine hasIrregularType predicate
The `hasIrregularType` predicate checks whether an array of N values of type Ty is "bitcast-compatible" with a <N x Ty> vector.
The previous check returned invalid results in some cases where there's some padding between the array elements: eg. a 4-element array of u7 values is considered as compatible with <4 x u7>, even though the vector is only loading/storing 28 bits instead of 32.
The problem causes LLVM to generate incorrect code for some targets: for AArch64 the vector loads/stores are lowered in terms of ubfx/bfi, effectively losing the top (N * padding bits).
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D97465
Luís Marques [Wed, 17 Mar 2021 15:57:00 +0000 (15:57 +0000)]
[Sanitizer] Fix debug builds of sanitizer_stacktrace_test.cpp
An implementation of `__sanitizer::BufferedStackTrace::UnwindImpl` is
provided per sanitizer, but there isn't one for sanitizer-common. In
non-optimized builds of the sanitizer-common tests that becomes a problem:
the test `sanitizer_stacktrace_test.cpp` won't have a reference to that
method optimized away, causing linking errors. This patch provides a dummy
implementation, which fixes those builds.
Differential Revision: https://reviews.llvm.org/D96956
David Green [Wed, 17 Mar 2021 15:29:02 +0000 (15:29 +0000)]
[ARM] Use lrdsb for more thumb1 loads.
Given a sextload i16, we can usually generate "ldrsh [rn. rm]". If we
don't naturally have a rn, rm addressing mode, we can either generate
"ldrh [rn, #0]; sxth" or "mov rm, #0; ldrsh [rn. rm]".
We currently generate the first, always creating a sxth. They are both
the same number of instructions, but if we generate the second then the
mov #0 will likely be CSE'd or pulled out of a loop, etc.
This adjusts the ISel patterns to do that, creating a mov instead of a
sxth.
Differential Revision: https://reviews.llvm.org/D98693
Ahmed Taei [Sat, 6 Mar 2021 04:54:01 +0000 (20:54 -0800)]
Add arm_neon.sdot operation
Differential Revision: https://reviews.llvm.org/D98198
Simon Pilgrim [Wed, 17 Mar 2021 14:26:25 +0000 (14:26 +0000)]
[DAG] TargetLowering::isBinOp() - add ISD::SSUBSAT/USUBSAT
Add to the generic non-commutative binop list.
Paul Robinson [Fri, 12 Mar 2021 16:47:48 +0000 (08:47 -0800)]
[RGT] RPCUtilsTest, replace un-executed EXPECT with unreachable
Unreachable code should be self-documented as unreachable.
Found by the Rotten Green Tests project.
Differential Revision: https://reviews.llvm.org/D98518