serge-sans-paille [Mon, 15 Mar 2021 17:18:55 +0000 (18:18 +0100)]
[NFC] Use higher level constructs to check for whitespace/newlines in the lexer
It turns out that according to valgrind and perf, it's also slightly faster.
Differential Revision: https://reviews.llvm.org/D98637
Luke Drummond [Wed, 10 Mar 2021 18:14:42 +0000 (18:14 +0000)]
[OpenCL] Respect calling convention for builtin
`__translate_sampler_initializer` has a calling convention of
`spir_func`, but clang generated calls to it using the default CC.
Instruction Combining was lowering these mismatching calling conventions
to `store i1* undef` which itself was subsequently lowered to a trap
instruction by simplifyCFG resulting in runtime `SIGILL`
There are arguably two bugs here: but whether there's any wisdom in
converting an obviously invalid call into a runtime crash over aborting
with a sensible error message will require further discussion. So for
now it's enough to set the right calling convention on the runtime
helper.
Reviewed By: svenh, bader
Differential Revision: https://reviews.llvm.org/D98411
Andrzej Warzynski [Mon, 15 Mar 2021 17:24:35 +0000 (17:24 +0000)]
[flang][docs] Fix the time for the new Flang driver call
Martin Storsjö [Fri, 26 Feb 2021 13:15:36 +0000 (15:15 +0200)]
[libcxx] [test] Fix the temp_directory_path test for windows
Check a different set of env vars, don't check the exact value
of the fallback path. (GetTempPath falls back to returning the Windows
folder if nothing better is available in env vars.)
The test still fails one check on windows (due to relying on perms::none),
which will be addressed separately.
Differential Revision: https://reviews.llvm.org/D98139
Juneyoung Lee [Tue, 16 Mar 2021 00:20:49 +0000 (09:20 +0900)]
[AssumeBundles] Add nonnull/align to op bundle if noundef exists
This is a patch to add nonnull and align to assume's operand bundle
only if noundef exists.
Since nonnull and align in fn attr have poison semantics, they should be
paired with noundef or noundef-implying attributes to be immediate UB.
Reviewed By: jdoerfert, Tyker
Differential Revision: https://reviews.llvm.org/D98228
Fraser Cormack [Fri, 12 Mar 2021 11:22:29 +0000 (11:22 +0000)]
[CodeGen] Fix issues with scalable-vector INSERT/EXTRACT_SUBVECTORs
This patch addresses a few issues when dealing with scalable-vector
INSERT_SUBVECTOR and EXTRACT_SUBVECTOR nodes.
When legalizing in DAGTypeLegalizer::SplitVecRes_INSERT_SUBVECTOR, we
store the low and high halves to the stack separately. The offset for
the high half was calculated incorrectly.
Additionally, we can optimize this process when we can detect that the
subvector is contained entirely within the low/high split vector type.
While this optimization is valid on scalable vectors, when performing
the 'high' optimization, the subvector must also be a scalable vector.
Note that the 'low' optimization is still conservative: it may be
possible to insert v2i32 into the low half of a split nxv1i32/nxv1i32,
but we can't guarantee it. It is always possible to insert v2i32 into
nxv2i32 or v2i32 into nxv4i32+2 as we know vscale is at least 1.
Lastly, in SelectionDAG::isSplatValue, we early-exit on the extracted subvector value
type being a scalable vector, forgetting that we can also extract a
fixed-length vector from a scalable one.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98495
Kevin Zhou [Mon, 15 Mar 2021 13:15:02 +0000 (08:15 -0500)]
[Polly] Refactoring astScheduleDimIsParallel to take the C++ wrapper object. NFC
Polly currently needs to be slowly refactor to use the C++ wrapper objects to handle the reference counters automatically.
I took the function of astScheduleDimIsParallel and refactored it so that it uses the C++ wrapper function as much as possible.
There are some problems with the IsParallel since it expects the C objects, so the C++ wrapper functions must be .release() and .get() first before they are able to be used with IsParallel.
When checking the ReductionDependencies Parallelism with the Build's Schedule, I opted to keep the union map as a C object rather than a C++ object. Eventually, changes will need to be made to IsParallel to refactor it to the C++ wrappers. When this is done, this function will also need to be slightly refactored to not use the C object.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98455
Jon Chesterfield [Mon, 15 Mar 2021 16:54:56 +0000 (16:54 +0000)]
[libomptarget][amdgcn] Drop use of inttypes.h, moving closer to freestanding
[libomptarget][amdgcn] Drop use of inttypes.h, moving closer to freestanding
The glibc headers are a periodic source of problems compiling the devicertl.
This patch resolves the following error run into while building llvm on a slightly
different linux system.
```
In file included from .../lib/clang/13.0.0/include/inttypes.h:21:
In file included from /usr/include/inttypes.h:25:
/usr/include/features.h:461:12: fatal error: 'sys/cdefs.h' file not found
# include <sys/cdefs.h>
^~~~~~~~~~~~~
```
As a second patch, removing assert.h from shuffle will let amdgcn build as
-ffreestanding, at which point only the headers that clang itself provides are
used and interactions with the host glibc are eliminated. Doing the same for
nvptx is complicated by printf handling but also seems worthwhile.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D98565
Martin Storsjö [Thu, 25 Feb 2021 10:43:36 +0000 (12:43 +0200)]
[libcxx] [test] Fix the get_temp_file_name() function for mingw
Add the missing includes for getting the defines and functions used
in the mingw version of get_temp_file_name().
This fixes 31 tests when built in a mingw configuration.
Also remove a redundant ifdef; _WIN32 is defined in mingw targets too.
Differential Revision: https://reviews.llvm.org/D97456
Martin Storsjö [Thu, 25 Feb 2021 21:06:18 +0000 (23:06 +0200)]
[libcxx] [test] Disable some allocation checks in class.path tests on windows
On windows, the path internal representation is wchar_t, and
input/output often goes through utf8 inbetween, which causes extra
allocations.
MS STL also fails a number of strict allocation checks, so this
shouldn't be a standards compliance issue.
Differential Revision: https://reviews.llvm.org/D98398
Nico Weber [Mon, 15 Mar 2021 16:50:45 +0000 (12:50 -0400)]
[gn build] (semi-manually) port
b136a74efc54
Christopher Tetreault [Mon, 15 Mar 2021 16:33:31 +0000 (09:33 -0700)]
[CMake] Require python 3.6 if enabling LLVM test targets
The lit test suite uses python 3.6 features. Rather than a strange
python syntax error upon running the lit tests, we will require the
correct version in CMake.
Reviewed By: serge-sans-paille, yln
Differential Revision: https://reviews.llvm.org/D95635
Craig Topper [Mon, 15 Mar 2021 16:20:26 +0000 (09:20 -0700)]
[RISCV] Improve legalization of i32 UADDO/USUBO on RV64.
The default legalization uses zero extends that require pair of shifts
on RISCV. Instead we can take advantage of the fact that unsigned
compares work equally well on sign extended inputs. This allows
us to use addw/subw and sext.w.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D98233
Simon Pilgrim [Mon, 15 Mar 2021 16:15:05 +0000 (16:15 +0000)]
[X86][SSE] isHorizontalBinOp - ensure we clear any unused source operands to improve HADD/SUB matching
Our shuffle matching for HADD/SUB patterns wasn't clearing repeated ops in 'fake unary' style shuffle masks (unpack(x,x) etc.), preventing matching of add(fakeunary(),fakeunary()) style patterns.
Alex Zinenko [Mon, 15 Mar 2021 16:19:37 +0000 (17:19 +0100)]
[mlir] make memref.cast implement ViewLikeOpInterface
This was seemingly dropped in
e2310704d890ad252aeb1ca28b4b84d29514b1d1,
potentially due to a misrebase. The absence of this trait makes aliasing
analysis incorrect, leading to, e.g., buffer deallocation pass inserting
deallocations too early.
Jianzhou Zhao [Wed, 10 Mar 2021 06:31:56 +0000 (06:31 +0000)]
[dfsan] Add origin ABI wrappers for thread/signal/fork
This is a part of https://reviews.llvm.org/D95835.
See https://github.com/llvm/llvm-project/commit/
bb91e02efd00eda04296069a83228c8d9db105b7 about the similar issue of fork in MSan's origin tracking.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D98359
Zahira Ammarguellat [Mon, 15 Mar 2021 16:15:34 +0000 (12:15 -0400)]
[NFC] Fix "unused parameter" error revealed in the Linux self-build.
Melanie Blower [Mon, 15 Mar 2021 14:06:33 +0000 (10:06 -0400)]
[clang][patch] Solve PR49479, File scope fp pragma should propagate to functions nested in struct, and initialization expressions
Previously, the CurFPFeatures state was set to command line settings before
semantic analysis of the nested member functions and initialization
expressions, that's not correct, it should use the pragma state which
is in effect at the lexical position.
Reviewed By: Erich Keane, Aaron Ballman
Differential Revision: https://reviews.llvm.org/D98211
Sanjay Patel [Mon, 15 Mar 2021 15:44:53 +0000 (11:44 -0400)]
[InstSimplify] ctlz({signbit} >>u x) --> x
The motivating pattern was handled in
0a2d69480d ,
but we should have this for symmetry.
But this really highlights that we could generalize for
any shifted constant if we match this in instcombine.
https://alive2.llvm.org/ce/z/MrmVNt
Sanjay Patel [Mon, 15 Mar 2021 15:20:27 +0000 (11:20 -0400)]
[InstSimplify] add tests for ctlz of shifted constant; NFC
Edward Jones [Thu, 12 Nov 2020 16:33:03 +0000 (16:33 +0000)]
[RISCV][compiler-rt] Add support for save-restore
This adds the compiler-rt entry points required by the
-msave-restore option.
Differential Revision: https://reviews.llvm.org/D91717
Thomas Preud'homme [Wed, 9 Dec 2020 22:18:32 +0000 (22:18 +0000)]
Stop traping on sNaN in __builtin_isinf
__builtin_isinf currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.
Reviewed By: mibintc
Differential Revision: https://reviews.llvm.org/D97125
Martin Storsjö [Sun, 21 Feb 2021 23:20:28 +0000 (01:20 +0200)]
[libcxx] [docs] Update docs about how to build for Windows
Refresh the existing paragraphs on building in MSVC configurations,
add a sample of one working configuration for MinGW, and add more
details on what's necessary to run the tests these days.
Differential Revision: https://reviews.llvm.org/D97166
LLVM GN Syncbot [Mon, 15 Mar 2021 15:24:41 +0000 (15:24 +0000)]
[gn build] Port
13e49dcee48f
Jon Chesterfield [Mon, 15 Mar 2021 15:24:00 +0000 (15:24 +0000)]
[amdgpu] Implement lower function LDS pass
[amdgpu] Implement lower function LDS pass
Local variables are allocated at kernel launch. This pass collects global
variables that are used from non-kernel functions, moves them into a new struct
type, and allocates an instance of that type in every kernel. Uses are then
replaced with a constantexpr offset.
Prior to this pass, accesses from a function are compiled to trap. With this
pass, most such accesses are removed before reaching codegen. The trap logic
is left unchanged by this pass. It is still reachable for the cases this pass
misses, notably the extern shared construct from hip and variables marked
constant which survive the optimizer.
This is of interest to the openmp project because the deviceRTL runtime library
uses cuda shared variables from functions that cannot be inlined. Trunk llvm
therefore cannot compile some openmp kernels for amdgpu. In addition to the
unit tests attached, this patch applied to ROCm llvm with fixed-abi enabled
and the function pointer hashing scheme deleted passes the openmp suite.
This lowering will use more LDS than strictly necessary. It is intended to be
a functionally correct fallback for cases that are difficult to target from
future optimisation passes.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D94648
Kostya Kortchinsky [Thu, 11 Mar 2021 22:42:30 +0000 (14:42 -0800)]
[scudo][standalone] Add shared library to makefile
Since we are looking to remove the old Scudo, we have to have a .so for
parity purposes as some platforms use it.
I tested this on Fuchsia & Linux, not on Android though.
Differential Revision: https://reviews.llvm.org/D98456
Tim Keith [Mon, 15 Mar 2021 15:02:58 +0000 (08:02 -0700)]
[flang] Build intrinsic .mod files in include/flang
The build was putting .mod files for intrinsic modules in
tools/flang/include/flang but the install puts them in include/flang,
as does the out-of-tree build. This confused things for the driver.
This change makes the build consistent with the install and simplifies
the flang script accordingly.
Also, clean up the cmake commands for building the .mod files.
Differential Revision: https://reviews.llvm.org/D98522
Simon Pilgrim [Mon, 15 Mar 2021 14:50:26 +0000 (14:50 +0000)]
[X86][SSE] canonicalizeShuffleWithBinOps - handle target shuffles.
Fold SHUFFLE(BINOP(SHUFFLE(X),SHUFFLE(Y))) -> BINOP(SHUFFLE'(X),SHUFFLE'(Y)) style patterns as well as the existing shuffles of constants.
Vy Nguyen [Sat, 13 Mar 2021 02:00:11 +0000 (21:00 -0500)]
[asan] Fixed test failing on windows due to different printf behaviour.
%p reported prints upper case hex chars on Windows.
The fix is to switch to using %#lx
Differential Revision: https://reviews.llvm.org/D98570
David Green [Mon, 15 Mar 2021 14:56:20 +0000 (14:56 +0000)]
[AArch64] Zero extended extract_vector_elt pattern
This adds a pattern for i64 zext_inreg(i32 extract_vector_elt X),
producing a single UMOVvi16 instruction that is already expected to
clear the top bits. The exact pattern that this matches is
and(anyext(vector_extract X, lane), 0xff), similar to the sext patterns
higher up in the same file.
Differential Revision: https://reviews.llvm.org/D98599
Dmitry Polukhin [Fri, 26 Feb 2021 17:07:20 +0000 (09:07 -0800)]
[clang-tidy] Enable modernize-concat-nested-namespaces also on headers
For some reason the initial implementation of the check had an explicit check
for the main file to avoid being applied in headers. This diff removes this
check and add a test for the check on a header.
Similar approach was proposed in D61989 but review there got stuck.
Test Plan: added new test case
Differential Revision: https://reviews.llvm.org/D97563
Nathan James [Mon, 15 Mar 2021 14:20:47 +0000 (14:20 +0000)]
[clang-tidy] Fix readability-identifer-naming duplicating prefix or suffix for replacements.
If a identifier has a correct prefix/suffix but a bad case, the fix won't strip them when computing the correct case, leading to duplication when the are added back.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D98521
Nathan James [Mon, 15 Mar 2021 14:16:51 +0000 (14:16 +0000)]
[ASTMatchers] Don't forward matchers in MapAnyOf
Forwarding these means that if an r-value reference is passed, the matcher will be moved. However it appears this happens for each mapped node matcher, resulting in use-after-move issues.
Reviewed By: steveire
Differential Revision: https://reviews.llvm.org/D98497
Jan Svoboda [Mon, 15 Mar 2021 14:07:53 +0000 (15:07 +0100)]
[clang][lex] Speculative fix for buffer overrun on raw string parse
This attempts to fix a (non-deterministic) buffer overrun when parsing raw string literals during modular build.
Similar fix to
4e5b5c36f47c9a406ea7f6b4f89fae477693973a.
Reviewed By: beccadax
Differential Revision: https://reviews.llvm.org/D94950
Amy Kwan [Mon, 15 Mar 2021 06:07:42 +0000 (01:07 -0500)]
[NFC][PowerPC] Add additional load/store test cases
This patch adds additional load/store test cases involving scalars, vectors,
and PC-Rel in preparation for the refactored load and store implementation
introduced in D93370.
Differential Revision: https://reviews.llvm.org/D97391
Alex Zinenko [Mon, 15 Mar 2021 13:40:01 +0000 (14:40 +0100)]
[mlir] fix integration tests post
e2310704d890ad252aeb1ca28b4b84d29514b1d1
The commit in question moved some ops across dialects but did not update
some of the target-specific integration tests that use these ops,
presumably because the corresponding target hardware was not available.
Fix these tests.
Wael Yehia [Mon, 15 Mar 2021 13:34:20 +0000 (09:34 -0400)]
[PATCH] fix location of test case
from D97507.
Muiez Ahmed [Mon, 15 Mar 2021 13:23:36 +0000 (09:23 -0400)]
[SystemZ][z/OS] Define _LIBCPP_ELAST
The aim is to define _LIBCPP_ELAST for z/OS libc++ since strerror/strerror_r can't handle out-of-range errno values.
Differential Revision: https://reviews.llvm.org/D98541
Alex Zinenko [Mon, 15 Mar 2021 13:06:25 +0000 (14:06 +0100)]
[mlir] enable Python bindings for the MemRef dialect
A previous commit moved multiple ops from Standard to MemRef dialect.
Some of these ops are exercised in Python bindings. Enable bindings for
the newly created MemRef dialect and update a test accordingly.
Nathan James [Mon, 15 Mar 2021 13:07:39 +0000 (13:07 +0000)]
[ASTMatchers][Dynamic] Add missing matchers from Registry
Add the `fixedPointLiteral`, `hasAnyBody` and `templateArgumentLoc` to the dynamic matcher registry.
Reviewed By: steveire
Differential Revision: https://reviews.llvm.org/D98556
Nathan James [Mon, 15 Mar 2021 13:06:48 +0000 (13:06 +0000)]
[ASTMatchers] Fix documentation for hasAnyBody matcher
Looks like a oversight when the matcher was added.
Reviewed By: steveire
Differential Revision: https://reviews.llvm.org/D98583
Luís Marques [Mon, 15 Mar 2021 13:01:26 +0000 (13:01 +0000)]
Revert "[Sanitizer][RISCV][AArch64][Android] Adjust allocator tests"
This reverts commit
a00347b56e36b30b26f9e54e947b965acf2b7eec due to a
test failure on the `sanitizer-x86_64-linux-android` buildbot.
Anton Afanasyev [Mon, 15 Mar 2021 12:52:07 +0000 (15:52 +0300)]
[SLP][Test] Precommit test for PR40522
Nico Weber [Mon, 15 Mar 2021 12:44:05 +0000 (08:44 -0400)]
[ast-dump-tool] fix regression if --empty-implementation but --json-input-path is not
Looks like this broke in one of the relands of
https://reviews.llvm.org/D93164
Carl Ritson [Mon, 15 Mar 2021 12:32:09 +0000 (21:32 +0900)]
[AMDGPU] Fix shortfalls in WQM marking
When tracking defined lanes through phi nodes in the live range
graph each branch of the phi must be handled independently.
Also rewrite the marking algorithm to reduce unnecessary
operations.
Previously a shared set of defined lanes was used which caused
marking to stop prematurely. This was observable in existing lit
tests, but test patterns did not cover this detail.
Reviewed By: piotr
Differential Revision: https://reviews.llvm.org/D98614
Simon Pilgrim [Mon, 15 Mar 2021 12:38:03 +0000 (12:38 +0000)]
[X86][SSE] canonicalizeShuffleWithBinOps - add X86ISD::PSHUFB handling.
Recommit rGcd938ab162b0ac560dd0e9fee290980c7e0e47e5 with an early-out if the pshub would introduce zeros across the binop.
Alex Zinenko [Mon, 15 Mar 2021 12:32:36 +0000 (13:32 +0100)]
[mlir] fix shared-lib build fallout of
e2310704d890ad252aeb1ca28b4b84d29514b1d1
The patch in question broke the build with shared libraries due to
missing dependencies, one of which would have been circular between
MLIRStandard and MLIRMemRef if added. Fix this by moving more code
around and swapping the dependency direction. MLIRMemRef now depends on
MLIRStandard, but MLIRStandard does _not_ depend on MLIRMemRef.
Arguably, this is the right direction anyway since numerous libraries
depend on MLIRStandard and don't necessarily need to depend on
MLIRMemref.
Other otable changes include:
- some EDSC code is moved inline to MemRef/EDSC/Intrinsics.h because it
creates MemRef dialect operations;
- a utility function related to shape moved to BuiltinTypes.h/cpp
because it only realtes to shaped types and not any particular dialect
(standard dialect is erroneously believed to contain MemRefType);
- a Python test for the standard dialect is disabled completely because
the ops it tests moved to the new MemRef dialect, but it is not
exposed to Python bindings, and the change for that is non-trivial.
Bradley Smith [Thu, 28 Jan 2021 12:39:39 +0000 (12:39 +0000)]
[AArch64][SVE] Add unpredicated ld1/st1 patterns for reg+reg addressing modes
Differential Revision: https://reviews.llvm.org/D95677
Simon Pilgrim [Mon, 15 Mar 2021 12:23:32 +0000 (12:23 +0000)]
Revert rG9ba577eca2e339726bfaad4e615c6324a705b292 "[X86][SSE] canonicalizeShuffleWithBinOps - handle target shuffles. NFCI."
Sorry this wasn't supposed to be committed yet (and certainly not tagged as NFCI....)
Nikita Popov [Mon, 15 Mar 2021 12:12:39 +0000 (13:12 +0100)]
Revert "[NFCI][ValueTracking] getUnderlyingObject(): gracefully handle cycles"
This reverts commit
aa440ba24dc25e4c95f6dcf8ff647024f3b12661.
This has a non-trivial compile-time impact:
https://llvm-compile-time-tracker.com/compare.php?from=
0c5b789c7342ee8384507c3242fc256e23248c4d&to=
aa440ba24dc25e4c95f6dcf8ff647024f3b12661&stat=instructions
I don't believe this is the correct way to address the issue in
this case.
Simon Pilgrim [Mon, 15 Mar 2021 11:24:07 +0000 (11:24 +0000)]
[X86][SSE] canonicalizeShuffleWithBinOps - handle target shuffles. NFCI.
Fold SHUFFLE(BINOP(SHUFFLE(X),SHUFFLE(Y))) -> BINOP(SHUFFLE'(X),SHUFFLE'(Y)) style patterns as well as the existing shuffles of constants.
OCHyams [Mon, 15 Mar 2021 11:28:28 +0000 (11:28 +0000)]
[dexter] Check path != None before calling os.path.exists
The test optnone-simple-functions.cpp added in D97668 fails on macOS.
os.path.exists raises an exception because we pass it None. Guard against this.
Related revision: https://reviews.llvm.org/D97668
Muhammad Omair Javaid [Mon, 15 Mar 2021 11:01:02 +0000 (16:01 +0500)]
[LLDB] Skip TestExitDuringExpression on arm/linux buildbot
TestExitDuringExpression test_exit_before_one_thread_unwind fails
sporadically on arm/linux. This seems like a thread timing issue.
I am marking it skip for now.
Luís Marques [Mon, 15 Mar 2021 11:01:20 +0000 (11:01 +0000)]
[Sanitizer][RISCV][AArch64][Android] Adjust allocator tests
On 64-bit systems with small VMAs (e.g. 39-bit) we can't use
`SizeClassAllocator64` parameterized with size class maps containing a
large number of classes, as that will make the allocator region size too
small (< 2^32). Several tests were already disabled for Android because
of this.
This patch provides the correct allocator configuration for RISC-V
(riscv64), generalizes the gating condition for tests that can't be
enabled for small VMA systems, and tweaks the tests that can be made
compatible with those systems to enable them.
Differential Revision: https://reviews.llvm.org/D97234
Stephen Kelly [Sun, 14 Mar 2021 16:18:54 +0000 (16:18 +0000)]
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their
public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing
the source locations and method names for accessing them for a given AST
node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
The JSON file can also be used to generate bindings for other languages,
such as Python and Javascript:
https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
In this first version of this feature, only the accessors for Stmt
classes are generated, not Decls, TypeLocs etc. Those can be added
after this change is reviewed, as this change is mostly about
infrastructure of these code generators.
Also in this version, the platforms/cmake configurations are excluded as
much as possible so that support can be added iteratively. Currently a
break on any platform causes a revert of the entire feature. This way,
the `OR WIN32` can be removed in a future commit and if it breaks the
buildbots, only that commit gets reverted, making the entire process
easier to manage.
Differential Revision: https://reviews.llvm.org/D93164
Roman Lebedev [Mon, 15 Mar 2021 08:51:23 +0000 (11:51 +0300)]
[NFCI][ValueTracking] getUnderlyingObject(): gracefully handle cycles
Normally, this function just doesn't bother about cycles,
and hopes that the caller supplied small-enough depth
so that at worst it will take a potentially large,
but limited amount of time. But that obviously doesn't work
if there is no depth limit.
This reapples
36f1c3db66f7268ea3183bcf0bbf05b3e1c570b4,
but without asserting, just bailout once cycle is detected.
Fraser Cormack [Tue, 2 Mar 2021 11:11:18 +0000 (11:11 +0000)]
[RISCV] Support fixed-length vectors in the calling convention
This patch adds fixed-length vector support to the calling convention
when RVV is used to lower fixed-length vectors. The scheme follows the
regular vector calling convention for the argument/return registers, but
uses scalable vector container types as the LocVTs, and converts to/from
the fixed-length vector value types as required.
Fixed-length vector types may be split when the combination of minimum
VLEN and the maximum allowable LMUL is not large enough to fully contain
the vector. In this case the behaviour differs between fixed-length
vectors passed as parameters and as return values:
1. For return values, vectors must be passed entirely via registers or
via the stack.
2. For parameters, unlike scalar values, split vectors continue to be
passed by value, and are split across multiple registers until there are
no remaining registers. Thus vector parameters may be found partly in
registers and partly on the stack.
As with scalable vectors, the first fixed-length mask vector is passed
via v0. Split mask fixed-length vectors are passed first via v0 and then
via the next available vector register: v8,v9,etc.
The handling of vector return values uses all available argument
registers v8-v23 which does not adhere to the calling convention we're
supposedly implementing, but since this issue affects both fixed-length
and scalable-vector values, it was left as-is.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D97954
Jay Foad [Fri, 12 Mar 2021 18:01:19 +0000 (18:01 +0000)]
[AMDGPU] Use depth first iterator instead of recursive DFS. NFCI.
The reason for this is to avoid deep recursion in DFS() which can cause
stack overflow on large CFGs, especially on Windows.
Differential Revision: https://reviews.llvm.org/D98528
Julian Gross [Wed, 10 Feb 2021 12:53:11 +0000 (13:53 +0100)]
[MLIR] Create memref dialect and move dialect-specific ops from std.
Create the memref dialect and move dialect-specific ops
from std dialect to this dialect.
Moved ops:
AllocOp -> MemRef_AllocOp
AllocaOp -> MemRef_AllocaOp
AssumeAlignmentOp -> MemRef_AssumeAlignmentOp
DeallocOp -> MemRef_DeallocOp
DimOp -> MemRef_DimOp
MemRefCastOp -> MemRef_CastOp
MemRefReinterpretCastOp -> MemRef_ReinterpretCastOp
GetGlobalMemRefOp -> MemRef_GetGlobalOp
GlobalMemRefOp -> MemRef_GlobalOp
LoadOp -> MemRef_LoadOp
PrefetchOp -> MemRef_PrefetchOp
ReshapeOp -> MemRef_ReshapeOp
StoreOp -> MemRef_StoreOp
SubViewOp -> MemRef_SubViewOp
TransposeOp -> MemRef_TransposeOp
TensorLoadOp -> MemRef_TensorLoadOp
TensorStoreOp -> MemRef_TensorStoreOp
TensorToMemRefOp -> MemRef_BufferCastOp
ViewOp -> MemRef_ViewOp
The roadmap to split the memref dialect from std is discussed here:
https://llvm.discourse.group/t/rfc-split-the-memref-dialect-from-std/2667
Differential Revision: https://reviews.llvm.org/D98041
Alex Zinenko [Mon, 15 Mar 2021 10:10:32 +0000 (11:10 +0100)]
[mlir] better formatting in interface docs
Start the description from a new line instead of putting the first
paragraph in the section header. Wrap the class name in backticks to
make it clear that it relates to the code.
Alex Zinenko [Mon, 15 Mar 2021 10:01:35 +0000 (11:01 +0100)]
[mlir] fix cmake for generating data layout documentation
Simon Pilgrim [Mon, 15 Mar 2021 09:45:45 +0000 (09:45 +0000)]
Fix MSVC "switch statement contains 'default' but no 'case' labels" warning. NFCI.
Simon Pilgrim [Sun, 14 Mar 2021 22:27:57 +0000 (22:27 +0000)]
[X86][SSE] Attempt to merge single-op hops for slow targets.
For slow-hop targets, see if any single-op hops are duplicating work already done on another (dual-op) hop, which can sometimes occur as isHorizontalBinOp tries to find potential duplicates (but can't merge them itself). If so, reuse the other hop and shuffle the result.
Alex Zinenko [Mon, 15 Mar 2021 09:26:41 +0000 (10:26 +0100)]
Revert "[Canonicalizer] Process regions top-down instead of bottom up & reuse existing constants."
This reverts commit
b5d9a3c92358349d5444ab28de8ab5b2bee33a01.
The commit introduced a memory error in canonicalization/operation
walking that is exposed when compiled with ASAN. It leads to crashes in
some "release" configurations.
Daniel Kiss [Mon, 15 Mar 2021 09:24:44 +0000 (10:24 +0100)]
[AArch64][compiler-rt] Strip PAC from the link register.
-mbranch-protection protects the LR on the stack with PAC.
When the frames are walked the LR need to be cleared.
This inline assembly later will be replaced with a new builtin.
Test: build with -DCMAKE_C_FLAGS="-mbranch-protection=standard".
Reviewed By: kubamracek
Differential Revision: https://reviews.llvm.org/D98008
Frederik Gossen [Mon, 15 Mar 2021 09:10:07 +0000 (10:10 +0100)]
[MLIR] Add canonicalization for `shape.broadcast`
Remove redundant operands and fold if only one left.
Differential Revision: https://reviews.llvm.org/D98402
Roman Lebedev [Mon, 15 Mar 2021 09:00:22 +0000 (12:00 +0300)]
Revert "[NFCI][ValueTracking] getUnderlyingObject(): assert that no cycles are encountered"
This reverts commit
36f1c3db66f7268ea3183bcf0bbf05b3e1c570b4.
Seems to make bots unhappy.
Frederik Gossen [Mon, 15 Mar 2021 08:47:00 +0000 (09:47 +0100)]
[MLIR] Allow compatible shapes in `Elementwise` operations
Differential Revision: https://reviews.llvm.org/D98186
Roman Lebedev [Mon, 15 Mar 2021 08:51:23 +0000 (11:51 +0300)]
[NFCI][ValueTracking] getUnderlyingObject(): assert that no cycles are encountered
Jeroen Dobbelaere in
https://lists.llvm.org/pipermail/llvm-dev/2021-March/149206.html
is reporting that this function can end up in an endless loop
when called from SROA w/ full restrict patches.
For now, simply ensure that such problems are caught earlier/easier.
Matthias Springer [Mon, 15 Mar 2021 07:52:40 +0000 (16:52 +0900)]
[mlir][AVX512] Add while loop-based sparse vector-vector dot product variants.
Differential Revision: https://reviews.llvm.org/D98480
Max Kazantsev [Mon, 15 Mar 2021 07:32:00 +0000 (14:32 +0700)]
[Test] Replace checks with auto-generated checks
Hongtao Yu [Thu, 11 Mar 2021 18:38:15 +0000 (10:38 -0800)]
[NFC][Inliner] Debugging support to print funtion size after each inlining.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D98439
Nathan Chancellor [Mon, 15 Mar 2021 05:09:52 +0000 (05:09 +0000)]
debuginfo-tests: Fix check-gdb-mlir-support build after MLIR API change in
a4bb667d831c
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D98613
Chris Lattner [Mon, 15 Mar 2021 01:41:13 +0000 (18:41 -0700)]
[m_Constant] Check #operands/results before hasTrait()
We know that all ConstantLike operations have one result and no operands,
so check this first before doing the trait check. This change speeds up
Canonicalize on a CIRCT testcase by ~5%.
Differential Revision: https://reviews.llvm.org/D98615
Hsiangkai Wang [Tue, 9 Mar 2021 00:53:02 +0000 (08:53 +0800)]
[RISCV] Support inline asm for vector instructions.
Types of fractional LMUL and LMUL=1 are all using VR register class. When
using inline asm, it will use the first type in the register class as the
type for the register. It is not necessary the same as the value type. We
need to use INSERT_SUBVECTOR/EXTRACT_SUBVECToR/BITCAST to make it legal
to put the value in the corresponding register class.
Differential Revision: https://reviews.llvm.org/D97480
Chris Lattner [Sun, 14 Mar 2021 20:14:48 +0000 (13:14 -0700)]
[Canonicalizer] Process regions top-down instead of bottom up & reuse existing constants.
Two changes:
1) Change the canonicalizer to walk the function in top-down order instead of
bottom-up order. This composes well with the "top down" nature of constant
folding and simplification, reducing iterations and re-evaluation of ops in
simple cases.
2) Explicitly enter existing constants into the OperationFolder table before
canonicalizing. Previously we would "constant fold" them and rematerialize
them, wastefully recreating a bunch fo constants, which lead to pointless
memory traffic.
Both changes together provide a 33% speedup for canonicalize on some mid-size
CIRCT examples.
One artifact of this change is that the constants generated in normal pattern
application get inserted at the top of the function as the patterns are applied.
Because of this, we get "inverted" constants more often, which is an aethetic
change to the IR but does permute some testcases.
Differential Revision: https://reviews.llvm.org/D98609
Stephen Kelly [Mon, 15 Mar 2021 01:16:10 +0000 (01:16 +0000)]
Revert "[AST] Add generator for source location introspection"
This reverts commit
91abaa1f8d97e8efa249c31686fd643ff5f1e2c2.
Stephen Kelly [Mon, 15 Mar 2021 01:16:07 +0000 (01:16 +0000)]
Revert "Attempt to fix ARM buildbot"
This reverts commit
12dac66f6b33dd14b72076800726817f682ab785.
Craig Topper [Mon, 15 Mar 2021 00:17:50 +0000 (17:17 -0700)]
[RISCV] Give an explicit error if 'generic' CPU is passed instead of 'generic-rv32' or 'generic-rv64'. Validate 64Bit feature against the triple.
I encountered a project that uses llvm that passes "generic" by
default. While I could fix that project, I wouldn't be surprised
if other projects did something similar. So it seems like
a good idea to provide a better error here.
I've also added validation of the 64Bit feature against the
triple so that we can catch a mismatched CPU before failing in
a mysterious way. We can make it pretty far in isel because we
calculate XLenVT from the triple and use that to set up the legal
integer type.
Reviewed By: luismarques, khchen
Differential Revision: https://reviews.llvm.org/D98307
Stephen Kelly [Mon, 15 Mar 2021 00:20:39 +0000 (00:20 +0000)]
Attempt to fix ARM buildbot
Stephen Kelly [Sun, 14 Mar 2021 16:18:54 +0000 (16:18 +0000)]
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their
public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing
the source locations and method names for accessing them for a given AST
node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
The JSON file can also be used to generate bindings for other languages,
such as Python and Javascript:
https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
In this first version of this feature, only the accessors for Stmt
classes are generated, not Decls, TypeLocs etc. Those can be added
after this change is reviewed, as this change is mostly about
infrastructure of these code generators.
Also in this version, the platforms/cmake configurations are excluded as
much as possible so that support can be added iteratively. Currently a
break on any platform causes a revert of the entire feature. This way,
the `OR WIN32` can be removed in a future commit and if it breaks the
buildbots, only that commit gets reverted, making the entire process
easier to manage.
Differential Revision: https://reviews.llvm.org/D93164
Stephen Kelly [Sun, 14 Mar 2021 22:51:45 +0000 (22:51 +0000)]
Revert "[AST] Add generator for source location introspection"
This reverts commit
477e4b974653f92960c0bf569d88da7baacef68a.
Stephen Kelly [Sun, 14 Mar 2021 22:51:40 +0000 (22:51 +0000)]
Revert "Ensure that cache variable is set when not building introspection"
This reverts commit
6b010c6f6e354966569e02841180c77df45bbd76.
Stephen Kelly [Sun, 14 Mar 2021 22:44:38 +0000 (22:44 +0000)]
Ensure that cache variable is set when not building introspection
Craig Topper [Sun, 14 Mar 2021 22:17:03 +0000 (15:17 -0700)]
[X86] Add -prefer-vector-width=256 tests for v16i8 smulo/umulo.
Stephen Kelly [Sun, 14 Mar 2021 16:18:54 +0000 (16:18 +0000)]
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their
public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing
the source locations and method names for accessing them for a given AST
node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
The JSON file can also be used to generate bindings for other languages,
such as Python and Javascript:
https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
In this first version of this feature, only the accessors for Stmt
classes are generated, not Decls, TypeLocs etc. Those can be added
after this change is reviewed, as this change is mostly about
infrastructure of these code generators.
Also in this version, the platforms/cmake configurations are excluded as
much as possible so that support can be added iteratively. Currently a
break on any platform causes a revert of the entire feature. This way,
the `OR WIN32` can be removed in a future commit and if it breaks the
buildbots, only that commit gets reverted, making the entire process
easier to manage.
Differential Revision: https://reviews.llvm.org/D93164
Pavel Labath [Sun, 14 Mar 2021 21:17:42 +0000 (22:17 +0100)]
[lldb] Move PlatformPOSIX::ConnectToWaitingProcesses to RemoteAwarePlatform
The functionality is not posix specific. Also force the usage of the
gdb-remote process plugin in the gdb platform class.
This is not sufficient to make TestPlatformConnect pass on windows (it
seems it suffers from module loading issues, unrelated to this test),
but it at least makes it shut down correctly, so I change the skip to an
xfail.
Chenguang Wang [Sun, 14 Mar 2021 19:21:32 +0000 (19:21 +0000)]
[ArgPromotion] Copy additional metadata for loads.
Current ArgPromotion implementation does not copy it: https://godbolt.org/z/zzTKof
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D93927
Simonas Kazlauskas [Sun, 14 Mar 2021 20:55:29 +0000 (22:55 +0200)]
[InstSimplify] Add additional GEP transform tests & regenerate
Jan Kratochvil [Sun, 14 Mar 2021 20:42:44 +0000 (21:42 +0100)]
[llvm] [dwarf] Fix DWARFListTableHeader::getOffsetEntry off-by-one
D98289 was erroneously reporting `invalid range list offset 0x20110`
instead of `invalid range list table index 0`.
Differential Revision: https://reviews.llvm.org/D98589
Ricky Taylor [Sun, 14 Mar 2021 18:53:14 +0000 (11:53 -0700)]
[M68k] Tidy up some bit shifting during code emission
This fixes some issues with bit masking when emitting instructions
(including one TODO).
Differential Revision: https://reviews.llvm.org/D98527
Ricky Taylor [Sun, 14 Mar 2021 18:51:58 +0000 (11:51 -0700)]
[M68k] Make M68k TargetMachine use getter function
This makes M68k match other platforms in this regard.
This was done as part of the AsmParser/Disassembler work since the entry
functions of those modules usually reference `getTheXXXTarget()`.
Differential Revision: https://reviews.llvm.org/D98517
Ricky Taylor [Sun, 14 Mar 2021 18:36:57 +0000 (11:36 -0700)]
[M68k] Fix extract-section.py under Python 3
read_raw_stdin() was opening a file in binary mode, but Popen
was being told to use text mode (universal_newlines). This is
benign on Python 2 but an error on Python 3.
Differential Revision: https://reviews.llvm.org/D98428
Nico Weber [Sun, 14 Mar 2021 16:18:22 +0000 (12:18 -0400)]
Revert "[gn build] (manually) kind of merge
d627a27d26"
This reverts commit
5123327edab15bacb44a63a874d9d379d4873407.
d627a27d26 was reverted in
e0f70a8a979f.
Nikita Popov [Sun, 14 Mar 2021 16:04:34 +0000 (17:04 +0100)]
Revert "[AST] Add generator for source location introspection"
Breaks the build ... somehow: https://llvm-compile-time-tracker.com/show_error.php?commit=
77f7d2be214a1de29d583c75739f563593991fc3
FAILED: tools/clang/include/clang/Tooling/NodeIntrospection.inc
cd /root/llvm-compile-time-tracker/llvm-project-build/tools/clang/lib/Tooling && /usr/bin/cmake -E make_directory /root/llvm-compile-time-tracker/llvm-project-build/tools/clang/lib/Tooling/generated/ && /root/llvm-compile-time-tracker/llvm-project/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py --json-input-path /root/llvm-compile-time-tracker/llvm-project-build/ASTNodeAPI.json --output-file generated/NodeIntrospection.inc --empty-implementation 0 && /usr/bin/cmake -E copy_if_different /root/llvm-compile-time-tracker/llvm-project-build/tools/clang/lib/Tooling/generated/NodeIntrospection.inc /root/llvm-compile-time-tracker/llvm-project-build/tools/clang/include/clang/Tooling/NodeIntrospection.inc
/bin/sh: 1: /root/llvm-compile-time-tracker/llvm-project/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py: not found
This reverts commit
cefe711135c40b6fb9670cf92118f94f88964b23.
This reverts commit
f72f122feebe7f980c22ed4a7e04fc274ce2c976.
This reverts commit
970c21e345548a967c1bc000462198330982ed7e.
This reverts commit
77f7d2be214a1de29d583c75739f563593991fc3.
Stephen Kelly [Sun, 14 Mar 2021 15:45:34 +0000 (15:45 +0000)]
Fix license headers
Nikita Popov [Sun, 14 Mar 2021 15:39:03 +0000 (16:39 +0100)]
[X86] Add test for PR49587 (NFC)
Shows a miscompile with FastISel.
Stephen Kelly [Sun, 14 Mar 2021 15:08:15 +0000 (15:08 +0000)]
Update python script per review comments
Wrap to 80 cols, introduce main() function and use argparse instead of
optparse.
Stephen Kelly [Sun, 14 Mar 2021 15:30:12 +0000 (15:30 +0000)]
Remove unneeded targets dependency
David Green [Sun, 14 Mar 2021 15:29:14 +0000 (15:29 +0000)]
[AArch64] Expand build-vector-extract.ll tests to i8's. NFC