Peter Klausler [Mon, 22 May 2023 20:56:32 +0000 (13:56 -0700)]
[flang][preprocessing] Allow keyword macro to rename a function-like macro
#define FOO(x) ((x)+1)
#define BAR FOO
print *, BAR(1)
should work as one would expect.
Fixes https://github.com/llvm/llvm-project/issues/47162.
Differential Revision: https://reviews.llvm.org/D151154
Yuanfang Chen [Mon, 22 May 2023 21:34:01 +0000 (14:34 -0700)]
[llvm-vscode] update dependencies
Noah Goldstein [Mon, 22 May 2023 20:43:37 +0000 (15:43 -0500)]
Add some missing [[noreturn]] attributes
Missing in header for `pthread_exit` and `exit`.
Missing in spec file for `pthread_exit`.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151143
Noah Goldstein [Mon, 22 May 2023 20:43:26 +0000 (15:43 -0500)]
Cleanup code in `thread_exit`
1) Avoid proper function calls and referencing local variables after
the stack has been deallocated. A proper function call/return or local
variable reference that may have spilled will cause invalid memory
reads after the stack has been deallocated.
2) Mark the function as [[noreturn]] and place
`__builtin_unreachable()` after the `SYS_exit` syscalls.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151142
Noah Goldstein [Thu, 20 Apr 2023 20:05:04 +0000 (15:05 -0500)]
Support custom attributes in pthread_create
Only functional for stack growsdown (same as before), but custom
`stack`, `stacksize`, `guardsize`, and `detachstate` all should be
working.
Differential Revision: https://reviews.llvm.org/D148290
Alexey Bataev [Mon, 22 May 2023 20:12:45 +0000 (13:12 -0700)]
[SLP]Fix PR62665: compiler crash when trying to access non-existing mask
element.
Need to check at first if the SubMask element is PoisonMaskElem to avoid
compiler crash.
Yi Kong [Fri, 19 May 2023 21:56:46 +0000 (14:56 -0700)]
Reland^2 "[BOLT] Parallelize legacy profile merging"
Resovled the issue that when number of tasks is fewer than cores, we end
up creating as many threads as the number of cores, making the
performance worse than the single thread version.
Craig Topper [Mon, 22 May 2023 20:37:34 +0000 (13:37 -0700)]
[RISCV] Increase scalar integer divide latency for SiFive7.
The scalar divider produces 1 bit per cycle so the worst case
latency is the input width plus a couple cycles.
Reviewed By: michaelmaitland
Differential Revision: https://reviews.llvm.org/D151139
Lang Hames [Thu, 13 Apr 2023 18:43:37 +0000 (18:43 +0000)]
[JITLink][ELF][ppc64] Add skeleton ppc64 support and ELF/ppc64 JITLink backend.
This patch introduces a skeleton JITLink ppc64 support header and ELF/ppc64
backend. No relocations are supported in this initial version, but given a
program requiring no relocations (e.g. one that just returns a constant value
from main) the new backend is able to construct a LinkGraph from a ppc64 ELF
relocatable object, and the llvm-jitlink tool is able to execute it.
This commit should also serve as a good example of how to introduce a JITLink
backend for a new architecture.
Reviewed By: sgraenitz, v.g.vassilev, vchuravy, nemanjai, jain98, MaskRay
Differential Revision: https://reviews.llvm.org/D148192
Adrian Prantl [Mon, 22 May 2023 19:52:13 +0000 (12:52 -0700)]
Revert "[PostOrderIterator] Store end iterator (NFC)"
This reverts commit
50f0ee8fbfc1f597ae7d2d49e0996c4338e5652f.
This breaks the bots.
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/lastFailedBuild/consoleFull#-
1141050806a1ca8a51-895e-46c6-af87-
ce24fa4cd561
Craig Topper [Mon, 22 May 2023 19:46:25 +0000 (12:46 -0700)]
[RISCV] Fix some errors in the vector part of the scheduler model for SiFive7.
-FP compare latency was too high.
-Compare instructions need to increase latency to assume no chaining
to later instructions.
vmv.x.s, vmv.s.x, vfmv.f.s, and vfmv.s.f aren't 8 cycles. From the
the perspective of the vector pipeline they are only 4 cycles. Though
vector to scalar has a much higher latency from the perspective
of the scalar pipeline. Will need to adjust in the future.
Reviewed By: michaelmaitland
Differential Revision: https://reviews.llvm.org/D151136
Leandro Lupori [Mon, 22 May 2023 19:06:46 +0000 (16:06 -0300)]
Revert "[flang] Handle array constants of any rank"
This reverts commit
e26e68a4905cc13064987c9b19fa153b54035d36.
This broke gfortran test-suite, test regression/intrinsic_pack_3.f90.
Marcelo Juchem [Mon, 22 May 2023 19:05:41 +0000 (20:05 +0100)]
[CMake] Set compatibility policy for lists in LLVM-Config.cmake.
Fixes "dependent projects fail to build with cmake 3.25 and llvm 16-rc4".
When building [latest `iovisor/bcc`](https://github.com/iovisor/bcc/commit/
1ea0390725391e76256af6a4d0eb857816e6290f), `cmake` complains about a change in the behavior of operator `IN_LIST`:
```console
CMake Warning (dev) at /usr/local/lib/cmake/llvm/LLVM-Config.cmake:230 (if):
Policy CMP0057 is not set: Support new IN_LIST if() operator. Run "cmake
--help-policy CMP0057" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
IN_LIST will be interpreted as an operator when the policy is set to NEW.
Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
cmake/clang_libs.cmake:32 (llvm_map_components_to_libnames)
src/cc/CMakeLists.txt:132 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at /usr/local/lib/cmake/llvm/LLVM-Config.cmake:230 (if):
if given arguments:
"engine" "IN_LIST" "link_components"
Unknown arguments specified
Call Stack (most recent call first):
cmake/clang_libs.cmake:32 (llvm_map_components_to_libnames)
src/cc/CMakeLists.txt:132 (include)
```
This patch addresses this issue by setting the aforementioned policy in `LLVM-Config.cmake`.
Reviewed By: mgorny, thesamesam
Differential Revision: https://reviews.llvm.org/D150884
Closes: https://github.com/llvm/llvm-project/issues/61436
Peter Klausler [Thu, 18 May 2023 17:32:14 +0000 (10:32 -0700)]
[flang] Better error handling and testing of generics with homonymous specifics or derived types
Fortran allows a generic procedure interface to have the same name as a derived
type in the same scope or the same name as one of its specific procedures.
(It can't have both since a derived type and specific procedure can't have the
same name in a scope.)
Some popular compilers allow generic interfaces with distinct accessible homonymous
specific procedures to be merged by USE association. Thsi compiler does not,
and for good reason: it leads to ambiguity in cases where a procedure name appears
outside a reference, such as in a PROCEDURE declaration statement as the procedure's
interface, the target of a procedure pointer assignment statement, or as an
actual argument.
This patch cleans up the code that handles these cases, improves some error
messages, and adds more tests.
Resolves https://github.com/llvm/llvm-project/issues/60228.
Differential Revision: https://reviews.llvm.org/D150915
Peter Klausler [Mon, 22 May 2023 16:47:38 +0000 (09:47 -0700)]
[flang] More precise CONTIGUOUS checking
A recent fix to avoid bogus errors with the CONTIGUOUS attribute caused
declaration checking to miss errors with applications of CONTIGUOUS to
names that are not variables. Restore those error messages, and
add tests to ensure that the original problem remains fixed while
the recent regressions have been resolved.
Differential Revision: https://reviews.llvm.org/D151124
Nick Desaulniers [Mon, 22 May 2023 18:38:19 +0000 (11:38 -0700)]
[clang][ExprConstant] fix __builtin_object_size for flexible array members
As reported by @kees, GCC treats __builtin_object_size of structures
containing flexible array members (aka arrays with incomplete type) not
just as the sizeof the underlying type, but additionally the size of the
members in a designated initializer list.
Fixes: https://github.com/llvm/llvm-project/issues/62789
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D150892
max [Mon, 22 May 2023 16:12:53 +0000 (11:12 -0500)]
[MLIR][python bindings] Expose TypeIDs in python
This diff adds python bindings for `MlirTypeID`. It paves the way for returning accurately typed `Type`s from python APIs (see D150927) and then further along building type "conscious" `Value` APIs (see D150413).
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150839
Artem Belevich [Fri, 19 May 2023 20:19:27 +0000 (13:19 -0700)]
[NVPTX] generalize hasPTX/hasSM predicates. NFC.
Replaces hasSMxy/hasPTXxy with hasSM<xy>/hasPTX<xy> so we can use them as needed
without having to hardcode each version explicitly.
Differential Revision: https://reviews.llvm.org/D150999
Michael Jones [Mon, 15 May 2023 18:17:31 +0000 (11:17 -0700)]
[libc] Use MPFR for strtofloat fuzzing
The previous string to float tests didn't check correctness, but due to
the atof differential test proving unreliable the strtofloat fuzz test
has been changed to use MPFR for correctness checking. Some minor bugs
have been found and fixed as well.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D150905
Jorge Gorbe Moya [Fri, 12 May 2023 18:42:40 +0000 (11:42 -0700)]
[lldb-vscode] Make tests not wait for 'launch' process events if launch fails.
After https://reviews.llvm.org/D147831, lldb-vscode doesn't send a
process event after launch/attach in case of failure. I believe this is
the right interpretation of the spec, because the description of the
event says:
> The event indicates that the debugger has begun debugging a new
> process.
and we haven't started debugging a process if there's no process because
we failed to launch it. This is also supported by the fact that
`request_launch` in vscode.py doesn't wait for the event if passed
`expectFailure=True`. However, this doesn't take into account
*unexpected* launch failures. In that case, `request_launch` will hang
indefinitely waiting for the process event.
This patch changes it so we'll only wait for these events if
`request["success"]` is true, independently of whether any failure was
expected or not.
Differential Revision: https://reviews.llvm.org/D150470
Slava Zakharin [Mon, 22 May 2023 17:08:29 +0000 (10:08 -0700)]
[flang][hlfir] Support rank mismatch with IGNORE_TKR(R).
Reboxing of the actual argument according to the type of the dummy
argument has to be aware of the potential rank mismatch, when
IGNORE_TKR(R) is used. This change only adds support for the mismatching
rank when the dummy argument has unlimited polymorphic type.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D151016
Fangrui Song [Mon, 22 May 2023 17:40:04 +0000 (10:40 -0700)]
[Driver] -fsanitize=function: unsupport wasm after D148573
D148573 made x86-specific -fsanitize=function available to all targets,
but wasm doesn't allow placing data words before the function label,
so unsupport wasm.
Michael Maitland [Thu, 27 Apr 2023 01:19:46 +0000 (18:19 -0700)]
[RISCV][llvm-mca] Add mca tests for riscv lmul instruments
Add llvm-mca tests for RISCV LMUL instruments to show that llvm-mca RISCV LMUL
instruments work.
This commit was previously reverted in
847789d45712. It is now being
recommitted since the memory leak has been fixed in
4d2a1d7dd8f4.
Differential Revision: https://reviews.llvm.org/D149496
Michael Maitland [Wed, 17 May 2023 20:48:18 +0000 (13:48 -0700)]
[llvm-mca][RISCV] Fix llvm-mca RISCVInstrument memory leak
There was a memory leak that presented itself once the llvm-mca
tests were committed. This leak was not checked for by the pre-commit
tests. This change changes the shared_ptr to a unique_ptr to avoid
this problem.
We will know that this fix works once committed since I don't know
whether it is possible to force a lit test to use LSan. I spent the
day trying to build llvm with LSan enabled without much luck. If
anyone knows how to build llvm with LSan for the lit-tests, I am
happy to give it another try locally.
Differential Revision: https://reviews.llvm.org/D150816
Fangrui Song [Mon, 22 May 2023 17:29:04 +0000 (10:29 -0700)]
[SCCP] Fix -Wunused-lambda-capture
Alex Langford [Tue, 16 May 2023 19:41:33 +0000 (12:41 -0700)]
[lldb][NFCI] Change return type of Language::GetInstanceVariableName
I don't think this needs to be a ConstString.
Differential Revision: https://reviews.llvm.org/D150709
Fangrui Song [Mon, 22 May 2023 17:11:30 +0000 (10:11 -0700)]
-fsanitize=function: support C
With D148785, -fsanitize=function no longer uses C++ RTTI objects and therefore
can support C. The rationale for reporting errors is C11 6.5.2.2p9:
> If the function is defined with a type that is not compatible with the type (of the expression) pointed to by the expression that denotes the called function, the behavior is undefined.
The mangled types approach we use does not exactly match the C type
compatibility (see `f(callee1)` below).
This is probably fine as the rules are unlikely leveraged in practice. In
addition, the call is warned by -Wincompatible-function-pointer-types-strict.
```
void callee0(int (*a)[]) {}
void callee1(int (*a)[1]) {}
void f(void (*fp)(int (*)[])) { fp(0); }
int main() {
int a[1];
f(callee0);
f(callee1); // compatible but flagged by -fsanitize=function, -fsanitize=kcfi, and -Wincompatible-function-pointer-types-strict
}
```
Skip indirect call sites of a function type without a prototype to avoid deal
with C11 6.5.2.2p6. -fsanitize=kcfi skips such calls as well.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D148827
Aaron Siddhartha Mondal [Mon, 22 May 2023 16:59:46 +0000 (18:59 +0200)]
[bazel] Remove terminfo dependency
The only enabling configuration of this is irreproducible. Since
terminfo doesn't provide essential functionality, remove it so that all
external dependencies now follow the same config_setting pattern.
This should be an NFC for most setups and all CI setups.
Reviewed By: phosek, MaskRay
Differential Revision: https://reviews.llvm.org/D151006
Valentin Clement [Mon, 22 May 2023 16:52:25 +0000 (09:52 -0700)]
[mlir][flang][openacc] Use new private representation for acc.loop
Update acc.loop private operands list to use the new design
introduced in D150622.
Depends on D150975
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150984
Valentin Clement [Mon, 22 May 2023 16:51:47 +0000 (09:51 -0700)]
[flang][openacc] Add initial support to lower private clause to the new design
This patch adds the initial infrastructure to lower the private clause to the
new design introduced in D150622. The init region is not implemented yet
and currently only yield the input argument (semantic is then similar with the previous
design currently). Implementation will come in a follow up patch to keep patch.
This patch also re-enable test commented out for `acc serial`, `acc serial loop`,
`acc parallel` and `acc parallel loop` with private clause.
Depends on D150972, D150973
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D150975
Valentin Clement [Mon, 22 May 2023 16:50:54 +0000 (09:50 -0700)]
[flang] Add getTypeAsString function to create symbols
This patch adds a common function to get a string representation
of a FIR type. This will be useful to generate couple of
operations like the acc.private.recipe, acc.firstprivate.recipe
and the acc.reduction.recipe
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150973
Valentin Clement [Mon, 22 May 2023 16:49:48 +0000 (09:49 -0700)]
[mlir][openacc] Use new private representation in acc.serial
Update acc.serial private operands list to use the new design
introduced in D150622.
Test in flang/test/Lower/OpenACC/acc-parallel.f90 and
flang/test/Lower/OpenACC/acc-parallel-loop.f90 are temporarly
disabled and will be enabled with updated lowering in the next
patch.
Depends on D150971
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150972
Alexandros Lamprineas [Thu, 11 May 2023 12:44:40 +0000 (13:44 +0100)]
[FuncSpec] Replace LoopInfo with BlockFrequencyInfo.
Using AvgLoopIters on any loop is too imprecise making the cost model
favor users inside loop nests regardless of the actual tripcount.
Differential Revision: https://reviews.llvm.org/D150375
Valentin Clement [Mon, 22 May 2023 16:49:07 +0000 (09:49 -0700)]
[mlir][openacc] Use new private representation in acc.parallel
Update acc.parallel private operands list to use the new design
introduced in D150622.
Test in flang/test/Lower/OpenACC/acc-parallel.f90 and
flang/test/Lower/OpenACC/acc-parallel-loop.f90 are temporarly
disabled and will be enabled with updated lowering in the follow-up
patch.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150971
pengchao.hu [Mon, 22 May 2023 16:35:33 +0000 (18:35 +0200)]
[MLIR][python bindings] Add more basic AttrBuilder for _ops_gen.py files
Add more attribute builders, such as "F32Attr", "F64Attr" and "F64ArrayAttr", which are useful to create operations by python bindings. For example, tosa.clamp in _tosa_ops_gen.py need 'F32Attr'.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150757
Nikolas Klauser [Mon, 22 May 2023 16:05:40 +0000 (09:05 -0700)]
[libc++] Fix ignore_format.txt list
For some reason the expected ignore_format.txt changed. This patch fixes it in trunk, but the problem is being investigated.
Reviewed By: #libc, Mordante
Spies: Mordante, libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D151115
Luke Lau [Mon, 22 May 2023 16:32:57 +0000 (17:32 +0100)]
[RISCV] Add missing zfh extensions to fixed vector load/store tests
Peiming Liu [Mon, 22 May 2023 16:00:55 +0000 (16:00 +0000)]
[mlir][sparse] fix document format
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D151114
Fabian Mora [Mon, 22 May 2023 16:21:28 +0000 (16:21 +0000)]
[mlir][memref] Fix num elements in lowering of memref.alloca op to LLVM
Fixes a mistake in the lowering of memref.alloca to llvm.alloca, as llvm.alloca uses the number of elements to allocate in the stack and not the size in bytes.
Reference:
LLVM IR: https://llvm.org/docs/LangRef.html#alloca-instruction
LLVM MLIR: https://mlir.llvm.org/docs/Dialects/LLVM/#llvmalloca-mlirllvmallocaop
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150705
Takuya Shimizu [Mon, 22 May 2023 15:29:20 +0000 (00:29 +0900)]
[clang][AST] TextNodeDumper should not evaluate the initializer of constexpr variable declaration when it has a dependent type
`TextNodeDumper` enabed through `-ast-dump` flag should not evlauate the initializer when it visits a constexpr `VarDecl` node if it has a dependent type.
I found a crashing case fixed by this change and added it as a test case.
`template <typename T> constexpr T call_init(0);`
Link: https://godbolt.org/z/3bG9Pjj5E
This is a fix for the regression caused by D146358
Differential Revision: https://reviews.llvm.org/D151033
Viktoriia Bakalova [Mon, 22 May 2023 10:10:49 +0000 (10:10 +0000)]
[clang] Fix label (de-)serialization in ASM statements.
Differential Revision: https://reviews.llvm.org/D151073
Fangrui Song [Mon, 22 May 2023 15:53:15 +0000 (08:53 -0700)]
Revert "Reapply D146987 "[Assignment Tracking] Enable by default""
This reverts commit
8dec295af0352fccb5825dc08e4ec21cb9ffe010.
See https://github.com/llvm/llvm-project/issues/62838
Fangrui Song [Mon, 22 May 2023 15:47:13 +0000 (08:47 -0700)]
[docs] Fix typo after D151098
Matt Arsenault [Mon, 22 May 2023 11:40:38 +0000 (12:40 +0100)]
AMDGPU: Fix assertion on assorted canonicalize vector types
This assert should have the same set of vector types as the binary
and ternary case (although this assert is kind of pointless, the code
should work for any vector type as-is).
Fixes part of issue #32650.
Jay Foad [Mon, 22 May 2023 14:40:57 +0000 (15:40 +0100)]
[AMDGPU] Fix lowering of @llvm.amdgcn.set.inactive(imm, poison)
If the second argument of V_SET_INACTIVE is undef/poison,
SIWholeQuadMode lowered it to a COPY from the first argument, but that
caused invalid MIR if the first argument was an immediate rather than a
register.
Fix this by lowering to a V_MOV instruction instead of a COPY.
Fixes https://github.com/llvm/llvm-project/issues/62862
Differential Revision: https://reviews.llvm.org/D151105
Joseph Huber [Mon, 22 May 2023 13:57:54 +0000 (08:57 -0500)]
[Clang][Docs] Add help test to `-march` and `-mcpu` to suggest `-mcpu=help`
Currently there is no documentation for these flags, users might find it
confusing to know which values are permitted. This change simply adds
documentation to suggest using `-mcpu=help` to list the availible target
names.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D151098
Benjamin Kramer [Mon, 22 May 2023 15:11:25 +0000 (17:11 +0200)]
Michael Platings [Mon, 22 May 2023 14:56:29 +0000 (15:56 +0100)]
[llvm-profdata] Fix test on Windows
Output on Windows is "llvm-profdata.exe"
Paulo Matos [Mon, 22 May 2023 14:32:28 +0000 (16:32 +0200)]
Add missing header for uint64_t
LLVM fails to build in some environments with EXPENSIVE_CHECKS
due to the use of uint64_t without including cstdint.
Differential Revision: https://reviews.llvm.org/D151101
Anshil Gandhi [Fri, 19 May 2023 16:32:12 +0000 (10:32 -0600)]
[InstCombine] Insert a bitcast to enable merging similar store insts
Given two Store instructions with equivalent pointer operands,
they could be merged into their common successor basic block if
the value operand of one is bitcasted to match the type of the
other.
Differential Revision: https://reviews.llvm.org/D150900
Sander de Smalen [Mon, 22 May 2023 13:52:18 +0000 (13:52 +0000)]
[SME2/SVE2p1] Extend llvm.aarch64.sve.convert.to/from.svbool to accept target("aarch64.svcount")
The convert intrinsics can be used to implement existing operations on svcount_t
when the actual bits/content of the predicate register doesn't matter (such
as PSEL, which copies the full contents of the first source register to the
destination register).
Reviewed By: CarolineConcatto, david-arm
Differential Revision: https://reviews.llvm.org/D150959
Sander de Smalen [Mon, 22 May 2023 13:52:06 +0000 (13:52 +0000)]
[SME2/SVE2p1] Change psel intrinsic such that the result/first operand are not overloaded.
All the bits of the first operand are copied to the destination register,
if the tested bit (in the second source operand) is active. This means we
copy over all vscale x 16 x i1's of the first operand. There is no need to
overload that type.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D150958
Sander de Smalen [Mon, 22 May 2023 13:37:34 +0000 (13:37 +0000)]
[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for ld1/ldnt1/st1/stnt1
These intrinsics are used to implement multi-vector load/store intrinsics that loads
or stores a tuple of 2 or 4 values, based on a predicate-as-counter operand, e.g.
__attribute__((arm_streaming))
svuint8x2_t svld1[_u8]_x2(svcount_t png, const uint8_t *rn);
__attribute__((arm_streaming))
void svst1[_u8_x2](svcount_t png, uint8_t *rn, svuint8x2_t zt);
As described in https://github.com/ARM-software/acle/pull/217
Reviewed By: CarolineConcatto
Differential Revision: https://reviews.llvm.org/D150956
Sander de Smalen [Mon, 22 May 2023 13:37:19 +0000 (13:37 +0000)]
[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for sel
These intrinsics are used to implement the sel intrinsics that selects
a tuple of 2 or 4 values based on a predicate-as-counter operand, e.g.
__attribute__((arm_streaming))
svuint8x2_t svsel[_u8_x2](svcount_t png, svuint8x2_t zn, svuint8x2_t zm);
__attribute__((arm_streaming))
svuint8x4_t svsel[_u8_x4](svcount_t png, svuint8x4_t zn, svuint8x4_t zm);
As described in https://github.com/ARM-software/acle/pull/217
Reviewed By: CarolineConcatto
Differential Revision: https://reviews.llvm.org/D150951
Nikita Popov [Mon, 22 May 2023 13:04:18 +0000 (15:04 +0200)]
[PostOrderIterator] Store end iterator (NFC)
Store the end iterator on the VisitStack, instead of recomputing
it every time, as doing so is not free.
Michael Platings [Mon, 22 May 2023 13:43:25 +0000 (14:43 +0100)]
[llvm-profdata] Accept --version argument
The `llvm-profdata --version` output now looks like:
llvm-profdata
LLVM (http://llvm.org/):
LLVM version 17.0.0git
Optimized build with assertions.
This makes llvm-profdata more consistent with other tools.
Reviewed By: simon_tatham
Differential Revision: https://reviews.llvm.org/D150964
Alex Bradbury [Mon, 22 May 2023 13:38:05 +0000 (14:38 +0100)]
[RISCV][test] Finish removing unneeded (implied) 'f' from Zvfbfwma, Zvfbfmin attribute tests
Missed a hunk in
a6e2b1ee49f553a06e22729d90e0a2738caf052e.
Alex Bradbury [Mon, 22 May 2023 13:33:38 +0000 (14:33 +0100)]
[RISCV][test] Remove unneeded (implied) 'f' from Zvfbfwma, Zvfbfmin attribute tests
This means the test properly checks that RISCVISAInfo includes the
implication for the F extension (directly, or indirectly through
zve32f).
Mariya Podchishchaeva [Mon, 22 May 2023 13:08:57 +0000 (09:08 -0400)]
[clang] Fix crash on attempt to initialize union with flexible array member
Due to missing check on union, there was a null expression
added to init list that caused crash later.
Fixes https://github.com/llvm/llvm-project/issues/61746
Reviewed By: aaron.ballman, shafik
Differential Revision: https://reviews.llvm.org/D150435
Alex Bradbury [Mon, 22 May 2023 13:21:28 +0000 (14:21 +0100)]
[RISCV][test][NFC] Trim unneeded +f/+d from -mattr in bfloat16 extension tests
Dmitry Makogon [Wed, 3 May 2023 07:19:57 +0000 (14:19 +0700)]
[SCEV] Replace NumTripCountsComputed stat with NumExitCountsComputed
This fixes assertion crash in https://github.com/llvm/llvm-project/issues/62380.
In the beginning of ScalarEvolution::getBackedgeTakenInfo
we make sure that BackedgeTakenCounts contains an entry
for the given loop.
Then we call computeBackedgeTakenCount which computes the result,
and in the end we insert it in the map like so:
return BackedgeTakenCounts.find(L)->second = std::move(Result);
So we expect that the entry for L still exists in the cache.
However, it can get deleted. When it has computed the result,
getBackedgeTakenInfo clears all the cached SCEVs that use the AddRecs in the loop.
In the crashing example, getBackedgeTakenInfo first gets called on an inner loop,
and during this call it gets called again on its parent loop.
This recursion happens after the call to computeBackedgeTakenCount.
And it happens so that some SCEV from the BTI of the child loop uses
an AddRec of the parent loop. So when we successfully compute BTI
for the parent loop, we erase already computed result for the child one.
The recursion happens in some debug only code that
updates statistics. The algorithm itself is non-recursive.
Namely the recursive call happens in BackedgeTakenInfo::getExact function
and its return value is only used to compare it against SCEVCouldNotCompute.
As suggested by nikic I replaced the NumTripCountsComputed and NumTripCountsNotComputed
with NumExitCountsComputed and NumExitCountsNotComputed respectively.
They are updated during computations made for single exits. It relieves us of the need
to compute exact exit count for the loop just to update the named
statistic and thus the recursion cannot happen anymore.
Differential Revision: https://reviews.llvm.org/D149251
Luke Lau [Tue, 2 May 2023 13:46:22 +0000 (14:46 +0100)]
[SLP][RISCV] Account for offset folding in getPointersChainCost
For a GEP in a pointer chain, if:
1) a pointer chain is unit-strided
2) the base pointer wasn't folded and is sitting in a register somewhere
3) the distance between the GEP and the base pointer is small enough and
can be folded into the addressing mode of the using load/store
Then we can exclude that GEP from the total cost of the pointer chain,
as it will likely be folded away.
In order to check if 3) holds, we need to know the type of memory access
being made by the users of the pointer chain. For that, we need to pass
along a new argument to getPointersChainCost. (Using the source pointer
type of the GEP isn't accurate, see https://reviews.llvm.org/D149889 for
more details).
Also note that 2) is currently an assumption, and could be modelled more
accurately.
This prevents some unprofitable cases from being SLP vectorized on
RISC-V by making the scalar costs cheaper and closer to the actual
codegen.
For now the getPointersChainCost hook is duplicated for RISC-V to prevent
disturbing other targets, but could be merged back in and shared with
other targets in a following patch.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D149654
Leandro Lupori [Tue, 16 May 2023 13:06:13 +0000 (13:06 +0000)]
[flang] Handle array constants of any rank
Add support for representing array constants of any rank with MLIR
dense attribute. This greatly improves compile time and memory
usage of programs with large array constants. We still support only
arrays of a few basic types, such as integer, real and logic.
Fixes https://github.com/llvm/llvm-project/issues/60376
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150686
Andrew Gozillon [Mon, 22 May 2023 12:30:41 +0000 (07:30 -0500)]
Revert "Revert "[Flang][OpenMP][MLIR] Add declare target attribute set and interface for the OpenMP dialect""
This reverts commit
aa6b47cdaf3cddc70b7af33c1edbda502ecb3d05.
And adds a fix (adding missing libraries
to CMakeLists.txt for the OpenMPDialect)
that allows failing builds to succeed.
Matthias Springer [Mon, 22 May 2023 12:13:08 +0000 (14:13 +0200)]
[mlir][tensor][bufferize] Bufferize tensor.splat op
The op bufferizes similarly to tensor.generate: it is lowered to a linalg.map, which may then lower to a loop nest that fills the buffer.
Differential Revision: https://reviews.llvm.org/D150952
Martin Braenne [Mon, 22 May 2023 09:52:31 +0000 (09:52 +0000)]
[clang][dataflow] Fix a null pointer crash in `computeBlockInputState()`.
The crash was due to unconditionally calling
`Block.succ_begin()->getReachableBlock()->hasNoReturnElement()`, but
`getReachableBlock()` can return null now that we have turned
`PruneTriviallyFalseEdges` on.
This patch adds two tests that crash without the fix.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D151071
Aaron Ballman [Mon, 22 May 2023 12:14:42 +0000 (08:14 -0400)]
Add WG14 N2607 to the list of backported features
Arrays and their element types are identically qualified as of C2x,
and we support that behavior as far back as C89.
As a drive-by, this adds the paper number for designated initializers
so that all the WG14 features can be uniquely identified despite the
lack of a feature testing macro.
Johannes de Fine Licht [Mon, 22 May 2023 12:00:22 +0000 (12:00 +0000)]
[MLIR][LLVM] Allow inlining llvm.intr.assume.
This operation is not marked pure because it needs to survive DCE, but
is otherwise safe to inline.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D151070
Johannes de Fine Licht [Mon, 22 May 2023 11:54:36 +0000 (11:54 +0000)]
[MLIR][LLVM] Allow inlining noalias attributes.
We can not yet generate new aliasing metadata based on these arguments
because their global nature does not allow parallel inlining, but since
this is not necessary for correctness, we allow inlining functions that
have arguments with the noalias attribute for now.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D151067
Muhammad Omair Javaid [Mon, 22 May 2023 11:46:11 +0000 (15:46 +0400)]
[LLDB] Fix missing import in TestInterruptBacktrace.py
This fixed missing import of lldbsuite.test.decorators in TestInterruptBacktrace.py.
pvanhout [Mon, 22 May 2023 09:15:15 +0000 (11:15 +0200)]
[AMDGPU] Handle multiple occurences of an incoming value in break large PHIs
We naively broke all incoming values, assuming they'd be unique.
However it's not illegal to have multiple occurences of, e.g. `[BB0, V0]`
in a PHI node. What's illegal though is having the same basic block
multiple times but with different values, and it's exactly what the
transform caused. This broke in some rare applications where the pattern
arised.
Now we cache the `BasicBlock, Value` pairs we're breaking so we can reuse the values and preserve this invariant.
Solves SWDEV-399460
Reviewed By: #amdgpu, rovka
Differential Revision: https://reviews.llvm.org/D151069
eopXD [Mon, 10 Apr 2023 07:36:44 +0000 (00:36 -0700)]
[11/11][POC][Clang][RISCV] Define vset for tuple type
For the cover letter of this patch-set, please checkout D146872.
Depends on D147916.
This is the 11th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Only vset for tuple type of NF=2, EEW=32, LMUL=1 is
defined now.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147917
eopXD [Mon, 10 Apr 2023 07:18:34 +0000 (00:18 -0700)]
[10/11][POC][Clang][RISCV] Define vget for tuple type
For the cover letter of this patch-set, please checkout D146872.
Depends on D147915.
This is the 10th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Only vget for tuple type of NF=2, EEW=32, LMUL=1 is
defined now.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147916
eopXD [Sat, 8 Apr 2023 19:14:54 +0000 (12:14 -0700)]
[9/11][POC][Clang][RISCV] Define tuple type variant of vsoxseg2ei32 vsuxseg2ei32
For the cover letter of this patch-set, please checkout D146872.
Depends on D147914.
This is the 9th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Currently, the old non-tuple indexed segment store is
not removed, and only signed integer indexed segment store of NF=2,
EEW=32 is defined here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147915
eopXD [Sat, 8 Apr 2023 19:00:28 +0000 (12:00 -0700)]
[8/11][POC][Clang][RISCV] Define tuple type variant of vloxseg2ei32 vluxseg2ei32
For the cover letter of this patch-set, please checkout D146872.
Depends on D147913.
This is the 8th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Currently, the old non-tuple indexed segment load is
not removed, and only signed integer indexed segment load of NF=2,
EEW=32 is defined here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147914
Johannes Reifferscheid [Mon, 22 May 2023 11:07:45 +0000 (13:07 +0200)]
[Bazel] Add missing tablegen.
(For MemorySlotTypeInterfaces)
Summary:
Reviewers: khasanovaa
Subscribers:
eopXD [Sat, 8 Apr 2023 18:15:33 +0000 (11:15 -0700)]
[7/11][POC][Clang][RISCV] Define tuple type variant of vssseg2e32
For the cover letter of this patch-set, please checkout D146872.
Depends on D147912.
This is the 7th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Currently, the old non-tuple strided segment store is
not removed, and only signed integer strided segment store of NF=2,
EEW=32 is defined here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147913
eopXD [Sat, 8 Apr 2023 15:40:49 +0000 (08:40 -0700)]
[6/11][POC][Clang][RISCV] Define tuple type variant of vlsseg2e32
For the cover letter of this patch-set, please checkout D146872.
Depends on D147911.
This is the 6th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Currently, the old non-tuple strided segment load is not
removed, and only signed integer strided segment load of NF=2, EEW=32
is defined here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147912
eopXD [Sat, 8 Apr 2023 15:25:49 +0000 (08:25 -0700)]
[5/11][POC][Clang][RISCV] Define tuple type variant of vlseg2e32ff
For the cover letter of this patch-set, please checkout D146872.
Depends on D147774.
This is the 5th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Currently, the old non-tuple unit-stride fault-first
segment load is not removed, and only signed integer unit-stride
fault-first segment load of NF=2, EEW=32 is defined here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147911
Andrew Gozillon [Mon, 22 May 2023 11:03:21 +0000 (06:03 -0500)]
Revert "[Flang][OpenMP][MLIR] Add declare target attribute set and interface for the OpenMP dialect"
This reverts commit
95b0b867b0d19919133693b8e75b170fd25a9cec.
Revert until fix found for certain failing buildbots
Jay Foad [Wed, 17 May 2023 13:15:02 +0000 (14:15 +0100)]
[AMDGPU] Simplify scavenging in indirectCopyToAGPR
This just makes it clearer that we do not want the scavenger to spill
here. NFCI.
Differential Revision: https://reviews.llvm.org/D150774
Muhammad Omair Javaid [Mon, 22 May 2023 10:43:52 +0000 (14:43 +0400)]
[LLDB] Skip TestInterruptBacktrace.py on Arm/Linux
TestInterruptBacktrace.py started randonmly failing on Arm/Linux
buildbot since
e19387e6936c. This patch marks it skipped.
Differential Revision: https://reviews.llvm.org/D150236
Jean Perier [Mon, 22 May 2023 08:14:34 +0000 (10:14 +0200)]
[flang][hlfir] Lower hlfir.where when there are no conflicts
Lower hlfir.where when the scheduling analysis determined that no
temporary storage is needed.
Differential Revision: https://reviews.llvm.org/D150881
Christian Kandeler [Tue, 16 May 2023 15:41:30 +0000 (17:41 +0200)]
[clangd] Renaming: Treat member functions like other functions
... by skipping the conflict check. The same considerations apply.
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D150685
Jean Perier [Mon, 22 May 2023 10:48:58 +0000 (12:48 +0200)]
[flang][hlfir] Enable WHERE scheduling in LowerHLFIROrderedAssignments
Nothing special is needed, other than adding the logging code for where
masks and to plug the pattern. This tests mainly adds test.
Note that some of the justifications to create temps shows some lacks of
side effect interface on operations (like hlfir.transpose), or on some
transparent llvm intrinsic calls (llvm.stacksave/restore).
I think we should as much as possible try to improve this on the ops
generate code rather than special casing it here.
Differential Revision: https://reviews.llvm.org/D150581
Kiran Chandramohan [Mon, 22 May 2023 09:50:28 +0000 (09:50 +0000)]
[MLIR][OpenMP] Set AllocaIP correctly for constructs nested in task
Fixes #60874
Reviewed By: psoni2628, NimishMishra
Differential Revision: https://reviews.llvm.org/D151027
Andrew Gozillon [Mon, 22 May 2023 10:40:16 +0000 (05:40 -0500)]
[Flang][OpenMP][MLIR] Add declare target attribute set and interface for the OpenMP dialect
This attribute represents the OpenMP declare target directive, it marks a function
or global as declare target by being present but also contains information on
the device_type and capture clause (link or to). It being an attribute allows it to
mark existing constructs and be converted trivially on lowering from the OpenMP
dialect to MLIR using amendOperation.
An interface has been made for the declare target attribute, with several helper
methods for managing the attribute, this interface can be applied to MLIR
operations that are allowed to be marked as declare target (as an example, it
is by default applied to func.func, LLVMFunc, fir.GlobalOps and LLVMGlobalOps).
Reviewers: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D150328
eopXD [Mon, 22 May 2023 10:39:12 +0000 (03:39 -0700)]
[Clang][RISCV] Remove unused variable `IsTuple` for structure `RVVIntrinsic`
Signed-off by: eop Chen <eop.chen@sifive.com>
Thomas Debesse [Mon, 22 May 2023 10:20:59 +0000 (12:20 +0200)]
[libclc] Fix linking against libLLVMSupport
Fixes https://github.com/llvm/llvm-project/issues/62018.
Johannes Reifferscheid [Mon, 22 May 2023 09:52:10 +0000 (11:52 +0200)]
Add missing includes.
Reviewed By: khasanovaa
Differential Revision: https://reviews.llvm.org/D151072
eopXD [Fri, 7 Apr 2023 09:21:44 +0000 (02:21 -0700)]
[4/11][POC][Clang][RISCV] Define tuple type variant of vsseg2e32
For the cover letter of this patch-set, please checkout D146872.
Depends on D147731.
This is the 4th patch of the patch-set.
This patch is a proof-of-concept and will be extended to full coverage
in the future. Currently, the old non-tuple unit-stride segment store is
not removed, and only signed integer unit-strided segment store of NF=2,
EEW=32 is defined here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147774
eopXD [Thu, 6 Apr 2023 08:29:18 +0000 (01:29 -0700)]
[3/11][POC][Clang][RISCV] Add typedef of the tuple type and define tuple type variant of vlseg2e32
For the cover letter of this patch-set, please checkout D146872.
Depends on D146873.
This is the 3rd patch of the patch-set. This patch originates from
D99593.
Note: This patch is a proof-of-concept and will be extended to full
coverage in the future. Currently, the old non-tuple unit-stride
segment load is not removed, and only signed integer unit-strided
segment load of NF=2, EEW=32 is defined here.
When replacing the old intrinsics, the extra `IsTuple` parameter under
various places will be redundant and removed.
Authored-by: eop Chen <eop.chen@sifive.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147731
Matt Arsenault [Tue, 16 May 2023 20:47:39 +0000 (21:47 +0100)]
ValueTracking: Drop rounding mode check for constrained_sqrt in CannotBeNegativeZero
The only value that can produce -0 is exactly -0, no rounding is involved. If the
denormal mode has flushed denormal inputs, a negative value could produce -0.
The constrained intrinsics do not track the denormal mode, and this is just
generally broken in the current set of FP predicates. The move to computeKnownFPClass
will address some of these issues.
Florian Hahn [Mon, 22 May 2023 09:44:17 +0000 (10:44 +0100)]
[VPlan] Add missing ifdef after
96686796f606.
Fixes build with debug printing disabled.
Matt Arsenault [Sat, 20 May 2023 09:23:16 +0000 (10:23 +0100)]
ValueTracking: Fix broken fabs implementation for computeKnownFPClass, again
This was only half complete. We need to enable the positive fields
for any negative classes.
Matt Arsenault [Sat, 20 May 2023 09:07:56 +0000 (10:07 +0100)]
ValueTracking: Add some regression tests for fabs handling in computeKnownFPClass
Krasimir Georgiev [Mon, 22 May 2023 09:18:48 +0000 (09:18 +0000)]
Luke Lau [Mon, 22 May 2023 08:50:23 +0000 (09:50 +0100)]
[SLP][RISCV] Add test for folding offsets in GEP pointer chains
Théo Degioanni [Mon, 22 May 2023 08:49:31 +0000 (08:49 +0000)]
[mlir] Add a generic SROA implementation.
This revision introduces a generic implementation of Scalar Replacement
Of Aggregates. In contrast to the implementation in LLVM, this focuses
on the core of SROA: destructuring aggregates. By implementing
interfaces on allocators and accessors, memory allocators can be
destructured into smaller allocators, through the MemorySlot
abstraction.
This pass only works on aggregates that are accessed in a "type-safe"
way, that is within the bounds and respecting the type of a given memory
slot. The destructuring pattern and functions only peel off the first
layer of aggregates and can safely be applied repeatedly. For
convenience, the transformation is also available as a pass that will
apply the pattern repeatedly.
Depends on D149958
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D150186
Florian Hahn [Mon, 22 May 2023 08:53:52 +0000 (09:53 +0100)]
[VPlan] Move live-out printing to VPLiveOut::print (NFC).
Preparation for D150398. This brings live-out printing in line with how
printing for recipes is handled.