Arthur Eubanks [Tue, 18 Jul 2023 16:53:18 +0000 (09:53 -0700)]
[gn build] Manually port
2c651184
Craig Topper [Tue, 18 Jul 2023 16:34:25 +0000 (09:34 -0700)]
[RISCV] Add isMoveReg to vmv1r/vmv2r/vmv4r/vmv8r.v.
This allows TII isCopyInstrImpl to consider them copies.
Reviewed By: wangpc
Differential Revision: https://reviews.llvm.org/D155140
Craig Topper [Tue, 18 Jul 2023 16:34:15 +0000 (09:34 -0700)]
[RISCV] Test for D155140. NFC
The vmv1r.v v8, v9 in the last block can be removed by late
copy propagation.
Reviewed By: wangpc
Differential Revision: https://reviews.llvm.org/D155527
Alan Zhao [Mon, 17 Jul 2023 22:27:32 +0000 (15:27 -0700)]
[clang] Fix a crash when casting to an array type
In C++20, if Clang fails to perform constructor overload on a
RecordType, then Clang will try to perform parentesized aggregate
initialization. If that fails and the initialization was attempted as
part of a cast, then we should get the diagnostics from the failed
constructor overload attempt. However, we don't attempt constructor
overloading for arrays, so previously, if we try to diagnose an
overloaded cast for a parenthesized aggregate initialization of an
array, we crash. To fix this, we now exit tryDiagnoseOverloadedCast(...)
for failed parentesized list initialization if the destination type is
an array.
Fixes #63758
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D155523
Zhuojia Shen [Fri, 23 Jun 2023 19:49:05 +0000 (12:49 -0700)]
[AArch64] Merge LDRSWpre-LD[U]RSW pair into LDPSWpre
This patch optimizes a pair of LDRSWpre and LDRSWui (or LDURSWi)
instructions into a single LDPSWpre instruction. This is a missing case
in D99272.
MIR test cases in D152564 are updated to verify the optimization.
Differential Revision: https://reviews.llvm.org/D152407
Zhuojia Shen [Fri, 23 Jun 2023 19:44:42 +0000 (12:44 -0700)]
[AArch64] Add tests for merging LDRSWpre-LDR pairs
This patch adds MIR test cases that test merging an LDRSWpre-LDR
instruction pair into an LDPSWpre instruction. This optimization is
currently missing and will be added a subsequent patch (D152407), so all
test cases are no merge for now.
Differential Revision: https://reviews.llvm.org/D152564
Alexander Batashev [Tue, 18 Jul 2023 16:43:36 +0000 (19:43 +0300)]
[NFC] Fix builds on recent GCC with C++20 enabled
The following pattern fails on recent GCC versions with -std=c++20 flag passed
and succeeds with -std=c++17. Such behavior is not observed on Clang 16.0.
```c++
template <typename T>
struct Foo {
Foo<T>(int a) {}
};
```
This patch removes template parameter from constructor in two occurences to
make the following command complete successfully:
bazel build -c fastbuild --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 @llvm-project//llvm/...
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D154782
Joseph Huber [Tue, 18 Jul 2023 16:41:24 +0000 (11:41 -0500)]
[Clangd] Fix ambiguous use of 'Range'
Summary:
The changes in D155173 caused build failures on some configruations due
to the use of `Range` which conflicts with other definitions. Explicitly
use `clangd::Range`.
Joseph Huber [Tue, 18 Jul 2023 15:22:01 +0000 (10:22 -0500)]
[libc] Treat the locks array as a bitfield
Currently we keep an internal buffer of device memory that is used to
indicate ownership of a port. Since we only use this as a single bit we
can simply turn this into a bitfield. I did this manually rather than
having a separate type as we need very special handling of the masks
used to interact with the locks.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D155511
Simon Pilgrim [Tue, 18 Jul 2023 15:49:54 +0000 (16:49 +0100)]
[DAG] More aggressively (extract_vector_elt (build_vector x, y), c) iff element is zero constant
We currently don't extract vector elements from multi-use build vectors unless TLI.aggressivelyPreferBuildVectorSources accepts them, which seems a little extreme for constant build vectors (especially as under some cases ComputeKnownBits will indirectly extract the data for us).
This is causing a few regressions in some upcoming SimplifyDemandedBits work I'm looking at, all of which just need to know that the element is zero, so I've tweaked the fold to accept zero elements as well, which will typically fold very easily.
Differential Revision: https://reviews.llvm.org/D155582
Simon Pilgrim [Tue, 18 Jul 2023 11:41:09 +0000 (12:41 +0100)]
[Sparc] Regenerate float-constants.ll test checks
Rahul Kayaith [Wed, 5 Jul 2023 02:21:26 +0000 (22:21 -0400)]
[mlir][python] Remove PythonAttr mapping functionality
This functionality has been replaced by TypeCasters (see D151840)
depends on D154468
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D154469
Dinar Temirbulatov [Tue, 18 Jul 2023 15:57:16 +0000 (15:57 +0000)]
[AArch64] Regenerate a couple of vector-shuffle tests. NFC
As a request in https://reviews.llvm.org/D152205
Joseph Huber [Tue, 18 Jul 2023 16:00:14 +0000 (11:00 -0500)]
Revert "[libc] Default the GPU build to the default memory utilities"
This reverts commit
eca8b54a5f76c65a055bac05556b70c2a0ec63a1.
Another user reverted the patch this was based on leaving this one in a
broken state.
Slava Zakharin [Tue, 18 Jul 2023 15:19:44 +0000 (08:19 -0700)]
[flang][hlfir] Support polymorphic hlfir.expr values.
This patch sets 'polymorphic' attribute of hlfir::ExprType when
the value is created from a polymorphic entity.
Memoization of such ExprType involves creating a mutable descriptor
on the stack, which is initialized (as a null box) and passed to
AllocatableApplyMold with the mold being the entity from which
the ExprType value is being created.
This patch fixes "creating polymorphic temporary" TODO and also
several cases of "'fir.convert' op invalid type conversion" error.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D155541
Joseph Huber [Tue, 18 Jul 2023 15:48:31 +0000 (10:48 -0500)]
[libc] Default the GPU build to the default memory utilities
A previous patch made this cause an error on the GPU. We have not yet
dedicated time towards an optimial implementaiton there but we do not
want it to cause an error. We simply use the fallback routines.
Differential Revision: https://reviews.llvm.org/D155615
Jens Carl [Tue, 18 Jul 2023 15:48:22 +0000 (15:48 +0000)]
[clang-tidy][NFC] Update path of main translation unit
The forcing of the linker for a new module was moved from file
clang-tidy/tools/ClangTidyModule.cpp to
clang-tidy/ClangTidyForceLinker.h.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D76477
Jon Chesterfield [Tue, 18 Jul 2023 15:41:47 +0000 (16:41 +0100)]
Revert "[libc][memfunctions] Explicit error when platform in not supported"
Broke amdgpu libc bot
This reverts commit
a39c951730aa92894e27da038e834229d4613db1.
Mark de Wever [Mon, 17 Jul 2023 18:25:01 +0000 (20:25 +0200)]
[libc++][chrono] Fixes month inc and dec operations.
The operator++, operator++(int), operator--, and operator--(int) need to
change the month to a valid value. The wording is specified in terms of
operator+(const month& x, const months& y) noexcept;
which has the correct behavior. The aforementioned operators instead
used ++/-- on the internal value direction, resulting in incorrect
behaviour.
As a drive-by improve the unit tests:
- use the typical constexpr test method
- test whether the month is valid after the operations
- format the tests
Fixes: https://llvm.org/PR63912
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D155504
Haojian Wu [Sat, 8 Jul 2023 20:55:00 +0000 (22:55 +0200)]
[clangd] Refine the workflow for diagnostic Fixits.
- No longer store the diagnostic fixits in the clangdLSPServer
- When propagating the fixit via the code action, we use the Diag
information stored in the ParsedAST (in clangdServer.cpp)
Differential Revision: https://reviews.llvm.org/D155173
Martin Storsjö [Tue, 18 Jul 2023 15:21:23 +0000 (18:21 +0300)]
Revert "[AArch64] Fix an immediate out of range for large realignments on Windows"
This reverts commit
b1d0bc0f4395c69097bc11b6ba8f821f621272a9.
Builds with expensive checks show that 'sp' isn't a valid register
in ADDXrr - an object file built without exprnsive checks enabled
disassembles as "add x15, xzr, x16", instead of the intended
"add x15, sp, x16".
Razvan Lupusoru [Fri, 14 Jul 2023 17:40:57 +0000 (10:40 -0700)]
[openacc] Add dialect definition for acc declare
A declare directive is used to specify the creation of a visible device
copy of a variable for the duration of the implicit data region as it
relates to the scope in which the variable is declared.
In order to support this, the following new operations were added:
1) `acc.global_ctor` and `acc.global_dtor`. These are used whenever the
declare directive applies to a global.
2) `acc.declare_enter` and `acc.declare_exit`. These operations are
modeled similarly to `acc.enter_data` and `acc.exit_data`. The reason
they are not modeled like `acc.data` is so that these operations can be
used both for globals and regions like functions.
3) `acc.declare_device_resident` and `acc.declare_link`. These
operations are modeled in a manner consistent with previously defined
data entry operation model.
The `acc.getdeviceptr` was generalized so that it can be used with
acc.declare_exit.
Reviewed By: clementval, vzakhari
Differential Revision: https://reviews.llvm.org/D155322
Markus Böck [Tue, 18 Jul 2023 13:23:27 +0000 (15:23 +0200)]
[mlir][LLVM] Append call ops alias scopes to inlined operations
Currently when inlining, any alias scope information previously attached to the call op is lost. This leads to a loss of information that could be used by alias analysis to determine that two memory access operations do not alias.
This patch fixes this issue by also taking any alias scopes of the call operation into account. These can then simply be appended onto any inlined operations.
This is analogous to the following code in LLVM: https://github.com/llvm/llvm-project/blob/
1768c4597e70477af2d69f576f33400181a5f945/llvm/lib/Transforms/Utils/InlineFunction.cpp#L940
Differential Revision: https://reviews.llvm.org/D155595
Ingo Müller [Tue, 18 Jul 2023 08:15:53 +0000 (08:15 +0000)]
[mlir][transform][bufferization][python] Add .td file for bindings.
Reviewed By: springerm, ftynse
Differential Revision: https://reviews.llvm.org/D155564
Adrian Kuegel [Tue, 18 Jul 2023 14:10:48 +0000 (16:10 +0200)]
[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Tue, 18 Jul 2023 14:02:15 +0000 (16:02 +0200)]
[mlir][Bazel] Add VectorToArmSME target.
Guillaume Chatelet [Tue, 18 Jul 2023 13:30:01 +0000 (13:30 +0000)]
[libc][memfunctions] Explicit error when platform in not supported
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D155597
Adrian Kuegel [Tue, 18 Jul 2023 13:51:49 +0000 (15:51 +0200)]
[mlir][Bazel] Add missing dependency.
iambrj [Tue, 18 Jul 2023 13:36:30 +0000 (19:06 +0530)]
[MLIR][Presburger] Implement domain and range restriction for PresburgerRelation
This patch implements domain and range restriction for PresburgerRelation
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D154798
Martin Braenne [Tue, 18 Jul 2023 11:28:09 +0000 (11:28 +0000)]
[clang][dataflow] Strengthen flow condition assertions.
Instead of asserting merely that the flow condition doesn't imply that a variable is true, make the stronger assertion that the flow condition implies that the variable is false.
Reviewed By: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D155067
Paweł Bylica [Tue, 18 Jul 2023 13:40:28 +0000 (15:40 +0200)]
[clang][NFC] Fix typos in sema builtins test
Christoph Stiller [Tue, 18 Jul 2023 12:36:37 +0000 (13:36 +0100)]
[MCA] Document behaviour of ResourceRef
Differential Revision: https://reviews.llvm.org/D155347
Alexey Bataev [Fri, 5 May 2023 14:49:15 +0000 (07:49 -0700)]
[SLP]Include cost of the reshuffling for same nodes with resizing.
Need to account reshuffling, required for the reused elements in the
buildvector nodes, which are copies (perfect match) of other nodes, but
include reused elements.
Differential Revision: https://reviews.llvm.org/D149966
John Brawn [Fri, 14 Jul 2023 12:49:33 +0000 (13:49 +0100)]
[ARM] Replace TransferImpOps with copyImplicitOps
In most places where TransferImpOps is currently used we just have one
machine instruction, so it's doing the same thing as copyImplicitOps
anyway. In those cases where we have more than one machine
instruction the destination is written to in each instruction so any
implicit defs should appear on all of them (and we shouldn't see any
implicit refs as these pseudo-instruction don't have any register
inputs), meaning the current use of TransferImpOps is incorrect and
we should be using copyImplicitOps on all of the generated
instructions.
Differential Revision: https://reviews.llvm.org/D155301
wanglei [Tue, 18 Jul 2023 12:41:56 +0000 (20:41 +0800)]
[LoongArch][NFC] Revise instruction format to match lsx and lasx styles
Replace lengthy `0b...` binary form with a unified 32-bit hexadecimal
representation for opcode. This reduces complexity when dealing with
opcode discontinuities.
Martin Storsjö [Mon, 17 Jul 2023 12:19:14 +0000 (15:19 +0300)]
[AArch64] Fix an immediate out of range for large realignments on Windows
Also add a missing FrameSetup flag on the existing add instruction.
This fixes https://github.com/llvm/llvm-project/issues/63701.
Differential Revision: https://reviews.llvm.org/D155447
Luke Lau [Mon, 17 Jul 2023 10:23:16 +0000 (11:23 +0100)]
[RISCV] Add VP patterns for vandn.[vv,vx]
This builds upon D155433
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155434
Luke Lau [Mon, 17 Jul 2023 10:12:43 +0000 (11:12 +0100)]
[RISCV] Add SDNode patterns for vandn.[vv,vx]
Unfortunately we can't use the standard splat_vector and vnot PatFrags because
they are preprocessed to vmv.v.x's, so we need to define helpers to catch
those. We can't use SplatPat either because we need to nest another fragment
inside of it.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155433
Matthias Springer [Tue, 18 Jul 2023 12:13:31 +0000 (14:13 +0200)]
[mlir][NVGPU][transform] Add `create_async_groups` transform op
This transform looks for suitable vector transfers from global memory to shared memory and converts them to async device copies.
Differential Revision: https://reviews.llvm.org/D155569
Guillaume Chatelet [Mon, 17 Jul 2023 21:35:03 +0000 (21:35 +0000)]
[libc][NFC] Split memmove implementations per platform
This is a follow up on D154800 and D154770 to make the code structure more principled and avoid too many nested #ifdef/#endif.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D155515
Jie Fu [Tue, 18 Jul 2023 12:17:18 +0000 (20:17 +0800)]
[Flang] Remove unused variable 'converter' in genCustomIntrinsicRefCore
/data/workspace/llvm-project/flang/lib/Lower/ConvertCall.cpp:1281:9: error: unused variable 'converter' [-Werror,-Wunused-variable]
auto &converter = callContext.converter;
^
1 error generated.
Nikita Popov [Tue, 18 Jul 2023 10:37:35 +0000 (12:37 +0200)]
[Constants] Use getGEPReturnType() (NFC)
This reimplements essentially the same logic.
dingfei [Tue, 18 Jul 2023 11:55:34 +0000 (19:55 +0800)]
[NFC][clang-extdef-mapping] fix test failure on unsupported targets
ms-stlye asm block is not supported on targets like arm/hexagon.
Specify a working target as POC.
Introduced by https://reviews.llvm.org/D154983
Differential Revision: https://reviews.llvm.org/D155576
Alex Zinenko [Mon, 17 Jul 2023 12:57:55 +0000 (12:57 +0000)]
[mlir] NFC: untangle SCF Patterns.h and Transforms.h
These two headers both contained a strange mix of definitions related to
both patterns and non-pattern transforms. Put patterns and "populate"
functions into Patterns.h and standalone transforms into Transforms.h.
Depends On: D155223
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D155454
Markus Böck [Mon, 17 Jul 2023 16:01:17 +0000 (18:01 +0200)]
[mlir][LLVM] Perform deep clone of alias scopes during inlining
This is the first and most basic and important step for inlining memory operations with alias scopes.
For correctness, it is required that any alias scopes of inlined operations are replaced with deep copies. This is necessary as otherwise the same function could be inlined twice in one function, and suddenly the alias scopes extended.
A simple example would be `foo(a, b); foo(a2, b2)`. `a` and `a2` may alias. If `foo` is inlined in both instances, the store and load operations from `foo` may suddenly claim that `a` and `a2` do not alias if we were to keep the original alias scopes.
This is analogous to the following class/code in LLVM: https://github.com/llvm/llvm-project/blob/
4eef2e30d6f89328a16d4f1d6b37f1c79afe850c/llvm/lib/Transforms/Utils/InlineFunction.cpp#L985
Differential Revision: https://reviews.llvm.org/D155479
Haojian Wu [Thu, 13 Jul 2023 12:03:24 +0000 (14:03 +0200)]
[include-cleaner] Avoid a caching issue when running --edit mode on multiple files.
Snapshot all analysing files before running the tool, this makes sure
that we analyse all files statelessly and avoid the FileManager caching issue
when running `-edit` on multiple files.
Differential Revision: https://reviews.llvm.org/D155195
Kiran Chandramohan [Tue, 18 Jul 2023 10:33:57 +0000 (10:33 +0000)]
[Flang] Include logical default with default-integer-8
Other compilers include the logical default also with the
default-integer-8 setting. This patch does the same for
flang.
Reviewed By: awarzynski, sscalpone
Differential Revision: https://reviews.llvm.org/D155279
Tom Eccles [Mon, 17 Jul 2023 15:52:54 +0000 (15:52 +0000)]
[flang][hlfir][NFC] catch dynamically optional args with no lowering
These should be lowered with genOptionalValue as in D154897, but I
haven't found any cases where this code path is actually hit (flang
tests, gfortran test suite), so I don't think it would be testable.
Adding an assertion for if this code path ever becomes live.
Differential Revision: https://reviews.llvm.org/D155477
Tom Eccles [Thu, 13 Jul 2023 15:36:22 +0000 (15:36 +0000)]
[flang][hlfir] support dynamically optional array arguments to intrinsics with custom handling
The previous code path created the elemental kernel by generating a
scalar intrinsic call using pre-prepared arguments using genIntrinsicRefCore,
which then generated the intrinsic call using genIntrinsicCall().
The problem with this approach was that the dynamically optional
arguments were marked as having no argLowering, which meant that they
were unconditionally passed by value without any check to see if they
were present.
It would be nice to put an if operation in the path for !argLowering,
doing something similar to genOptionalValue(). However, this can't be
done because it isn't clear what value should be used for the default.
If zero was used (like in genOptionalValue) this could effect the result
of MIN or MAX.
Instead, this patch re-uses the implementation for scalar dynamically
optional arguments (in non-elemental calls). This does the correct
thing, entirely ignoring absent optional arguments.
Depends On: D155292
Differential Revision: https://reviews.llvm.org/D155293
Tom Eccles [Tue, 11 Jul 2023 14:40:29 +0000 (14:40 +0000)]
[flang][hlfir] add support for elemental intrinsics with custom handling
Only minimal argument processing is needed here because they will be
lowered properly either by the elemental intrinsic call builder or the
lowering of the scalar call inside the elemental kernel.
Dynamically optional arrays are coming in the next patch.
Depends On: D155291
Differential Revision: https://reviews.llvm.org/D155292
Tom Eccles [Mon, 10 Jul 2023 16:48:01 +0000 (16:48 +0000)]
[flang][hlfir] custom intrinsic handling for scalar arguments
This should produce the same results as the FIR lowering
Differential Revision: https://reviews.llvm.org/D155291
Paulo Matos [Mon, 17 Jul 2023 06:41:43 +0000 (08:41 +0200)]
[InstCombine] Allow KnownBits to be propagated
Bug #63699 shows a hang on arm in instcombine because we do not
propagate known bits for fshl/fshr rotates. We perform the propagation
and add regression test.
Differential Revision: https://reviews.llvm.org/D155307
Matt Arsenault [Sun, 16 Jul 2023 18:51:17 +0000 (14:51 -0400)]
AMDGPU: Preserve flags in fdiv_fast lowering
We were dropping the flags and thus blocking contract into potential
fadd users. GlobalISel was already preserving the flags here.
https://reviews.llvm.org/D155443
Matt Arsenault [Sun, 16 Jul 2023 18:08:45 +0000 (14:08 -0400)]
AMDGPU: Generate and add fdiv tests
Prepare for new lowering strategies because we somehow didn't have
enough of them already.
Matt Arsenault [Sun, 16 Jul 2023 13:38:23 +0000 (09:38 -0400)]
ValueTracking: Fix computeKnownFPClass canonicalize handling
This mostly manifested as broken constant folding. This was
mishandling the dynamic denormal mode. It was also mishandling literal
signaling nans, such that they would also be treated as poison.
https://reviews.llvm.org/D155437
Matt Arsenault [Sun, 16 Jul 2023 13:48:59 +0000 (09:48 -0400)]
ValueTracking: Add more tests for canonicalize class handling
Matt Arsenault [Sat, 15 Jul 2023 14:03:07 +0000 (10:03 -0400)]
AMDGPU: Add some additional rcp/rsq tests
Nikita Popov [Tue, 18 Jul 2023 10:17:29 +0000 (12:17 +0200)]
[IR] Remove typed pointer handling from getGEPReturnType() (NFC)
Sander de Smalen [Tue, 18 Jul 2023 09:41:08 +0000 (09:41 +0000)]
[AArch64] Force streaming-compatible codegen when attributes are set.
Before this patch, the only way to generate streaming-compatible code
was to use the `-force-streaming-compatible-sve` flag, but the compiler
should also avoid the use of instructions invalid in streaming mode
when a function has the aarch64_pstate_sm_enabled/compatible attribute.
Reviewed By: paulwalker-arm, david-arm
Differential Revision: https://reviews.llvm.org/D155428
Matt Arsenault [Fri, 14 Jul 2023 22:54:55 +0000 (18:54 -0400)]
libomptarget: Try to fix dependency tracking for llvm tools
Mitch Phillips [Tue, 18 Jul 2023 10:19:48 +0000 (12:19 +0200)]
Revert "[sanitizer][asan][win] Intercept _strdup on Windows instead of strdup"
This reverts commit
31263211c6a4ef454216f2edbf9b2083a4c1474d.
Reason: Broke the ASan Windows bot: https://reviews.llvm.org/rG31263211c6a4ef454216f2edbf9b2083a4c1474d
Matt Arsenault [Fri, 14 Jul 2023 15:05:24 +0000 (11:05 -0400)]
MachineSink: Fix sinking VGPR def out of a divergent loop
This fixes sinking a VGPR def out of a loop past the reconvergence
point at the SI_END_CF. There was a prior fix which introduced
blockPrologueInterferes (D121277) to fix the same basic problem for
the post RA sink. This also had the special case isIgnorableUse case
which was incorrect, because in some contexts the exec use is not
ignorable.
I'm thinking about a new way to represent this which will avoid
needing hasIgnorableUse and isBasicBlockPrologue, which would function
more like the exception handling.
Fixes: SWDEV-407790
https://reviews.llvm.org/D155343
Matt Arsenault [Fri, 14 Jul 2023 13:59:20 +0000 (09:59 -0400)]
AMDGPU: Add baseline test for broken machine sinking
Nikita Popov [Tue, 18 Jul 2023 10:04:36 +0000 (12:04 +0200)]
[llvm] Remove uses of getWithSamePointeeType() (NFC)
Florian Hahn [Tue, 18 Jul 2023 09:52:08 +0000 (10:52 +0100)]
[LV] Move all VPlan transforms after initial VPlan construction.
Reorder VPlan transforms slightly so they are all grouped together,
after disabling Value -> VPValue lookup. In terms of codegen impact,
this should be NFC modulo a small number of instruction reorderings.
Preparation to split up tryToBuildVPlanWithVPRecipes in a follow-up.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D154640
Nikita Popov [Tue, 18 Jul 2023 09:52:27 +0000 (11:52 +0200)]
[polly] Remove use of getWithSamePointeeType() (NFC)
Nikita Popov [Tue, 18 Jul 2023 09:42:29 +0000 (11:42 +0200)]
[Coroutines] Remove unused variable (NFC)
khei4 [Tue, 18 Jul 2023 09:31:46 +0000 (18:31 +0900)]
Revert "Revert "Revert "[MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas"""
This reverts commit
b02d349cbfaa81c9bbc928c4de46b12d976c1882.
Nikita Popov [Tue, 18 Jul 2023 09:39:02 +0000 (11:39 +0200)]
[llvm] Remove uses of isOpaqueOrPointeeTypeEquals() (NFC)
Andrzej Warzynski [Fri, 14 Jul 2023 11:55:13 +0000 (11:55 +0000)]
[mlir][ArmSME] Introduce custom TypeConverter for ArmSME
At the moment, SME-to-LLVM lowerings rely entirely on
`LLVMTypeConverter`. This patch introduces a dedicated `TypeConverter`
that inherits from `LLVMTypeConverter` (it will also be used when
lowering ArmSME Ops to LLVM).
The new type converter merely disables lowerings for `VectorType` to
prevent 2-d scalable vectors (common in the context of ArmSME), e.g.
`vector<[16]x[16]xi8>`,
entering the LLVM Type converter. LLVM does not support arrays of
scalable vectors and hence the need for specialisation. In the case of
SME such types are effectively eliminated when emitting LLVM IR
intrinsics for SME.
Differential Revision: https://reviews.llvm.org/D155365
Nikita Popov [Tue, 18 Jul 2023 09:35:03 +0000 (11:35 +0200)]
[ConstantFolding] Remove some typed pointer handling (NFC)
No need to insert a bitcast.
Nikita Popov [Tue, 18 Jul 2023 09:31:09 +0000 (11:31 +0200)]
[OpenMPIRBuilderTest] Remove unused variable (NFC)
Nikita Popov [Tue, 18 Jul 2023 09:28:13 +0000 (11:28 +0200)]
[OpenMPIRBuilder] Check GV type instead of pointee type (NFC)
Change the assertion to check the value type instead of the pointee
type. To facilitate this, store GlobalVariable* instead of Constant*
in the map.
Kiran Chandramohan [Tue, 18 Jul 2023 09:10:45 +0000 (09:10 +0000)]
[Flang][HLFIR] Intrinsics: Propagate fast math flags
Add a new FirOpBuilder constructor to propagate the fast math flag
from an operation. Use this constructor in the LowerHLFIRIntrinsics
pass.
This fixes the performance issue with the hlfir intrinsics flow
for polyhedron/test_fpu2.
Reviewed By: tblah, vzakhari
Differential Revision: https://reviews.llvm.org/D155438
Kiran Chandramohan [Tue, 18 Jul 2023 09:09:58 +0000 (09:09 +0000)]
[Flang][HLFIR] Relax size check for dot_product intrinsic
If the size of one of the operand arrays is not known at compile
time, do not issue a size mismatch error sinc they could match at
runtime.
Fixes the compilation error in polyhedron/induct2.
Reviewed By: tblah, vzakhari
Differential Revision: https://reviews.llvm.org/D155302
Nikita Popov [Tue, 18 Jul 2023 09:23:41 +0000 (11:23 +0200)]
[Bitcode] Remove uses of isOpaqueOrPointeeTypeEquals() (NFC)
ManuelJBrito [Mon, 17 Jul 2023 15:51:40 +0000 (16:51 +0100)]
[NewGVN] Abort PHIOfOps if singleton PHI is found
Currently we just bypass singleton phis, however we know that
in order to create the phi of ops all phis must be in the same block.
Therefore if one phi is a singleton then the rest are as well.
Differential Revision: https://reviews.llvm.org/D155478
Nikita Popov [Tue, 18 Jul 2023 09:20:18 +0000 (11:20 +0200)]
[LowerMatrixIntrinsics] Fix test expectations (NFC)
Some of the test expectation were incorrectly changed in
23c21759458014fc4d7cbea45b6fbe7349a0a4fd. Regenerate the tests.
Nikita Popov [Tue, 18 Jul 2023 09:13:26 +0000 (11:13 +0200)]
[llvm] Remove some uses of isOpaqueOrPointeeTypeEquals() (NFC)
dingfei [Tue, 18 Jul 2023 09:09:58 +0000 (17:09 +0800)]
[clang-extdef-mapping] register necessary targest for ms-style asm block
Without targets registered gives: "error: MS-style inline assembly is not
available: Unable to find target for this triple (no targets are registered)"
Differential Revision: https://reviews.llvm.org/D154983
dingfei [Tue, 18 Jul 2023 09:01:19 +0000 (17:01 +0800)]
[ASTImporter] Fields are imported first and reordered for correct layout
Fields are imported first and reordered for correct layout.
For partially imported record, layout computation is incorrect.
Differential Revision: https://reviews.llvm.org/D154764
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.