Thomas Raoux [Wed, 6 Jan 2021 17:34:50 +0000 (09:34 -0800)]
[mlir][vector] Support transfer op on tensor optimizations
Support store to load forwarding and dead store transformations for transfer op
on tensor.
Differential Revision: https://reviews.llvm.org/D94148
Siva Chandra Reddy [Wed, 6 Jan 2021 22:39:07 +0000 (14:39 -0800)]
[libc] Use a wrapper for rand instead of calling std::rand in fma tests.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D94198
River Riddle [Wed, 6 Jan 2021 22:54:39 +0000 (14:54 -0800)]
[mlir][TypeDefGen] Remove the need to define parser/printer for singleton types
This allows for singleton types without an explicit parser/printer to simply use
the mnemonic as the assembly format, removing the need for these types to provide the parser/printer
fields.
Differential Revision: https://reviews.llvm.org/D94194
Amara Emerson [Wed, 6 Jan 2021 22:40:17 +0000 (14:40 -0800)]
Fix failing triple test for macOS 11 with non-zero minor versions.
Differential Revision: https://reviews.llvm.org/D94197
Alina Sbirlea [Mon, 14 Dec 2020 19:53:35 +0000 (11:53 -0800)]
[DominatorTree] Add support for mixed pre/post CFG views.
Add support for mixed pre/post CFG views.
Update usages of the MemorySSAUpdater to use the new DT API by
requesting the DT updates to be done by the MSSAUpdater.
Differential Revision: https://reviews.llvm.org/D93371
Hansang Bae [Wed, 6 Jan 2021 22:14:37 +0000 (16:14 -0600)]
[OpenMP] Use c_int/c_size_t in Fortran target memory routine interface
The Fortran interface is now in line with 5.1 specification.
Differential Revision: https://reviews.llvm.org/D94042
Thomas Raoux [Tue, 5 Jan 2021 20:58:51 +0000 (12:58 -0800)]
[mlir] Add hoisting transformation for transfer ops on tensor
Add same hoisting transformation existing for transfer ops on buffers for
transfer_ops on tensor. The logic is significantly different so this is done as
a separate transformation and it is expect that user would know which
transformation to use based on the flow.
Differential Revision: https://reviews.llvm.org/D94115
River Riddle [Wed, 6 Jan 2021 22:08:12 +0000 (14:08 -0800)]
[mlir][ODS] Fix the use of cppClassName in Type constraints for TypeDefs
This field is currently being used to mean "Fully resolved class name", which breaks the usage by TypeDefs. This revision prefixes the name with the dialect namespace when necessary.
Differential Revision: https://reviews.llvm.org/D94192
River Riddle [Wed, 6 Jan 2021 22:08:03 +0000 (14:08 -0800)]
[mlir][ODS] Rename several uses of 'description' to 'summary'
Right now constraint/predicate traits/etc. use their "description" field as a one line human readable string. This breaks the current convention, by which a "description" may be multi-line. This revision renames the "description" field in these cases to "summary" which matches what the string is actually used as. This also unbreaks the use of TypeDefs(and eventually AttrDefs) in conjunction with existing type constraint facilities like `Optional`.
Differential Revision: https://reviews.llvm.org/D94133
Tue Ly [Sat, 2 Jan 2021 06:36:29 +0000 (01:36 -0500)]
[libc] Add implementation of fmaf.
Differential Revision: https://reviews.llvm.org/D94018
Shilei Tian [Wed, 6 Jan 2021 22:07:17 +0000 (17:07 -0500)]
[OpenMP] Fixed an issue that wrong LLVM headers might be included when building libomptarget
Wrong LLVM headers might be included if we don't set `include_directories`
to a right place. This will cause a compilation error if LLVM is installed in
system directories.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93737
Shilei Tian [Wed, 6 Jan 2021 22:05:54 +0000 (17:05 -0500)]
[OpenMP] Fixed the test environment when building along with LLVM
Currently all built libraries in OpenMP are anywhere if building along
with LLVM. It is not an issue if we don't execute any test. However, almost all
tests for `libomptarget` fails because in the lit configuration, we only set
`<build_dir>/libomptarget` to `LD_LIBRARY_PATH` and `LIBRARY_PATH`. Since those
libraries are everywhere, `clang` can no longer find `libomptarget.so` or those
deviceRTLs anymore.
In this patch, we set a unified path for all built libraries, no matter whether
it is built along with LLVM or not. In this way, our lit configuration can work
propoerly.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93736
Michael Liao [Sat, 19 Dec 2020 21:20:36 +0000 (16:20 -0500)]
[hip] Fix HIP version parsing.
- Need trimming before parsing major or minor version numbers. This's required
due to the different line ending on Windows.
- In addition, the integer conversion may fail due to invalid char. Return that
parsing function return `true` when the parsing fails.
Differential Revision: https://reviews.llvm.org/D93587
Thomas Raoux [Tue, 29 Dec 2020 17:59:36 +0000 (09:59 -0800)]
[mlir][vector] Support unrolling for transfer ops using tensors
Differential Revision: https://reviews.llvm.org/D93904
Yaxun (Sam) Liu [Wed, 9 Dec 2020 15:35:12 +0000 (10:35 -0500)]
[clang-offload-bundler] Add option -list
clang-offload-bundler is not only used by clang driver
to bundle/unbundle files for offloading toolchains,
but also used by out of tree tools to unbundle
fat binaries generated by clang. It is important
to be able to list the bundle IDs in a bundled
file so that the bundles can be extracted.
This patch adds an option -list to list bundle
ID's in a bundled file. Each bundle ID is separated
by new line. If the file is not a bundled file
nothing is output and returns 0.
Differential Revision: https://reviews.llvm.org/D92954
Nikita Popov [Sun, 22 Nov 2020 17:23:53 +0000 (18:23 +0100)]
[BasicAA] Fix BatchAA results for phi-phi assumptions
Change the way NoAlias assumptions in BasicAA are handled. Instead of
handling this inside the phi-phi code, always initially insert a
NoAlias result into the map and keep track whether it is used.
If it is used, then we require that we also get back NoAlias from
the recursive queries. Otherwise, the entry is changed to MayAlias.
Additionally, keep track of all location pairs we inserted that may
still be based on assumptions higher up. If it turns out one of those
assumptions is incorrect, we flush them from the cache.
The compile-time impact for the new implementation is significantly
higher than the previous iteration of this patch:
https://llvm-compile-time-tracker.com/compare.php?from=
c0bb9859de6991cc233e2dedb978dd118da8c382&to=
c07112373279143e37568b5bcd293daf81a35973&stat=instructions
However, it should avoid the exponential runtime cases we run into
if we don't cache assumption-based results entirely.
This also produces better results in some cases, because NoAlias
assumptions can now start at any root, rather than just phi-phi pairs.
This is not just relevant for analysis quality, but also for BatchAA
consistency: Otherwise, results would once again depend on query order,
though at least they wouldn't be wrong.
This ended up both more complicated and more expensive than I hoped,
but I wasn't able to come up with another solution that satisfies all
the constraints.
Differential Revision: https://reviews.llvm.org/D91936
Anastasia Stulova [Wed, 6 Jan 2021 19:30:04 +0000 (19:30 +0000)]
[OpenCL] Add clang extension for variadic functions.
With the internal clang extension '__cl_clang_variadic_functions'
variadic functions are accepted by the frontend.
This is not a fully supported vendor/Khronos extension
as it can only be used on targets with variadic prototype
support or in metaprogramming to represent functions with
generic prototype without calling such functions in the
kernel code.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D94027
Anastasia Stulova [Wed, 6 Jan 2021 19:05:09 +0000 (19:05 +0000)]
[OpenCL] Add clang extension for function pointers.
The new clang internal extension '__cl_clang_function_pointers'
allows use of function pointers and other features that have
the same functionality:
- Use of member function pointers;
- Unrestricted use of references to functions;
- Virtual member functions.
This not a vendor extension and therefore it doesn't require any
special target support. Exposing this functionality fully
will require vendor or Khronos extension.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D94021
Christian Sigg [Wed, 6 Jan 2021 20:26:59 +0000 (21:26 +0100)]
[mlir] Remove a number of methods from mlir::OpState that just forward to mlir::Operation. All call sites have been converted in previous changes.
Nikita Popov [Wed, 6 Jan 2021 20:22:27 +0000 (21:22 +0100)]
[InstSimplify] Canonicalize non-demanded shuffle op to poison (NFCI)
I don't believe this has an observable effect, because the only
thing we care about here is replacing the operand with a constant
so following folds can apply. This change is just to make the
representation follow canonical unary shuffle form.
Nikita Popov [Sun, 3 Jan 2021 21:08:38 +0000 (22:08 +0100)]
[InstSimplify] Fold call null/undef to poison
Calling null or undef results in immediate undefined behavior.
Return poison instead of undef in this case, similar to what
we do for immediate UB due to division by zero.
Nikita Popov [Wed, 6 Jan 2021 20:04:57 +0000 (21:04 +0100)]
[PowerPC] Avoid call to undef in test (NFC)
Replace call to undef with a dummy function, to avoid affecting
this change by changes to call undef folding.
Nathan James [Wed, 6 Jan 2021 20:00:15 +0000 (20:00 +0000)]
[NFC] Test case refactor
Arthur Eubanks [Wed, 6 Jan 2021 19:51:36 +0000 (11:51 -0800)]
[test] Pin partial-unswitch.ll to legacy PM
The new PM does not have loop-unswitch, it only has simple-loop-unswitch.
Craig Topper [Wed, 6 Jan 2021 19:25:15 +0000 (11:25 -0800)]
[RISCV] Return a vXi1 vector type from getSetCCResultType if V extension is enabled.
nvxXi1 types are legal with V extension and that's the result
vmseq/vmsne/vmslt/etc instructions return.
No test cases yet because the setcc isel patterns aren't in
and we'll need more than basic tests to observe this. I locally
tested that this plus D947078, D94168, D94142, and D94149
was enough to be able to handle the overflow result from
llvm.sadd.overflow.
Arthur Eubanks [Wed, 6 Jan 2021 19:43:28 +0000 (11:43 -0800)]
[test] Pin AMDGPU/opt-pipeline.ll to legacy PM
The pipeline being tested is specifically the legacy PM pipeline.
Arthur Eubanks [Wed, 6 Jan 2021 19:41:09 +0000 (11:41 -0800)]
Fix non-assert builds after D93828
Nikita Popov [Sun, 3 Jan 2021 20:10:00 +0000 (21:10 +0100)]
[InstSimplify] Fold out-of-bounds shift to poison
Make InstSimplify return poison rather than undef for out-of-bounds
shifts, as specified by LandRef:
> If op2 is (statically or dynamically) equal to or larger than the
> number of bits in op1, this instruction returns a poison value.
Differential Revision: https://reviews.llvm.org/D93998
Nikita Popov [Sun, 3 Jan 2021 21:09:12 +0000 (22:09 +0100)]
[GVN] Regenerate test checks (NFC)
Sanjay Patel [Wed, 6 Jan 2021 19:10:40 +0000 (14:10 -0500)]
[SLP] use reduction kind's opcode to create new instructions; NFC
Similar to
5a1d31a28 -
This should be no-functional-change because the reduction kind
opcodes are 1-for-1 mappings to the instructions we are matching
as reductions. But we want to remove the need for the
`OperationData` opcode field because that does not work when
we start matching intrinsics (eg, maxnum) as reduction candidates.
Sanjay Patel [Wed, 6 Jan 2021 19:00:25 +0000 (14:00 -0500)]
[SLP] reduce code for propagating flags on reductions; NFC
If we add/change to match intrinsics, this might get more
wordy, but there's no need to list each kind currently.
Arthur Eubanks [Sat, 26 Dec 2020 18:25:34 +0000 (10:25 -0800)]
[CGSCC][Coroutine][NewPM] Properly support function splitting/outlining
Previously when trying to support CoroSplit's function splitting, we
added in a hack that simply added the new function's node into the
original function's SCC (https://reviews.llvm.org/D87798). This is
incorrect since it might be in its own SCC.
Now, more similar to the previous design, we have callers explicitly
notify the LazyCallGraph that a function has been split out from another
one.
In order to properly support CoroSplit, there are two ways functions can
be split out.
One is the normal expected "outlining" of one function into a new one.
The new function may only contain references to other functions that the
original did. The original function must reference the new function. The
new function may reference the original function, which can result in
the new function being in the same SCC as the original function. The
weird case is when the original function indirectly references the new
function, but the new function directly calls the original function,
resulting in the new SCC being a parent of the original function's SCC.
This form of function splitting works with CoroSplit's Switch ABI.
The second way of splitting is more specific to CoroSplit. CoroSplit's
Retcon and Async ABIs split the original function into multiple
functions that all reference each other and are referenced by the
original function. In order to keep the LazyCallGraph in a valid state,
all new functions must be processed together, else some nodes won't be
populated. To keep things simple, this only supports the case where all
new edges are ref edges, and every new function references every other
new function. There can be a reference back from any new function to the
original function, putting all functions in the same RefSCC.
This also adds asserts that all nodes in a (Ref)SCC can reach all other
nodes to prevent future incorrect hacks.
The original hacks in https://reviews.llvm.org/D87798 are no longer
necessary since all new functions should have been registered before
calling updateCGAndAnalysisManagerForPass.
This fixes all coroutine tests when opt's -enable-new-pm is true by
default. This also fixes PR48190, which was likely due to the previous
hack breaking SCC invariants.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D93828
Valentin Clement [Wed, 6 Jan 2021 19:15:07 +0000 (14:15 -0500)]
[flang][openacc] Add more parsing/sema tests for init and shutdown directives
This patch adds some positive and failure tests for init and shutdown directives.
Reviewed By: kiranktp
Differential Revision: https://reviews.llvm.org/D90786
Fangrui Song [Wed, 6 Jan 2021 18:58:46 +0000 (10:58 -0800)]
[lld-macho] Fix GCC -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build
Fangrui Song [Wed, 6 Jan 2021 18:55:40 +0000 (10:55 -0800)]
[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl
Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are replaced
with the more appropriate `#if SANITIZER_GLIBC` (the headers are glibc
extensions, not specific to Linux (i.e. if we ever support GNU/kFreeBSD
or Hurd, the guards may automatically work)).
Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are refined
with `#if SANITIZER_GLIBC` (the definitions are available on Linux glibc,
but may not be available on other libc (e.g. musl) implementations).
This patch makes `ninja asan cfi lsan msan stats tsan ubsan xray` build on a musl based Linux distribution (apk install musl-libintl)
Notes about disabled interceptors for musl:
* `SANITIZER_INTERCEPT_GLOB`: musl does not implement `GLOB_ALTDIRFUNC` (GNU extension)
* Some ioctl structs and functions operating on them.
* `SANITIZER_INTERCEPT___PRINTF_CHK`: `_FORTIFY_SOURCE` functions are GNU extension
* `SANITIZER_INTERCEPT___STRNDUP`: `dlsym(RTLD_NEXT, "__strndup")` errors so a diagnostic is formed. The diagnostic uses `write` which hasn't been intercepted => SIGSEGV
* `SANITIZER_INTERCEPT_*64`: the `_LARGEFILE64_SOURCE` functions are glibc specific. musl does something like `#define pread64 pread`
* Disabled `msg_iovlen msg_controllen cmsg_len` checks: musl is conforming while many implementations (Linux/FreeBSD/NetBSD/Solaris) are non-conforming. Since we pick the glibc definition, exclude the checks for musl (incompatible sizes but compatible offsets)
Pass through LIBCXX_HAS_MUSL_LIBC to make check-msan/check-tsan able to build libc++ (https://bugs.llvm.org/show_bug.cgi?id=48618).
Many sanitizer features are available now.
```
% ninja check-asan
(known issues:
* ASAN_OPTIONS=fast_unwind_on_malloc=0 odr-violations hangs
)
...
Testing Time: 53.69s
Unsupported : 185
Passed : 512
Expectedly Failed: 1
Failed : 12
% ninja check-ubsan check-ubsan-minimal check-memprof # all passed
% ninja check-cfi
( all cross-dso/)
...
Testing Time: 8.68s
Unsupported : 264
Passed : 80
Expectedly Failed: 8
Failed : 32
% ninja check-lsan
(With GetTls (D93972), 10 failures)
Testing Time: 4.09s
Unsupported: 7
Passed : 65
Failed : 22
% ninja check-msan
(Many are due to functions not marked unsupported.)
Testing Time: 23.09s
Unsupported : 6
Passed : 764
Expectedly Failed: 2
Failed : 58
% ninja check-tsan
Testing Time: 23.21s
Unsupported : 86
Passed : 295
Expectedly Failed: 1
Failed : 25
```
Used `ASAN_OPTIONS=verbosity=2` to verify there is no unneeded interceptor.
Partly based on Jari Ronkainen's https://reviews.llvm.org/D63785#1921014
Note: we need to place `_FILE_OFFSET_BITS` above `#include "sanitizer_platform.h"` to avoid `#define __USE_FILE_OFFSET64 1` in 32-bit ARM `features.h`
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D93848
Joseph Huber [Wed, 6 Jan 2021 15:20:34 +0000 (10:20 -0500)]
[NVPTX] Fix debugging information being added to NVPTX target if remarks are enabled
Summary:
Optimized debugging is not supported by ptxas. Debugging information is degraded to line information only if optimizations are enabled, but debugging information would be added back in by the driver if remarks were enabled. This solves https://bugs.llvm.org/show_bug.cgi?id=48153.
Reviewers: jdoerfert tra jholewinski serge-sans-paille
Differential Revision: https://reviews.llvm.org/D94123
Mircea Trofin [Wed, 6 Jan 2021 17:35:52 +0000 (09:35 -0800)]
[NFC] Removed unused prefixes in CodeGen/AMDGPU
This covers tests starting with m-r.
Differential Revision: https://reviews.llvm.org/D94181
Simon Pilgrim [Wed, 6 Jan 2021 17:50:22 +0000 (17:50 +0000)]
[X86] Add commuted patterns test coverage for D93599
Suggested by @spatel
Florian Hahn [Wed, 6 Jan 2021 14:59:27 +0000 (14:59 +0000)]
[Clang] Remove unnecessary Attr.isArgIdent checks.
The MatrixType, ExtVectorType, VectorSize and AddressSpace attributes
have arguments defined as ExprArguments in Attr.td. So their arguments
should never be ArgIdents and the logic to handle this case can be
removed.
The logic has been replaced by an assertion to ensure the arguments
are always ArgExpressions
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D94092
Reid Kleckner [Tue, 5 Jan 2021 21:45:02 +0000 (13:45 -0800)]
[X86] Remove [ER]SP from all CSR lists
The CSR lists control which registers are spilled and reloaded in the
prologue and epilogue. The stack pointer is managed explicitly, and
should never be pushed or popped. Remove it from these lists. This
affected regcall and preserves all / most.
Differential Revision: https://reviews.llvm.org/D94118
Sanjoy Das [Sun, 3 Jan 2021 06:56:44 +0000 (22:56 -0800)]
Remove allow-unregistered-dialect from some tests that don't need it
Differential Revision: https://reviews.llvm.org/D93982
Sanjoy Das [Sun, 3 Jan 2021 18:33:34 +0000 (10:33 -0800)]
Nit: fix spacing
Differential Revision: https://reviews.llvm.org/D93996
Kazuaki Ishizaki [Wed, 6 Jan 2021 17:35:29 +0000 (02:35 +0900)]
[mlir] NFC: fix trivial typos
fix typos under docs, test, and tools directories
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94158
Mircea Trofin [Wed, 6 Jan 2021 04:23:39 +0000 (20:23 -0800)]
[NFC] Removed unused prefixes from CodeGen/AMDGPU
All the 'l'-starting tests.
Differential Revision: https://reviews.llvm.org/D94151
Matt Arsenault [Wed, 6 Jan 2021 02:14:42 +0000 (21:14 -0500)]
AMDGPU/GlobalISel: Update fdiv lowering for denormal/ulp interaction
Change the GlobalISel fast fdiv handling to match the changes in
2531535984ad989ce88aeee23cb92a827da6686e and
884acbb9e167d5668e43581630239d688edec8ad
Peter Waller [Wed, 6 Jan 2021 17:16:38 +0000 (17:16 +0000)]
[llvm][NFC] Disallow all warnings in TypeSize tests
This is a follow-up to a request from a reviewer [0]. The text may change in
the future and these tests should not produce any warning output.
[0] https://reviews.llvm.org/D91806#inline-879243
Reviewed By: sdesmalen, david-arm
Differential Revision: https://reviews.llvm.org/D94161
Francesco Petrogalli [Wed, 6 Jan 2021 17:12:23 +0000 (17:12 +0000)]
[InstCombine] Update valueCoversEntireFragment to use TypeSize
* Update valueCoversEntireFragment to use TypeSize.
* Add a regression test.
* Assertions have been added to protect untested codepaths.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D91806
Matt Arsenault [Wed, 6 Jan 2021 02:33:42 +0000 (21:33 -0500)]
AMDGPU/GlobalISel: Add baseline IR tests for fdiv
The fdiv lowering is currently split between an IR pass and codegen,
so make sure this works end to end. We also currently differ from the
DAG on some edge cases, which this will show in a future change.
Matt Arsenault [Thu, 30 Jul 2020 02:50:02 +0000 (22:50 -0400)]
AMDGPU: Explicitly use SelectionDAG in legacy intrinsic tests
GlobalISel will probably not support the legacy buffer intrinsics, so
don't fail when the default is switched.
Faris Rehman [Wed, 6 Jan 2021 15:42:24 +0000 (15:42 +0000)]
[flang][driver] Add support for `-D`, `-U`
Add support for options -D and -U in the new Flang driver.
Summary of changes:
- Create PreprocessorOptions, to be used by the driver then translated
into Fortran::parser::Options
- Create CompilerInvocation::setFortranOpts to pass preprocessor
options into the parser options
- Add a dedicated method, Flang::AddPreprocessingOptions, to extract
preprocessing options from the driver arguments into the preprocessor
command arguments
Macros specified like -DName will default to definition 1.
When defining macros, the new driver will drop anything after an
end-of-line character. This is consistent with gfortran and clang, but
different to what currently f18 does. However, flang (which is a bash
wrapper for f18), also drops everything after an end-of-line character.
So gfortran-like behaviour felt like the natural choice. Test is added
to demonstrate this behaviour.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D93401
Simon Pilgrim [Wed, 6 Jan 2021 16:13:36 +0000 (16:13 +0000)]
[TargetLowering] Add icmp ne/eq (srl (ctlz x), log2(bw)) vector support.
Nicholas Guy [Wed, 2 Dec 2020 15:15:23 +0000 (15:15 +0000)]
[AArch64] Rearrange mul(dup(sext/zext)) to mul(sext/zext(dup))
Performing this rearrangement allows for existing patterns
to match cases where the vector may be built after an extend,
instead of before.
Differential Revision: https://reviews.llvm.org/D91255
Simon Pilgrim [Wed, 6 Jan 2021 15:50:11 +0000 (15:50 +0000)]
Remove some unused <vector> includes. NFCI.
<vector> (unlike many other c++ headers) is relatively clean, so if the file doesn't use std::vector then it shouldn't need the header.
Simon Pilgrim [Wed, 6 Jan 2021 15:44:36 +0000 (15:44 +0000)]
[X86] Add icmp ne/eq (srl (ctlz x), log2(bw)) test coverage.
Add vector coverage as well (which isn't currently supported).
Krzysztof Parzyszek [Wed, 6 Jan 2021 15:11:04 +0000 (09:11 -0600)]
[Hexagon] Wrap functions only used in asserts in ifndef NDEBUG
Lei Zhang [Wed, 6 Jan 2021 15:28:01 +0000 (10:28 -0500)]
[mlir][spirv] Update pass docs
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D94174
Erich Keane [Wed, 6 Jan 2021 14:46:01 +0000 (06:46 -0800)]
Fix MaterializeTemporaryExpr's type when its an incomplete array.
Like the VarDecl that gets its type updated based on an init-list, this
patch corrects the MaterializeTemporaryExpr's type to make sure it isn't
creating an incomplete type, which leads to a handful of CodeGen crashes
(see PR 47636).
Based on @rsmith 's comments on D88236
Differential Revision: https://reviews.llvm.org/D88298
Yvan Roux [Wed, 6 Jan 2021 15:01:38 +0000 (16:01 +0100)]
[Driver][MachineOutliner] Support outlining option with LTO
This patch propagates the -moutline flag when LTO is enabled and avoids
passing it explicitly to the linker plugin.
Differential Revision: https://reviews.llvm.org/D93385
Florian Hahn [Wed, 6 Jan 2021 11:51:52 +0000 (11:51 +0000)]
[LoopDeletion] Also consider loops with subloops for deletion.
Currently, LoopDeletion does skip loops that have sub-loops, but this
means we currently fail to remove some no-op loops.
One example are inner loops with live-out values. Those cannot be
removed by itself. But the containing loop may itself be a no-op and the
whole loop-nest can be deleted.
The legality checks do not seem to rely on analyzing inner-loops only
for correctness.
With LoopDeletion being a LoopPass, the change means that we now
unfortunately need to do some extra work in parent loops, by checking
some conditions we already checked. But there appears to be no
noticeable compile time impact:
http://llvm-compile-time-tracker.com/compare.php?from=
02d11f3cda2ab5b8bf4fc02639fd1f4b8c45963e&to=
843201e9cf3b6871e18c52aede5897a22994c36c&stat=instructions
This changes patch leads to ~10 more loops being deleted on
MultiSource, SPEC2000, SPEC2006 with -O3 & LTO
This patch is also required (together with a few others) to eliminate a
no-op loop in omnetpp as discussed on llvm-dev 'LoopDeletion / removal of
empty loops.' (http://lists.llvm.org/pipermail/llvm-dev/2020-December/147462.html)
This change becomes relevant after removing potentially infinite loops
is made possible in 'must-progress' loops (D86844).
Note that I added a function call with side-effects to an outer loop in
`llvm/test/Transforms/LoopDeletion/update-scev.ll` to preserve the
original spirit of the test.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D93716
Pavel Labath [Tue, 5 Jan 2021 19:28:31 +0000 (20:28 +0100)]
[lldb] Simplify some lldb-server tests
Remove manual test duplication.
KareemErgawy-TomTom [Wed, 6 Jan 2021 13:56:53 +0000 (14:56 +0100)]
[MLIR][SPIRV] Add `UnsignedOp` trait.
This commit adds a new trait that can be attached to ops that have
unsigned semantics.
TODO:
- Check if other places in code can use the new attribute (possibly in this patch).
- Add a similar `SignedOp` attribute (in a new patch).
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D94068
Simon Pilgrim [Wed, 6 Jan 2021 14:19:59 +0000 (14:19 +0000)]
[TableGen] RegisterBankEmitter - Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Wed, 6 Jan 2021 14:11:08 +0000 (14:11 +0000)]
[MIPS] MipsAsmParser - Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Wed, 6 Jan 2021 14:04:37 +0000 (14:04 +0000)]
[ProfileData] Pass Twine by const reference instead of by value.
Its only used by DiagnosticInfoSampleProfile which takes a const reference anyhow.
Sven van Haastregt [Wed, 6 Jan 2021 14:16:44 +0000 (14:16 +0000)]
[OpenCL][NFC] Improve OpenCL test file naming
Change "negative" into "invalid" and put "invalid" at the beginning of
the file name, following the bulk of the invalid tests in the
SemaOpenCL directory.
Use the "invalid-" prefix only for tests that contain only invalid
constructs.
Drop the "valid" suffix for CodeGen tests, as inputs in this directory
are supposed to be valid anyway.
Simon Pilgrim [Wed, 6 Jan 2021 12:55:52 +0000 (12:55 +0000)]
[Hexagon] Regenerate zext-v4i1.ll tests
This will be improved by part of the work for D86578
Jan Svoboda [Tue, 5 Jan 2021 16:00:46 +0000 (17:00 +0100)]
Reapply multiple "[clang][cli]" patches
This reverts
7ad666798f12 and
1876a2914fe0 that reverted:
741978d727a4 [clang][cli] Port CodeGen option flags to new option parsing system
383778e2171b [clang][cli] Port LangOpts option flags to new option parsing system
aec2991d083a [clang][cli] Port LangOpts simple string based options to new option parsing system
95d3cc67caac [clang][cli] Port CodeGenOpts simple string flags to new option parsing system
27b7d646886d [clang][cli] Streamline MarshallingInfoFlag description
70410a264949 [clang][cli] Let denormalizer decide how to render the option based on the option class
63a24816f561 [clang][cli] Implement `getAllArgValues` marshalling
Commit
741978d727a4 accidentally changed the `Group` attribute of `g[no_]column_info` options from `g_flags_Group` to `g_Group`, which changed the debug info options passed to cc1 by the driver.
Similar change was also present in
383778e2171b, which accidentally added `Group<f_Group>` to `f[no_]const_strings` and `f[no_]signed_wchar`.
This patch corrects all three accidental changes by replacing `Bool{G,F}Option` with `BoolCC1Option`.
Tomas Matheson [Tue, 29 Dec 2020 11:42:03 +0000 (11:42 +0000)]
[AArch64] Add BRB IALL and BRB INJ instructions
BRB IALL: Invalidate the Branch Record Buffer
BRB INJ: Branch Record Injection into the Branch Record Buffer
Parser changes based on work by Simon Tatham.
These are two-word mnemonics. The assembly parser works by special-casing
the mnemonic in order to parse the second word as a plain identifier token.
Reviewed by: MarkMurrayARM
Differential Revision: https://reviews.llvm.org/D93899
Guillaume Chatelet [Wed, 6 Jan 2021 12:04:53 +0000 (12:04 +0000)]
[libc] Align src buffer instead of dst buffer
We used to align destination buffer instead of source buffer for the loop of block copy.
This is a mistake.
Differential Revision: https://reviews.llvm.org/D93457
Guillaume Chatelet [Wed, 6 Jan 2021 12:03:34 +0000 (12:03 +0000)]
[libc] remove modulo from CircularArrayRef iterator
Simon Pilgrim [Wed, 6 Jan 2021 11:40:58 +0000 (11:40 +0000)]
[X86] Add scalar/vector test coverage for D93599
This expands the test coverage beyond just the boolvector/movmsk concat pattern
Stefan Pintilie [Tue, 5 Jan 2021 20:42:53 +0000 (14:42 -0600)]
[PowerPC] Fix issue where vsrq is given incorrect shift vector
The new Power10 instruction vsrq was being given the wrong shift vector.
The original code assumed that the shift would be found in bits 121 to 127.
This is not correct. The shift is found in bits 57 to 63.
This can be fixed by swaping the first and second double words.
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D94113
Florian Hahn [Wed, 6 Jan 2021 11:30:23 +0000 (11:30 +0000)]
[VPlan] Keep start value in VPWidenIntOrFpInductionRecipe (NFC).
This patch updates VPWidenIntOrFpInductionRecipe to hold the start value
for the induction variable. This makes the start value explicit and
allows for adjusting the start value for a VPlan.
The flexibility will be used in further patches.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D92129
Sander de Smalen [Wed, 6 Jan 2021 11:38:30 +0000 (11:38 +0000)]
[AArch64][SVE] Emit DWARF location expr for SVE (dbg.declare)
When using dbg.declare, the debug-info is generated from a list of
locals rather than through DBG_VALUE instructions in the MIR.
This patch is different from D90020 because it emits the DWARF
location expressions from that list of locals directly.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D90044
Fraser Cormack [Wed, 6 Jan 2021 11:26:11 +0000 (11:26 +0000)]
[ValueTypes] Fix formatting on scalable vector warning (NFC)
Sander de Smalen [Wed, 6 Jan 2021 10:54:41 +0000 (10:54 +0000)]
[LiveDebugValues] Handle spill locations with a fixed and scalable component.
This patch fixes the two LiveDebugValues implementations
(InstrRef/VarLoc)Based to handle cases where the StackOffset contains
both a fixed and scalable component.
This depends on the `TargetRegisterInfo::prependOffsetExpression` being
added in D90020. Feel free to leave comments on that patch if you have them.
Reviewed By: djtodoro, jmorse
Differential Revision: https://reviews.llvm.org/D90046
David Green [Wed, 6 Jan 2021 11:26:39 +0000 (11:26 +0000)]
[ARM] Handle any extend whilst lowering addw/addl/subw/subl
Same as
a9b6440edd, use zanyext to treat any_extends as zero extends
during lowering to create addw/addl/subw/subl nodes.
Differential Revision: https://reviews.llvm.org/D93835
Florian Hahn [Wed, 6 Jan 2021 10:57:46 +0000 (10:57 +0000)]
[VPlan] Add getLiveInIRValue accessor to VPValue.
This patch adds a new getLiveInIRValue accessor to VPValue, which
returns the underlying value, if the VPValue is defined outside of
VPlan. This is required to handle scalars in VPTransformState, which
requires dealing with scalars defined outside of VPlan.
We can simply check VPValue::Def to determine if the value is defined
inside a VPlan.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D92281
Alex Zinenko [Tue, 5 Jan 2021 16:01:41 +0000 (17:01 +0100)]
[mlir] Use thread_local stack in LLVM dialect type parsing and printing
LLVM dialect type parsing and printing have been using a local stack object
forwarded between recursive functions responsible for parsing or printing
specific types. This stack is necessary to intercept (mutually) recursive
structure types and avoid inifinite recursion. This approach works only thanks
to the closedness of the LLVM dialect type system: types that don't belong to
the dialect are not allowed. Switch the approach to using a `thread_local`
stack inside the functions parsing the structure types. This makes the code
slightly cleaner by avoiding the need to pass the stack object around and, more
importantly, makes it possible to reconsider the closedness of the LLVM dialect
type system. As a nice side effect of this change, container LLVM dialect types
now support type aliases in their body (although it is currently impossible to
also use the alises when printing).
Depends On D93713
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93714
Ben Shi [Wed, 6 Jan 2021 10:55:56 +0000 (18:55 +0800)]
[RISCV][NFC] Add new test cases for mul
David Green [Wed, 6 Jan 2021 10:51:12 +0000 (10:51 +0000)]
[ARM] Handle any extend whilst lowering mull
Similar to
78d8a821e23e but for ARM, this handles any_extend whilst
creating MULL nodes, treating them as zextends.
Differential Revision: https://reviews.llvm.org/D93834
Florian Hahn [Wed, 6 Jan 2021 10:23:40 +0000 (10:23 +0000)]
[VPlan] Use public VPValue constructor in VPPRedInstPHIRecipe (NFC).
VPPredInstPHIRecipe does not need access to VPValue via friendship. It
can just use the public constructor,
Discussed as part of D92281.
Sander de Smalen [Wed, 6 Jan 2021 10:42:05 +0000 (10:42 +0000)]
Fix test failure in
a7e3339f3b0eb71e43d44e6f59cc8db6a7b110bf
Set the target-triple to aarch64 in debug-info-sve-dbg-value.mir
to avoid "'+sve' is not a recognized feature for this target"
diagnostic.
Andrzej Warzynski [Wed, 6 Jan 2021 10:35:00 +0000 (10:35 +0000)]
[flang][driver] Update error messages (nfc)
As per Flang's coding guidelines
(flang/docs/C++style.md#error-messages):
```
Messages should start with a capital letter.
```
This patch updates error messages in the driver (new and old) so that
they conform with the guideline above.
This change was suggested in one of the recent reviews:
https://reviews.llvm.org/D93712. It felt like this deserved a dedicated
patch, so sending it separately.
David Green [Wed, 6 Jan 2021 10:35:23 +0000 (10:35 +0000)]
[AArch64] Handle any extend whilst lowering addw/addl/subw/subl
This adds an extra tablegen PatFrag, zanyext, which matches either any
extend or zext and uses that in the aarch64 backend to handle any
extends in addw/addl/subw/subl patterns.
Differential Revision: https://reviews.llvm.org/D93833
Oliver Stannard [Wed, 6 Jan 2021 10:31:59 +0000 (10:31 +0000)]
Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"
This reverts commit
b7718b617557aa9827f994a16267537236634095, because it
is causing build failures on all 32-bit ARM bots which build
compiler-rt.
Andrzej Warzynski [Wed, 6 Jan 2021 09:54:30 +0000 (09:54 +0000)]
[flang][driver] Add checks for errors from `Prescan` and `Parse`
If either `Prescan` or `Parse` generate any fatal errors, the new driver
will:
* report it (i.e. issue an error diagnostic)
* exit early
* return non-zero exit code
This behaviour is consistent with f18 (i.e. the old driver).
Reviewed By: sameeranjoshi
Differential Revision: https://reviews.llvm.org/D93712
David Green [Wed, 6 Jan 2021 10:08:43 +0000 (10:08 +0000)]
[AArch64] Handle any extend whilst lowering mull
Demanded bits may turn a sext or zext into an anyext if the top bits are
not needed. This currently prevents the lowering to instructions like
mull, addl and addw. This patch fixes the mull generation by keeping it
simple and treating them like zextends.
Differential Revision: https://reviews.llvm.org/D93832
Sander de Smalen [Wed, 6 Jan 2021 09:37:57 +0000 (09:37 +0000)]
[AArch64][SVE] Emit DWARF location expression for SVE stack objects.
Extend PEI to emit a DWARF expression for StackOffsets that have
a fixed and scalable component. This means the expression that needs
to be added is either:
<base> + offset
or:
<base> + offset + scalable_offset * scalereg
where for SVE, the scale reg is the Vector Granule Dwarf register, which
encodes the number of 64bit 'granules' in an SVE vector and which
the debugger can evaluate at runtime.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D90020
Sander de Smalen [Tue, 5 Jan 2021 09:39:59 +0000 (09:39 +0000)]
[AArch64] Use faddp to implement fadd reductions.
Custom-expand legal VECREDUCE_FADD SDNodes
to benefit from pair-wise faddp instructions.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D59259
Sam Clegg [Mon, 21 Dec 2020 18:24:32 +0000 (10:24 -0800)]
[MC][WebAssembly] Avoid recalculating indexes in -gsplit-dwarf mode
Be consistent about asserting before setting WasmIndices. Adding
these assertions revealed that we were duplicating a lot of work
and setting these indexed twice when running in DWO mode.
Differential Revision: https://reviews.llvm.org/D93650
Fraser Cormack [Mon, 4 Jan 2021 10:41:49 +0000 (10:41 +0000)]
[RISCV] Add vector integer mul/mulh/div/rem ISel patterns
There is no test coverage for the mulhs or mulhu patterns as I can't get
the DAGCombiner to generate them for scalable vectors. There are a few
places in that still need updating for that to work. I left the patterns
in regardless as they are correct.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94073
Aleksandr Platonov [Wed, 6 Jan 2021 07:07:12 +0000 (10:07 +0300)]
[clangd][fuzzyFind] Do not show stale symbols in the result.
This is follow up to D93393.
Without this patch `MergedIndex::fuzzyFind()` returns stale symbols from the static index even if these symbols were removed.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D93796
Pushpinder Singh [Mon, 4 Jan 2021 11:46:31 +0000 (06:46 -0500)]
[OpenMP][AMDGPU] Use AMDGPU_KERNEL calling convention for entry function
AMDGPU backend requires entry functions/kernels to have AMDGPU_KERNEL
calling convention for proper linking.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D94060
Siva Chandra Reddy [Mon, 4 Jan 2021 06:33:48 +0000 (22:33 -0800)]
[libc] Add implementations of nextafter[f|l] functions.
A differential fuzzer for these functions has also been added.
Along the way, a small correction has been done to the normal/subnormal
limits of x86 long double values.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D94109
Siva Chandra Reddy [Sat, 2 Jan 2021 05:19:31 +0000 (21:19 -0800)]
[libc] Add implementations of nearbyint[f|l].
The implementation is exactly the same as rint* as even rint does not
raise any floating point exceptions currently. [Note that the standards
do not specify that floating point exceptions must be raised - they
leave it up to the implementation to choose to raise FE_INEXACT when
rounding non-integral values.]
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D94112
Kazu Hirata [Wed, 6 Jan 2021 05:15:59 +0000 (21:15 -0800)]
[llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)
Kazu Hirata [Wed, 6 Jan 2021 05:15:57 +0000 (21:15 -0800)]
[MachineSink] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Wed, 6 Jan 2021 05:15:56 +0000 (21:15 -0800)]
[tools] Use llvm::append_range (NFC)
Christudasan Devadasan [Wed, 23 Dec 2020 06:52:36 +0000 (12:22 +0530)]
[GlobalISel] Base implementation for sret demotion.
If the return values can't be lowered to registers
SelectionDAG performs the sret demotion. This patch
contains the basic implementation for the same in
the GlobalISel pipeline.
Furthermore, targets should bring relevant changes
during lowerFormalArguments, lowerReturn and
lowerCall to make use of this feature.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D92953