Nikita Popov [Tue, 18 Jul 2023 09:00:44 +0000 (11:00 +0200)]
[IRBuilder] Remove various typed pointer handling (NFC)
Nuno Lopes [Tue, 18 Jul 2023 08:54:07 +0000 (09:54 +0100)]
[LowerMatrixIntrinsics] Use poison instead of undef as placeholder [NFC]
These values don't propagate to the output; they are always replaced with a subsequent shuffle
or insertelement.
Tested equivalence with Alive2, e.g., https://alive2.llvm.org/ce/z/fj4s78.
Weining Lu [Tue, 18 Jul 2023 03:19:26 +0000 (11:19 +0800)]
[LoongArch] Change 'using namespace llvm;' to 'namespace llvm {' in LoongArchTargetParser.cpp. NFC
And change 'using namespace llvm::LoongArch' to 'namespace LoongArch {'
to simplify the code a little bit.
Weining Lu [Tue, 18 Jul 2023 02:59:27 +0000 (10:59 +0800)]
[LoongArch] Remove useless 'invalid' and 'none' feature and arch names. NFC
Cullen Rhodes [Tue, 18 Jul 2023 08:29:53 +0000 (08:29 +0000)]
[mlir][ArmSME] Implement tile allocation
This patch adds a pass '-allocate-sme-tiles' to the ArmSME dialect that
implements allocation of SME ZA tiles.
It does this at the 'func.func' op level by replacing
'arm_sme.get_tile_id' ops with 'arith.constant' ops that represent the
tile number. The tiles in use in a given function are tracked by an
integer function attribute 'arm_sme.tiles_in_use' that is a 16-bit tile
mask with a bit for each 128-bit element tile (ZA0.Q-ZA15.Q), the
smallest ZA tile granule. This is initialized on the first
'arm_sme.get_tile_id' rewrite and updated on each subsequent rewrite.
Mixing of different element tile types is supported.
Section B2.3.2 of the SME spec [1] describes how the 128-bit element
tiles overlap with other element tiles.
Depends on D154941
[1] https://developer.arm.com/documentation/ddi0616/aa
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D154955
Nikita Popov [Thu, 13 Jul 2023 15:25:18 +0000 (17:25 +0200)]
Reapply [InstSimplify] Make simplifyWithOpReplaced() recursive (PR63104)
A similar assumption as for the x^x case also existed for the absorber
case, which lead to a stage2 miscompile. That assumption is not fixed.
-----
Support replacement of operands not only in the immediate
instruction, but also instructions it uses.
To the most part, this extension is straightforward, but there are
two bits worth highlighting:
First, we can now no longer assume that if the Op is a vector, the
instruction also returns a vector. If Op is a vector and the
instruction returns a scalar, we should consider it as a cross-lane
operation.
Second, for the x ^ x special case and the absorber special case, we
can no longer assume that one of the operands is RepOp, as we might
have a replacement higher up the instruction chain.
There is one optimization regression, but it is in a fuzzer-generated
test case.
Fixes https://github.com/llvm/llvm-project/issues/63104.
dingfei [Tue, 18 Jul 2023 08:29:56 +0000 (16:29 +0800)]
[ASTImporter] Fix 'isVirtual()' assert failure while import overridden methods
CXXMethodDecl::isVirtual() count the number of overridden methods.
This assertion is not true before overridden methods are fully loaded.
The body of this CXXMethodDecl can introduce deps on a derived class
which contains a method overriding this method, causing the assertion failure.
ImportOverriddenMethods() is moved before body loading to fix this issue.
Testcase is contributed by Balázs Kéri (balazske)
Differential Revision: https://reviews.llvm.org/D154701
Jens Massberg [Tue, 18 Jul 2023 07:49:10 +0000 (09:49 +0200)]
[clangd][c++20] Add concept Hover tests.
Concepts aren't fully supporteb by hover yet. For the currently
supported case we add a test here to prevent regressions in the future.
Differential Revision: https://reviews.llvm.org/D155558
Pavel Labath [Tue, 18 Jul 2023 08:16:00 +0000 (10:16 +0200)]
[lldb/test] Fix command-disassemble-mixed.c
Add it to lit.local.cfg so that it's actually run, and change it to
(properly) use the %clang_host substitution.
Nikita Popov [Tue, 18 Jul 2023 08:11:57 +0000 (10:11 +0200)]
[InstSimplify] Add additional tests for with op replaced fold (NFC)
Andrzej Warzynski [Tue, 11 Jul 2023 16:21:39 +0000 (16:21 +0000)]
[mlir][ArmSME] Introduce new lowering layer (Vector -> ArmSME)
At the moment, the lowering from the Vector dialect to SME looks like
this:
* Vector --> SME LLVM IR intrinsics
This patch introduces a new lowering layer between the Vector dialect
and the Arm SME extension:
* Vector --> ArmSME dialect (custom Ops) --> SME LLVM IR intrinsics.
This is motivated by 2 considerations:
1. Storing `ZA` to memory (e.g. `vector.transfer_write`) requires an
`scf.for` loop over all rows of `ZA`. Similar logic will apply to
"load to ZA from memory". This is a rather complex transformation and
a custom Op seems justified.
2. As discussed in [1], we need to prevent the LLVM type converter from
having to convert types unsupported in LLVM, e.g.
`vector<[16]x[16]xi8>`. A dedicated abstraction layer with custom Ops
opens a path to some fine tuning (e.g. custom type converters) that
will allow us to avoid this.
To facilitate this change, two new custom SME Op are introduced:
* `TileStoreOp`, and
* `ZeroOp`.
Note that no new functionality is added - these Ops merely model what's
already supported. In particular, the following tile size is assumed
(dimension and element size are fixed):
* `vector<[16]x[16]xi8>`
The new lowering layer is introduced via a conversion pass between the
Vector and the SME dialects. You can use the `-convert-vector-to-sme`
flag to run it. The following function:
```
func.func @example(%arg0 : memref<?x?xi8>) {
// (...)
%cst = arith.constant dense<0> : vector<[16]x[16]xi8>
vector.transfer_write %cst, %arg0 : vector<[16]x[16]xi8>, memref<?x?xi8>
return
}
```
would be lowered to:
```
func.func @example(%arg0: memref<?x?xi8>) {
// (...)
%0 = arm_sme.zero : vector<[16]x[16]xi8>
arm_sme.tile_store %arg0[%c0, %c0], %0 : memref<?x?xi8>, vector<[16]x[16]xi8>
return
}
```
Later, a mechanism will be introduced to guarantee that `arm_sme.zero`
and `arm_sme.tile_store` operate on the same virtual tile. For `i8`
elements this is not required as there is only one tile.
In order to lower the above output to LLVM, use
* `-convert-vector-to-llvm="enable-arm-sme"`.
[1] https://github.com/openxla/iree/issues/14294
Reviewed By: WanderAway
Differential Revision: https://reviews.llvm.org/D154867
WANG Xuerui [Tue, 18 Jul 2023 07:47:50 +0000 (15:47 +0800)]
[LoongArch][NFC] Consistently derive instruction mnemonics from TableGen record names
The recent D154183 and D154195 have introduced a simpler way to specify
instruction mnemonics: by leveraging TableGen's `NAME` and string
processing features, the mnemonics can be automatically derived from the
respective TableGen record names. LoongArch instructions don't have
"strange" characters in their names, so this approach can be applied to
all the other instructions.
A `deriveInsnMnemonic` helper class, modeled after the LSX/LASX mnemonic
derivation logic, has been added, and all non-pseudo instruction formats
are converted to use it, losing their `opstr/opcstr` arguments in the
process.
There are minor differences that are worth mentioning though:
* The atomic instructions with implicit data barriers have an underscore
(`_`) in their mnemonics, that will get converted to a period (`.`) if
not specially handled. Double-underscore (`__`) in record names are
converted to a single underscore in the resulting mnemonic; the
definitions are tweaked accordingly.
* Various duplicated FP instructions need special handling, mainly
because of the need to handle both FPR32 and FPR64 classes for a
single hardware instruction. The substrings `_xS`, `_xD` and `_64` are
additionally dropped before deriving FP instructions' mnemonics.
All of these are pure refactoring, no functional change.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D154916
Cullen Rhodes [Tue, 18 Jul 2023 07:28:00 +0000 (07:28 +0000)]
[mlir][ArmSME] Add custom get_tile_id and cast ops
This patch adds three new custom ops to the ArmSME dialect:
* arm_sme.get_tile_id - returns a scalar integer representing an SME
"virtual tile" that is not in use.
* arm_sme.cast_tile_to_vector - casts from a tile id to a 2-d scalable
vector type, which represents an SME "virtual tile".
* arm_sme.cast_vector_to_tile - casts from a 2-d scalable vector type,
which represents an SME "virtual tile", to a tile id.
The 'arm_sme.get_tile_id' op currently only supports tile 0, a follow-up
patch will implement proper tile allocation. A further follow-up patch
will demonstrate load/store to/from ZA using these ops.
See the op descriptions for further details and examples.
Thanks to @paulwalker-arm and @awarzynski for helping drive this.
Reviewed By: awarzynski, dcaballe
Differential Revision: https://reviews.llvm.org/D154941
Martin Erhart [Mon, 17 Jul 2023 14:27:07 +0000 (14:27 +0000)]
[mlir][bufferization] Add DeallocOp
The dealloc operation deallocates each of the given memrefs if there is no alias
to that memref in the list of retained memrefs and the corresponding
condition value is set. This condition can be used to indicate and pass on
ownership of memref values (or in other words, the responsibility of
deallocating that memref). If two memrefs alias each other, only one will be
deallocated to avoid double free situations.
The memrefs to be deallocated must be the originally allocated memrefs,
however, the memrefs to be retained may be arbitrary memrefs.
Returns a list of conditions corresponding to the list of memrefs which
indicates the new ownerships, i.e., if the memref was deallocated the
ownership was dropped (set to 'false') and otherwise will be the same as the
input condition.
Differential Revision: https://reviews.llvm.org/D155467
Balázs Kéri [Tue, 18 Jul 2023 06:47:56 +0000 (08:47 +0200)]
[clang][analyzer] Add all success/failure messages to StdLibraryFunctionsChecker.
Success or failure messages are now shown at all checked functions, if the call
(return value) is interesting.
Additionally new functions are added: open, openat, socket, shutdown
Reviewed By: donat.nagy
Differential Revision: https://reviews.llvm.org/D154423
Balázs Kéri [Tue, 18 Jul 2023 06:47:40 +0000 (08:47 +0200)]
[clang][analyzer] Display notes in StdLibraryFunctionsChecker only if interesting
The note tag that was previously added in all cases when a standard function call
is found is displayed now only if the function call (return value) is "interesting".
This results in less unneeded notes but some of the previously good notes disappear
too. This is because interestingness is not always set as it should be.
Reviewed By: donat.nagy
Differential Revision: https://reviews.llvm.org/D153776
Balázs Kéri [Tue, 18 Jul 2023 06:47:05 +0000 (08:47 +0200)]
[clang][analyzer] Add and change NoteTags in StdLibraryFunctionsChecker.
Change 1: ErrnoChecker notes show only messages related to errno,
not to assumption of success or failure of functions.
Change 2: StdLibraryFunctionsChecker adds its own note about success
or failure of functions, and the errno related note, independently.
Change 3: Every modeled function in StdLibraryFunctionsChecker
should have a note tag message in all "cases". This is not implemented yet,
only for file (stream) related functions.
Reviewed By: donat.nagy
Differential Revision: https://reviews.llvm.org/D153612
David Green [Tue, 18 Jul 2023 07:28:27 +0000 (08:28 +0100)]
[AArch64] Regenerate a couple of mir GlobalISel tests. NFC
See D155311
Fangrui Song [Tue, 18 Jul 2023 07:28:17 +0000 (00:28 -0700)]
[lld][test] Remove unused features
"system-linker-elf" and "demangler" have been unused since
lld/test/old-elf/ was removed in 2016.
LiaoChunyu [Tue, 18 Jul 2023 07:10:53 +0000 (15:10 +0800)]
[RISCV] Lower VP_CTLZ_ZERO_UNDEF/VP_CTTZ_ZERO_UNDEF/VP_CTLZ by converting to FP and extracting the exponent.
D111904, D141585 made RISC-V customized lower vector ISD::CTLZ_ZERO_UNDEF/CTTZ_ZERO_UNDEF/CTLZ
by converting to float and using the float result.
Perhaps VP_CTLZ_ZERO_UNDEF/VP_CTTZ_ZERO_UNDEF/VP_CTLZ could use the similar feature.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155150
Mikhail Goncharov [Tue, 18 Jul 2023 07:20:13 +0000 (09:20 +0200)]
[bazel] fix build of ArithUtils
Balazs Benics [Tue, 18 Jul 2023 07:15:11 +0000 (09:15 +0200)]
[ADT] Remove SFINAE constraint from llvm::iterator_range ctor for gcc-7
It turns out the SFINAE constraint breaks building MLIR using GCC-7,
which is an outdated, but supported compiler by llvm-project.
I tried to find a solution for fixing it, but I decided to cut branches
and just simply remove the SFINAE constraint until we drop GCC-7.
It was originally introduced by D152891.
Allegedly, GCC-8 and above builds just fine.
I tested GCC 8.4.0, and GCC 7.5.0, and now builds fine on both.
Differential Revision: https://reviews.llvm.org/D155441
Fixes https://github.com/llvm/llvm-project/issues/63843
Amir Bishara [Tue, 18 Jul 2023 07:13:20 +0000 (00:13 -0700)]
[mlir][cmake] Comment out redundant static assert regarding VarInfo struct
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D154940
Andrzej Warzynski [Sun, 16 Jul 2023 13:51:18 +0000 (13:51 +0000)]
[mlir][SparseTensor][ArmSVE] Conditionally disable SVE RUN line
This patch updates one SparseTensor integration test so that the VLA
vectorisation is run conditionally based on the value of the
MLIR_RUN_ARM_SME_TESTS CMake variable.
This change opens the path to reduce the duplication of RUN lines in
"mlir/test/Integration/Dialect/SparseTensor/CPU/". ATM, there are
usually 2 RUN lines to test vectorization in SparseTensor integration
tests:
* one for VLS vectorisation,
* one for VLA vectorisation whenever that's available and which
reduces to VLS vectorisation when VLA is not supported.
When VLA is not available, VLS vectorisation is verified twice. This
duplication should be avoided - integration test are relatively
expansive to run.
This patch makes sure that the 2nd vectorisation RUN line becomes:
```
if (SVE integration tests are enabled)
run VLA vectorisation
else
return
```
This logic is implemented using LIT's (relatively new) conditional
substitution [1]. It enables us to guarantee that all RUN lines are
unique and that the VLA vectorisation is only enabled when supported.
This patch updates only 1 test to set-up and to demonstrate the logic.
Subsequent patches will update the remaining tests.
[1] https://www.llvm.org/docs/TestingGuide.html
Differential Revision: https://reviews.llvm.org/D155403
Tomasz Kamiński [Tue, 18 Jul 2023 06:24:17 +0000 (08:24 +0200)]
[analyzer] Bind return value for assigment and copies of trivial empty classes
We now properly bind return value of the trivial copy constructor
and assignments of the empty objects. Such operations do not
perform any loads from the source, however they preserve identity
of the assigned object:
```
Empty e;
auto& x = (e = Empty());
clang_analyzer_dump(x); // &e, was Unknown
```
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D155442
Sameer Sahasrabuddhe [Tue, 18 Jul 2023 06:28:25 +0000 (11:58 +0530)]
[llvm] minor cleanup in GenericSSAContext
- update comments to reflect actual state
- use (implicitly inline) constexpr for a const static member
Itay Bookstein [Mon, 17 Jul 2023 18:56:27 +0000 (21:56 +0300)]
[CodeGen] Constify changeTypeToInteger
Surrounding methods are const, seems to be an oversight.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D155505
Johannes Doerfert [Tue, 18 Jul 2023 05:47:45 +0000 (22:47 -0700)]
[Attributor][FIX] Initialize variable.
tomasz-kaminski-sonarsource [Mon, 17 Jul 2023 15:04:38 +0000 (17:04 +0200)]
[analyzer] Rework support for CFGScopeBegin, CFGScopeEnd, CFGLifetime elements
This patch reworks generation for the `CFGScopeBegin`, `CFGScopeEnd`,
and `CFGLiftimeEnd`, in a way that they are now compatible with each
other and `CFGAutomaticObjDtor`. All of the above elements are now
generated by a single code path, that conditionally inserts elements if
they are requested.
In addition, the handling of `goto` statements is improved.
The `goto` statement may leave multiple scopes (and trigger destruction
and lifetime end for the affected variables) and enter multiple scopes,
for example:
```lang=C++
{
int s1;
{
int s2;
goto label; // leaves s1, s2, and enters t1 t1
}
}
{
int t1;
{
int t2;
label:
}
}
```
This is performed by first determining the shared parent scope of the
source and destination. And then emitting elements for exiting each
scope between the source and the parent, and entering each scope
between the parent and destination. All such elements are appended
to the source block, as one label may be reached from multiple scopes.
Finally, the approach for handling backward jumps is changed. When
connecting a source block to a destination block that requires the
insertion of additional elements, we put this element into a new block,
which is then linked between the source and the destination block.
For example:
```lang=C++
{
int t;
label:
// Destination block referred to as 'DB'
}
{
// Source block referred to as 'SB'
Obj s;
goto label;
}
```
The jump between `SB` with terminator `T: goto` and `DB` should be
coupled with the following CFG elements:
```
CFGAutomaticObjDtor(s)
CFGLifetimeEnd(s)
CFGScopeEnd(s)
CFGScopeBegin(t)
```
To handle such situations, we create a new link (`LB`) that is linked as
the predecessor of `DB`, to which we transfer the terminator (`goto`
statement) of `SB`. Then `LB` is handled in the same manner as the
source block in the case of forward jumps.
This produces CFG that looks like this:
```
SB -> LB (T: goto) -> DB
```
Finally, the resulting block is linked as the successor of `SB`. Such an
approach uses existing handling of the `noreturn` destructors.
As a reminder, for each destructor of an automatic object that is
marked as `noreturn`, a new `noreturn` block (marked `NBn`) is
created, at the destructor is inserted at the end of it.
To illustrate, given two `noreturn` destructors, we will have:
```
SB -> NB1 (noreturn)
NB2 (noreturn)
LB (T:goto) -> DB
```
Reviewed By: ymandel, steakhal
Differential Revision: https://reviews.llvm.org/D153273
Fangrui Song [Tue, 18 Jul 2023 04:50:55 +0000 (21:50 -0700)]
[lit] Remove unreachable @ expansion code
ArgumentParser expands @ (fromfile_prefix_chars) by default, so the
expansion code path is unused.
Charlie Barto [Tue, 18 Jul 2023 04:02:06 +0000 (21:02 -0700)]
[sanitizer][asan][win] Intercept _strdup on Windows instead of strdup
Intercept `_strdup` on windows, instead of the nonexistent `strdup`.
Jianjian GUAN [Mon, 17 Jul 2023 08:02:25 +0000 (16:02 +0800)]
[AVR][NFC] Merge AVRMCCodeEmitter::emitInstruction into AVRMCCodeEmitter::encodeInstruction.
The reasons are:
1, `AVRMCCodeEmitter::emitInstruction` has only one use which is `AVRMCCodeEmitter::encodeInstruction`, and the parameter `STI` is not used in this function. I think it might be copied from other target.
2, We do have `AVRAsmPrinter::emitInstruction`, and it would invoke `AVRMCCodeEmitter::encodeInstruction` in its calling chain, so if we call `AVRMCCodeEmitter::emitInstruction` in `AVRMCCodeEmitter::encodeInstruction`, it would be confusing.
Reviewed By: benshi001
Differential Revision: https://reviews.llvm.org/D155426
Youling Tang [Tue, 18 Jul 2023 01:40:20 +0000 (09:40 +0800)]
[fuzzer] Enable loongarch64
Enable fuzzer on loongarch64.
Reviewed By: SixWeining, xen0n, MaskRay
Differential Revision: https://reviews.llvm.org/D140601
Mehdi Amini [Mon, 17 Jul 2023 19:47:39 +0000 (12:47 -0700)]
Revert "Remove rdar links; NFC"
This reverts commit
d618f1c3b12effd0c2bdb7d02108d3551f389d3d.
This commit wasn't reviewed ahead of time and significant concerns were
raised immediately after it landed. According to our developer policy
this warrants immediate revert of the commit.
https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy
Differential Revision: https://reviews.llvm.org/D155509
Robert Suderman [Mon, 17 Jul 2023 23:14:16 +0000 (16:14 -0700)]
[mlir][linalg] Add a padding case for `ComplexType`
If the paddingAttr is an ArrayAttr with two values we know that
the element type is a `ComplexType` and we should pad the value
accordingly.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D154908
Konstantina Mitropoulou [Fri, 16 Jun 2023 02:02:33 +0000 (19:02 -0700)]
[DAGCombiner] Change foldAndOrOfSETCC() to optimize and/or patterns
CMP(A,C)||CMP(B,C) => CMP(MIN/MAX(A,B), C)
CMP(A,C)&&CMP(B,C) => CMP(MIN/MAX(A,B), C)
This first patch handles integer types.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D153502
Konstantina Mitropoulou [Wed, 21 Jun 2023 22:53:47 +0000 (15:53 -0700)]
[NFC] Tests for future commit in DAGCombiner
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D153479
Matt Arsenault [Tue, 18 Jul 2023 00:03:46 +0000 (20:03 -0400)]
InlineSpiller: Fix copy identification bugs in isCopyOfBundle
Noticed by inspection of
b7836d856206ec39509d42529f958c920368166b. This was checking if the
first instruction was a copy, not the current MI. It should fully
respect the isCopyInstr result. Hopefully this fixes a reported
regression which we can extract a test from.
Matt Arsenault [Sun, 16 Jul 2023 14:28:28 +0000 (10:28 -0400)]
AMDGPU: Fix broken denormal constant folding of canonicalize
This needs to consider the dynamic denormal mode. It should be
possible to implement a runtime DAZ check with a canonicalize.
Matt Arsenault [Sun, 16 Jul 2023 13:04:38 +0000 (09:04 -0400)]
AMDGPU: Use available subtarget member
Matt Arsenault [Sat, 15 Jul 2023 16:02:37 +0000 (12:02 -0400)]
AMDGPU: Use hex floats instead of ugly bitcasting
Fangrui Song [Mon, 17 Jul 2023 23:42:11 +0000 (16:42 -0700)]
[llvm-exegesis] Guard __builtin_thread_pointer use with __has_builtin
While Clang targets have supported __builtin_thread_pointer for a very
long time (e.g., 2007 for AArch32, 2015 for AArch64), for some GCC
ports, the support is very new (11.0 for x86[1], while we need to
support GCC 7), and many ports haven't implemented
__builtin_thread_pointer yet (m68k, powerpc, etc).
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
Johannes Doerfert [Mon, 17 Jul 2023 23:26:06 +0000 (16:26 -0700)]
[Attributor][FIX] Initialize out parameters
Daniel Thornburgh [Mon, 17 Jul 2023 23:16:18 +0000 (16:16 -0700)]
[ubsan] Make sigaction.cpp test UNSUPPORTED rather than XFAIL
The test fails on some builders but not on others; there's likely some
kind of environment dependence that should be investigated.
See https://reviews.llvm.org/D155317
AdityaK [Mon, 17 Jul 2023 22:40:16 +0000 (15:40 -0700)]
Enable zba and zbs for RISCV64 Android
Reviewers: enh, pirama, srhines, asb
Differential Revision: https://reviews.llvm.org/D155339
Arthur Eubanks [Mon, 17 Jul 2023 23:10:21 +0000 (16:10 -0700)]
Revert "[llvm-reduce] Reduce function calling convention"
This reverts commit
702a4d89b413dfcd6619007de1056a48b60f367a.
Can break calling convention restrictions.
Michael Maitland [Mon, 17 Jul 2023 15:52:06 +0000 (08:52 -0700)]
[RISCV] Split BEXT and BEXTI Write classes. NFC.
BEXT and BEXTI may behave differently from other Zbs instructions.
Split the write classes so these differences may be modeled by
scheduler models.
Differential Revision: https://reviews.llvm.org/D155476
Arthur Eubanks [Mon, 17 Jul 2023 22:37:20 +0000 (15:37 -0700)]
[llvm-reduce] Reduce global value linkage
Evandro Menezes [Sat, 8 Jul 2023 03:10:24 +0000 (22:10 -0500)]
[AArch64] Add scheduling model for Neoverse V1
Add the scheduling model for Neoverse V1.
Differential revision: https://reviews.llvm.org/D154756
Louis Dionne [Mon, 17 Jul 2023 22:33:07 +0000 (18:33 -0400)]
[libc++] Remove broken self test for the libc++ Lit format
The empty.sh.cpp test never tested what it was intended to test, because
it did contain an unexpected RUN: command. This was discovered in
https://reviews.llvm.org/D154987 while trying to land an unrelated change.
Since there is no reliable way to test what I was trying to test from
the libc++ test suite, just remove the test.
Arthur Eubanks [Mon, 17 Jul 2023 22:17:18 +0000 (15:17 -0700)]
[llvm-reduce] Reduce function calling convention
Nick Desaulniers [Mon, 17 Jul 2023 21:49:39 +0000 (14:49 -0700)]
[ConstantHoisting] stop rematerializing InsertionPt
Reading this code, I noticed that we call findMatInsertPt a lot, for the
same inputs. Calculate it once and save the result.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155237
Louis Dionne [Tue, 11 Jul 2023 18:40:11 +0000 (14:40 -0400)]
[libc++] Use _LIBCPP_VERBOSE_ABORT in a few remaining __throw_FOO functions
This provides better error messages when the program terminates due to
an exception being thrown in -fno-exceptions mode. Those seem to have
been missed in https://reviews.llvm.org/D141222.
Differential Revision: https://reviews.llvm.org/D154995
Louis Dionne [Tue, 27 Jun 2023 20:34:06 +0000 (16:34 -0400)]
[lit] Remove the --no-indirectly-run-check option
This option had originally been added in D83069 to allow disabling the
check that something is going to get run at all when a specific test name
is used on the command-line. Since we now use getTestsForPath() (from D151664)
to get the tests to run for a specific path, we don't need a specific check
for this anymore -- Lit will produce the same complaint it would produce if
you provided a directory with no tests.
If one needs to run a specific test on the command-line and the Lit
configuration would normally not include that test, the configuration
should be set up as a "standalone" configuration or it should be fixed
to allow for that test to be found (i.e. probably fix the allowed test
suffixes).
Differential Revision: https://reviews.llvm.org/D153967
Arthur Eubanks [Mon, 17 Jul 2023 21:52:08 +0000 (14:52 -0700)]
Revert "[SLP][NFC]Improve compile-time by using map {TreeEntry *, Instruction *}"
This reverts commit
0d21b7cbdeb2f2eb5ef123a15099da0b651b24c0.
Causes broken IR, test case provided at
https://reviews.llvm.org/rG0d21b7cbdeb2f2eb5ef123a15099da0b651b24c0
Nick Desaulniers [Mon, 17 Jul 2023 21:40:09 +0000 (14:40 -0700)]
[ConstantHoisting] use struct rather than tuple for adjustments
We pack this info in a tuple just to spread it back out for a function
call. Spreads in C++ are awkward. If I want to add an additional
element to the tuple, I need to add more calls to std::get<> later. Just
use a struct.
Reviewed By: void
Differential Revision: https://reviews.llvm.org/D155236
Matt Arsenault [Thu, 13 Jul 2023 17:04:42 +0000 (13:04 -0400)]
AMDGPU: Split and convert some rcp and rsq tests to generated checks
Matt Arsenault [Mon, 17 Jul 2023 12:18:51 +0000 (08:18 -0400)]
DAG: Constant fold frexp nodes
Special casing the nonfinite exponent value everywhere is kind of
annoying.
Matt Arsenault [Mon, 17 Jul 2023 00:32:01 +0000 (20:32 -0400)]
InstSimplify: Handle basic folds for frexp
Handle constant folding and idempotent folding. Not sure
this is an appropriate use of undef for the inf/nan case. The
C version says the second result is "unspecified". The AMDGPU
instruction returns 0.
Matt Arsenault [Mon, 17 Jul 2023 00:13:00 +0000 (20:13 -0400)]
InstSimplify: Add baseline tests for frexp handling
Matt Arsenault [Mon, 17 Jul 2023 21:14:40 +0000 (17:14 -0400)]
ValueTracking: Fix computeKnownFPClass for vector-with-scalar powi
Fixes regression reported after
0f4eb557e87912afa412b1b0299d10eb7443410b
Anna Thomas [Mon, 17 Jul 2023 21:17:00 +0000 (17:17 -0400)]
[LV] Precommit test for interleaving miscompile
Identified another miscompile while working on fixing interleaving's
current miscompile in D154309. This is different from testcases landed in D154309,
since it showcases an incorrect sinking of store (the former testcases
in that review and follow-up ones) showed incorrect hoisting of loads
across stores.
Alexey Bataev [Mon, 17 Jul 2023 20:16:45 +0000 (13:16 -0700)]
[SLP][NFC]Improve performance of isGatherShuffledEntry() function, NFC.
Transformed if checks to asserts and simplified some more code to
improve compile time.
Rob Suderman [Mon, 17 Jul 2023 20:32:49 +0000 (13:32 -0700)]
[mlir] Add `ComplexType` conversion support for `convertScalarToDtype`
Linalg operations can include `complex` types in the src/target types.
This should include conversion between `arith` and `complex` types when
constructing `linalg` operations.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D154740
Paul Robinson [Mon, 17 Jul 2023 18:49:53 +0000 (11:49 -0700)]
Reland "[PS4/PS5] Tidy up driver warnings finding the SDK"
Instead of warning possibly up to 3 times about the same problem,
warn only about the actual missing directories.
This reverts commit
9b3323d39f635db870de958f067c672f54d7b192.
The warning will stay DefaultIgnore upstream, because a variety of
tests aren't expecting it and updating the tests isn't worth the
effort.
Jan Svoboda [Fri, 7 Jul 2023 02:27:48 +0000 (19:27 -0700)]
[clang][modules] Skip submodule & framework re-definitions in module maps
Before D150478, there were situations when Clang avoided parsing a module map because it was likely to re-define an already defined module (either by a PCM or by previously-found module map). Since Clang no longer performs that check and does parse the extra module map (due to the FW/FW_Private issue described in D150478), this patch re-implements the same semantics by skipping the duplicate definition of the framework module while parsing the module map.
Depends on D150478.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150479
Jan Svoboda [Thu, 6 Jul 2023 17:07:04 +0000 (19:07 +0200)]
[clang][modules][deps] Parse "FW_Private" module map even after loading "FW" PCM
When Clang loads a PCM that depends on another PCM describing framework module "FW", `ModuleMap` registers "FW" as known, without seeing the module map that defines it (or the adjacent "FW_Private" module map). Later, when looking at a header from "FW_Private", `ModuleMap` returns early due to having knowledge about "FW" and never associates that header with "FW_Private", leading to it being treated as textual. This behavior is caused by D150292, where the scanner stops calling `HeaderSearch::lookupModule()` eagerly for every loaded PCM.
This patch skips an early check when trying to figure out the framework module for a header, which ensures the "FW" and (most importantly) "FW_Private" module maps can be parsed even after loading "FW" from a PCM. Note that the `HeaderSearch::loadModuleMapFile()` function we not call unconditionally has caching behavior of its own, meaning it will avoid parsing module map file repeatedly.
Depends on D150320.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150478
Jan Svoboda [Thu, 6 Jul 2023 16:30:06 +0000 (18:30 +0200)]
[clang][modules][deps] Avoid checks for relocated modules
Currently, `ASTReader` performs some checks to diagnose relocated modules. This can add quite a bit of overhead to the scanner: it requires looking up, parsing and resolving module maps for all transitively loaded module files (and all the module maps encountered in the search paths on the way). Most of those checks are not really useful in the scanner anyway, since it uses strict context hash and immutable filesystem, which prevent those scenarios in the first place.
This can speed up scanning by up to 30%.
Depends on D150292.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150320
Jan Svoboda [Thu, 6 Jul 2023 16:18:03 +0000 (18:18 +0200)]
[clang][modules] Serialize `Module::DefinitionLoc`
This is a prep patch for avoiding the quadratic number of calls to `HeaderSearch::lookupModule()` in `ASTReader` for each (transitively) loaded PCM file. (Specifically in the context of `clang-scan-deps`).
This patch explicitly serializes `Module::DefinitionLoc` so that we can stop relying on it being filled by the module map parser. This change also required change to the module map parser, where we used the absence of `DefinitionLoc` to determine whether a file came from a PCM file. We also need to make sure we consider the "containing" module map affecting when writing a PCM, so that it's not stripped during serialization, which ensures `DefinitionLoc` still ends up pointing to the correct offset. This is intended to be a NFC change.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150292
Siu Chi Chan [Mon, 10 Jul 2023 17:30:23 +0000 (13:30 -0400)]
[HIP] Ignore host linker flags for device-only
When compiling in device only mode (e.g. --offload-device-only), the
host linker phase would not happen and therefore, the driver should
ignore all the host linker flags.
Differential Revision: https://reviews.llvm.org/D154881
Change-Id: I8244acef5c33108cf15b1dbb188f974f30099718
Valentin Clement [Mon, 17 Jul 2023 20:25:11 +0000 (13:25 -0700)]
[flang][openacc][NFC] Add test for scalar allocatable and pointer reduction
Add test for simple scalar allocatable or pointer. Set up the TODO
to be triggered when the allocatable or pointer are arrays.
Support for pointer/allocatable arrays will come next.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155230
Cassie Jones [Mon, 17 Jul 2023 19:56:35 +0000 (12:56 -0700)]
[Driver] Also warn about -mwatchos-version-min and -mtvos-version-min
Sometimes users pass this option when targeting embedded architectures like armv7m on non-darwin platforms.
This applies to watchOS and tvOS as well as iOS.
Depends on D155407
Reviewed By: MaskRay, ahatanak
Differential Revision: https://reviews.llvm.org/D155408
Nikolas Klauser [Mon, 17 Jul 2023 20:19:52 +0000 (13:19 -0700)]
[libc++][NFC] Remove unused macro definition
Louis Dionne [Tue, 4 Jul 2023 22:11:16 +0000 (18:11 -0400)]
[libc++] Move _LIBCPP_NO_THREAD_SAFETY_ANALYSIS to __config
This makes __threading_support contain nothing but the base threading
API provided by the system.
Differential Revision: https://reviews.llvm.org/D155458
Valentin Clement [Mon, 17 Jul 2023 20:02:50 +0000 (13:02 -0700)]
[flang][openacc] Add proper TODO for reduction with dynamic shaped array
Lowering for reduction with dynamic shaped arrays is not implemented yet.
Add a proper TODO for the time being.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155324
Peter Klausler [Mon, 17 Jul 2023 16:42:12 +0000 (09:42 -0700)]
[flang] Fix minor nits with INCLUDE line recognition
Fix some problems with INCLUDE line recognition pointed out by some
recently-added tests to the LLVM test suite.
Differential Revision: https://reviews.llvm.org/D155497
Alex Langford [Tue, 11 Jul 2023 23:45:32 +0000 (16:45 -0700)]
[lldb][NFCI] Avoid construction of temporary std::strings in RegisterValue
Differential Revision: https://reviews.llvm.org/D155030
Yaxun (Sam) Liu [Mon, 17 Jul 2023 15:57:38 +0000 (11:57 -0400)]
[HIP] Rename predefined macros
Rename HIP_API_PER_THREAD_DEFAULT_STREAM and __HIP_NO_IMAGE_SUPPORT
so that they follow the convention with prefix and postfix __.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D155480
Peter Klausler [Tue, 11 Jul 2023 17:05:22 +0000 (10:05 -0700)]
[flang] Extension: allow DATA to precede declaration under IMPLICIT NONE(TYPE)
It is not standard conforming under IMPLICIT NONE(TYPE) for a name to
appear in a DATA statement prior to its explicit type declaration,
but it is benign, supported in other compilers, and attested in real
applications. Support it with an optional portability warning.
Fixes GitHub LLVM bug https://github.com/llvm/llvm-project/issues/63783.
Peter Klausler [Mon, 10 Jul 2023 23:06:09 +0000 (16:06 -0700)]
[flang] Avoid bogus errors with LBOUND/UBOUND(assumed rank array, DIM=)
Don't emit bogus compile-time error messages about out-of-range values
for the DIM= argument to LBOUND/BOUND when the array in question is an
assumed-rank dummy array argument.
Differential Revision: https://reviews.llvm.org/D155494
Peter Klausler [Mon, 17 Jul 2023 16:38:55 +0000 (09:38 -0700)]
[flang] Correct disambiguation of possible statement function definitions
The statement "A(J) = expr" could be an assignment to an element of an
array A, an assignment to the target of a pointer-valued function A, or
the definition of a new statement function in the local scope named A,
depending on whether it appears in (what might still be) the specification
part of a program or subprogram and what other declarations and definitions
for A might exist in the local scope or have been imported into it.
The standard requires that the name of a statement function appear in
an earlier type declaration statement if it is also the name of an
entity in the enclosing scope. Some other Fortran compilers mistakenly
enforce that rule in the case of an assignment to the target of a
pointer-valued function in the containing scope, after misinterpreting
the assignment as a new local statement function definition.
This patch cleans up the handling of the various possibilities and
resolves what was a crash in the case of a statement function definition
whose name was the same as that of a procedure in the outer scope whose
result is *not* a pointer.
Differential Revision: https://reviews.llvm.org/D155493
Peter Klausler [Thu, 6 Jul 2023 00:42:36 +0000 (17:42 -0700)]
[flang] Emit errors on vector subscripts with duplicated elements when object must be definable
When the left-hand side of an assignment, or any other context demanding
definability, comprises a designator with a vector subscript that is
known at compilation time to have one or more duplicated elements,
emit an error message.
Differential Revision: https://reviews.llvm.org/D155492
Peter Klausler [Wed, 5 Jul 2023 21:03:14 +0000 (14:03 -0700)]
[flang] Fix constraint check on CLASS() entities
Entities declared with CLASS() must be dummy arguments, allocatables,
or pointers. This constraint check is currently correct for objects
but not for procedures, and getting it right needs to avoid being
confused between pointers to procedures and pointers returned by
procedures.
Differential Revision: https://reviews.llvm.org/D155491
Leonard Grey [Wed, 21 Jun 2023 21:23:04 +0000 (17:23 -0400)]
[lsan][Darwin] Unconditionally strip high bits from potential pointers
The method cache stashes a mask in the high bits under some circumstances:
https://github.com/apple-oss-distributions/objc4/blob/
689525d556eb3dee1ffb700423bccf5ecc501dbf/runtime/objc-cache.mm#L589
I'm hitting this now on macOS 13.4 arm64, so we can no longer rely on OBJC_FAST_IS_RW to identify potential pointers that need to be transformed
Differential Revision: https://reviews.llvm.org/D153471
Martin Braenne [Mon, 17 Jul 2023 18:42:36 +0000 (18:42 +0000)]
[clang][dataflow] Bugfix for `refreshStructValue()`.
In the case where the expression was not yet associated with a storage location, we created a new storage location but failed to associate it with the expression.
The newly added test fails without the fix.
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D155465
wren romano [Fri, 7 Jul 2023 19:46:32 +0000 (12:46 -0700)]
[llvm] Allow SMLoc to be used in constexpr context
Since `StringRef::empty` can be used in constexpr context, it seems reasonable that `SMLoc::isValid` should be too. The default-ctor and `operator==` are made constexpr for consistency.
In particular, the `constexpr` keyword is needed for silencing warnings on Windows (whereas Linux allows constexpr usage without the keyword).
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D154741
Peter Klausler [Wed, 5 Jul 2023 18:19:47 +0000 (11:19 -0700)]
[flang] Catch impure specifics called in DO CONCURRENT
Rework the code used to check for calls to impure procedures in DO CONCURRENT
constructs. The current code wasn't checking the representation of the
procedure references in the strongly typed expressions, so it was missing
calls to impure subprograms made via generic interfaces. While here,
improve error messages, and fix some minor issues exposed by testing the
improved checks.
Differential Revision: https://reviews.llvm.org/D155489
Alexey Bataev [Mon, 17 Jul 2023 16:47:01 +0000 (09:47 -0700)]
[SLP][NFC]Improve compile-time by using map {TreeEntry *, Instruction *}
in getLastInstructionInBundle(), NFC.
Instead of building EntryToLastInstruction before the vectorization,
build it automatically during the calls to getLastInstructionInBundle()
function.
Peter Klausler [Mon, 3 Jul 2023 21:33:12 +0000 (14:33 -0700)]
[flang] Disallow noninteroperable dummy procedures from interoperable procedures
A BIND(C) interoperable procedure must have only interoperable dummy procedures.
Differential Revision: https://reviews.llvm.org/D155488
Peter Klausler [Mon, 17 Jul 2023 18:30:30 +0000 (11:30 -0700)]
[flang][unittests] Silence compiler warning
At least one compiler more recent that the one that I test with emits
a warning (valid but benign) for some code in a unit test that I
modified a few minutes ago. Adding some curly braces to placate the
compiler.
Jim Ingham [Mon, 17 Jul 2023 17:50:17 +0000 (10:50 -0700)]
Fix the root directory completion test.
It was implicitly assumning that "/" would have no files in it, only
directories. That's not true, for instance on macOS if you've navigated
to the root directory in the Finder...
Since we're assuming everything we check against is a directory, then we
need to filter the completion for that coming in.
Johannes Doerfert [Tue, 20 Jun 2023 23:43:24 +0000 (16:43 -0700)]
[Attributor] Replace AAReturnedValues with AAPotentialValuesReturned
The very first AA, at least the first one in order, is not necessary
anymore. `AAReturnedValues` was from a different time; one might say, a
simpler time.
It was rewriten once to use `Attribute::getAssumedSimplifiedValues`,
which is what the replacement, `AAPotentialValuesReturned`, does too.
To match the old behavior we needed to avoid the helper
`AAReturnedFromReturnedValues` and iterate the return instructions
explicitly, however, it is still less complexity than it was before.
`AAReturnedFromReturnedValues` and `getAssumedSimplifiedValues` now
allow users to stop at PHI and select nodes or to ignore those and look
through. `AANoFPClass` will stop at select and phi nodes to read the
fast math flags.
Fixes: https://github.com/llvm/llvm-project/issues/63404
Differential Revision: https://reviews.llvm.org/D154917
Johannes Doerfert [Tue, 11 Jul 2023 04:03:06 +0000 (21:03 -0700)]
[Attributor][NFC] Improve debug message
Paul Robinson [Mon, 17 Jul 2023 17:30:44 +0000 (10:30 -0700)]
Revert "[PS4/PS5] Tidy up driver warnings finding the SDK"
This reverts commit
ba9a7f73a12e75b005bfec359ddc37999b1d38c0.
Bot failures due to enabling the warning by default.
e.g. https://lab.llvm.org/buildbot/#/builders/139/builds/45263
Andrzej Warzynski [Sat, 15 Jul 2023 16:21:34 +0000 (16:21 +0000)]
[mlir][linalg] Fix vectorisation of tensor.extract with dynamic shapes
The Linalg vectoriser incorrectly recognises the following
`tensor.extract` as contiguous:
```
func.func @example(%in: tensor<123x321xf32>, %arg1: tensor<1x?x8xf32>) -> tensor<1x?x8xf32> {
%c0 = arith.constant 1 : index
%2 = linalg.generic {
indexing_maps = [#map1],
iterator_types = ["parallel", "parallel", "parallel"]
} outs(%arg1 : tensor<1x?x8xf32>)
{
^bb0(%arg3: f32):
%idx_0 = linalg.index 0 : index
%idx_1 = linalg.index 1 : index
%idx = arith.addi %idx_0, %idx_1 : index
%7 = tensor.extract %in[%c0, %idx] : tensor<123x321xf32>
linalg.yield %7 : f32
} -> tensor<1x?x8xf32>
return %2 : tensor<1x?x8xf32>
}
```
However, the following index Op corresponds to the dynamic dimension
in the iteration space:
```
%idx_1 = linalg.index 1 : index
```
The vectoriser should assume that:
* this index Op _is not_ loop invariant,
* the resulting memory access is a gather load
This is what this patch fixes.
Differential Revision: https://reviews.llvm.org/D155373
Paul Kirth [Mon, 17 Jul 2023 17:09:47 +0000 (17:09 +0000)]
[clang][docs] Fix tag target name in link
The `see patch` tag conflicted w/ one later in the document. Changing
the text should fix the documentation build error.
Differential Revision: https://reviews.llvm.org/D155490
Amy Kwan [Mon, 17 Jul 2023 14:57:34 +0000 (09:57 -0500)]
[AIX][TLS] Account for local-exec accesses in XCOFFObjectWriter
This is a follow up to D149722 and aims to address https://github.com/llvm/llvm-project/issues/63885.
Local-exec accesses were not previously accounted for in XCOFFObjectWriter.
Specifically, the R_TLS_LE relocation was not previously handled, which lead to
the incorrect value being written for the relocation target.
Within this patch, the value being written is set to the symbol's virtual
address and extra relocation tests are added.
Differential Revision: https://reviews.llvm.org/D155415
Amir Ayupov [Mon, 17 Jul 2023 16:50:17 +0000 (09:50 -0700)]
[BOLT][Utils] Add dot2html module entry point
Peter Klausler [Tue, 11 Jul 2023 18:06:21 +0000 (11:06 -0700)]
[flang][runtime] Don't do partial data transfer on short character read with ADVANCE='NO', PAD='NO'
When a non-advancing formatted READ can't completely fill a CHARACTER
input item with data, and PAD='NO', don't modify the variable at all.
This matters when the error is recoverable.
Fixes https://github.com/llvm/llvm-project/issues/63772
Differential Revision: https://reviews.llvm.org/D155000
Simon Pilgrim [Mon, 17 Jul 2023 16:58:25 +0000 (17:58 +0100)]
[X86] Regenerate tail-call-casts.ll test coverage