Philip Reames [Tue, 28 Mar 2023 15:19:48 +0000 (08:19 -0700)]
[RISCV] Consolidate and extend fixed vector shuffle cost tests [nfc]
Jay Foad [Tue, 28 Mar 2023 15:48:34 +0000 (16:48 +0100)]
[AMDGPU] Avoid duplicated work in SIRegisterInfo::getReservedRegs
Andrew Gozillon [Tue, 28 Mar 2023 15:24:35 +0000 (10:24 -0500)]
[OpenMP][Flang][MLIR] Implement OffloadModuleInterface for OpenMP Dialect and convert is_device to an Attribute
This commit adds the OffloadModuleInterface to the OpenMP dialect,
which will implement future module attribute get/set's for offloading.
Currently it implements set and get's for the omp.is_device attribute,
which is promoted to a real attribute in this commit as well (primarily
to allow switch cases to work nicely with it for future work and to keep
consistency with future module attributes).
This interface is attached to mlir::ModuleOp's on registration of the
OpenMPDialect and should be accessible anywhere the OpenMP
dialect is registered and initialized.
Reviewers: kiranchandramohan, awarzynski
Differential Revision: https://reviews.llvm.org/D146850
Kevin Sala [Tue, 28 Mar 2023 15:22:33 +0000 (17:22 +0200)]
[NFC][OpenMP][libomptarget] Remove unnecessary AsyncInfoWrapperTy parameter
Victor Perez [Tue, 28 Mar 2023 15:19:29 +0000 (16:19 +0100)]
[mlir][llvm] Verify consistency of llvm.resume and llvm.landingpad types
Following the steps of the LLVM verifier
(https://github.com/llvm/llvm-project/blob/
b2c48559c882fd558f91e471c4d23ea7b0c6e718/llvm/lib/IR/Verifier.cpp#L4195),
checks in llvm.func verifier are added to ensure consistency of
llvm.landingpad operations' result types and llvm.resume operations'
input types.
As in LLVM, we will allow llvm.resume operations with input values
defined by operations other than llvm.landingpad.
Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Reviewed By: gysit, Dinistro
Differential Revision: https://reviews.llvm.org/D146968
Joseph Huber [Tue, 28 Mar 2023 15:21:39 +0000 (10:21 -0500)]
[libc][NFC] Remove useless header guards from implementation file
Summary:
These were accidentally added and don't do anything.
Rahul Kayaith [Tue, 28 Mar 2023 15:05:00 +0000 (11:05 -0400)]
[mlir][python] Mark operator== overloads as const
This resolves some warnings when building with C++20, e.g.:
```
llvm-project/mlir/lib/Bindings/Python/IRAffine.cpp:545:60: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'mlir::python::PyAffineExpr' and 'mlir::python::PyAffineExpr') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
PyAffineExpr &other) { return self == other; })
~~~~ ^ ~~~~~
llvm-project/mlir/lib/Bindings/Python/IRAffine.cpp:350:20: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
bool PyAffineExpr::operator==(const PyAffineExpr &other) {
^
```
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D147018
Wael Yehia [Mon, 27 Mar 2023 18:04:05 +0000 (18:04 +0000)]
[AIX] Update release notes regarding -mxcoff-build-id and the profile runtime
Philip Reames [Tue, 28 Mar 2023 14:48:09 +0000 (07:48 -0700)]
[RISCV][TTI] Extract getConstantPoolLoadCost helper routine [nfc]
We had 3 copies of this code, and I am about to add a fourth.
Philip Reames [Tue, 28 Mar 2023 14:23:41 +0000 (07:23 -0700)]
[RISCV] Cost model for general case of single vector permute
The cost model was not accounting for the fact that we can generate vrgather + an index expression.
Two cases to call out.
1) I did not model the difference between vrgather and vrgatherei16. The result is the constant pool cost can be slightly understated on RV32. I don't think we care, but if someone disagrees, this would be easy to add.
2) Our current codegen for i8 vectors longer than 256 (which is the limit of what this costs) has some room for improvement.
Differential Revision: https://reviews.llvm.org/D147000
Simon Pilgrim [Tue, 28 Mar 2023 14:19:12 +0000 (15:19 +0100)]
[X86] MatchVectorAllZeroTest - return X86::CondCode instead of constant node. NFC.
Just return the X86::CondCode enum value instead of creating the target constant node in multiple locations, letting us use the getSETCC helper.
Viktoriia Bakalova [Tue, 28 Mar 2023 14:16:50 +0000 (14:16 +0000)]
[clangd] Fix build by replacing unsigned long with std::vector::size_type.
Viktoriia Bakalova [Thu, 16 Mar 2023 17:06:08 +0000 (17:06 +0000)]
[clangd] Show used symbols on #include line hover.
Differential Revision: https://reviews.llvm.org/D146244
Simon Pilgrim [Tue, 28 Mar 2023 13:52:11 +0000 (14:52 +0100)]
[X86] emitFlagsForSetcc - pull out repeated isEquality condcode checks. NFC.
Most of the combines are for ISD::SETEQ/ISD::SETNE comparisons so do a single early-check for the condcode.
Louis Dionne [Mon, 27 Mar 2023 17:03:28 +0000 (13:03 -0400)]
[libc++][NFC] Rename helper function for testing spaceship
The helper is mis-named, since it won't work as-is on ordered containers
like set and map, because they rely on being able to store keys that are
partial_ordering::unordered, and that's UB for an ordered container.
This was most likely a typo or an unintended naming mistake, since
the function is only used with sequence containers anyway.
Differential Revision: https://reviews.llvm.org/D146991
Louis Dionne [Fri, 24 Mar 2023 18:41:26 +0000 (14:41 -0400)]
[libc++] Don't try to provide source_location on AppleClang 1403
AppleClang 1403 has some bugs that prevent std::source_location from
working properly on it. Consequently, we XFAILed the unit test for
source_location with that compiler. However, we should also avoid
advertising that the feature is supported on that compiler, otherwise
our feature-test macros lie. This was noticed to break Boost.Asio
when building with a recent libc++ and AppleClang 14.0.3.
rdar://
106863087
Differential Revision: https://reviews.llvm.org/D146837
Quentin Colombet [Tue, 28 Mar 2023 13:18:09 +0000 (15:18 +0200)]
[mlir][MemRef] Move transform related functions in Transforms.h
NFC
Louis Dionne [Sat, 18 Mar 2023 17:31:03 +0000 (13:31 -0400)]
[libc++] Also support target triples that end with .0 in backdeployment tests
Sometimes, a target can look like `<arch>-apple-macosx10.15.0` instead
of `<arch>-apple-macosx10.15`. This ensures that the test suite handles
those target triples properly as well.
Differential Revision: https://reviews.llvm.org/D146365
pvanhout [Thu, 16 Mar 2023 13:35:27 +0000 (14:35 +0100)]
[AMDGPU] Handle memset users in PromoteAlloca
Allows allocas with memset users to be promoted.
This is intended to prevent patterns such as `memset(&alloca, 0, sizeof(alloca))` (which I think can be emitted by frontends) from preventing a vectorization of allocas.
Fixes SWDEV-388784
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D146225
Aaron Ballman [Tue, 28 Mar 2023 12:52:37 +0000 (08:52 -0400)]
Downgrade reserved module identifier error into a warning
Any project that wants to import std; potentially needs to be able to
build a module that does export std;. We silenced the error diagnostic
if the module identified itself as a system header, but this isn't
quite good enough, what we really need is a way to identify a system
module. It would be nice for that feature to be shared among the major
implementations, so this downgrades the diagnostic from an error to a
warning temporarily to give implementers time to determine what that
mechanism will look like. We may convert this warning back into an
error in a future release of Clang, but it's not guaranteed we will do
so.
Fixes https://github.com/llvm/llvm-project/issues/61446
Differential Revision: https://reviews.llvm.org/D146986
Chih-Ping Chen [Tue, 28 Mar 2023 12:47:13 +0000 (08:47 -0400)]
[Sanitizers] Fix a memory leak.
Differential Revision: https://reviews.llvm.org/D146756
Ingo Müller [Tue, 28 Mar 2023 12:22:43 +0000 (12:22 +0000)]
[mlir] Add missing STL include to 1:N conversion utils.
Quentin Colombet [Thu, 23 Mar 2023 14:41:14 +0000 (15:41 +0100)]
[mlir][MemRef] Add patterns to extract address computations
This patch adds patterns to rewrite memory accesses such that the resulting
accesses are only using a base pointer.
E.g.,
```mlir
memref.load %base[%off0, ...]
```
Will be rewritten in:
```mlir
%new_base = memref.subview %base[%off0,...][1,...][1,...]
memref.load %new_base[%c0,...]
```
The idea behind these patterns is to offer a way to more gradually lower
address computations.
These patterns are the exact opposite of FoldMemRefAliasOps.
I've implemented the support of only five operations in this patch:
- memref.load
- memref.store
- nvgpu.ldmatrix
- vector.transfer_read
- vector.transfer_write
Going forward we may want to provide an interface for these rewritings (and
the ones in FoldMemRefAliasOps.)
One step at a time!
Differential Revision: https://reviews.llvm.org/D146724
Peter Klausler [Mon, 20 Mar 2023 19:16:13 +0000 (12:16 -0700)]
[flang] Fix CONTIGUOUS attribute checking
A CONTIGUOUS entity must be an array pointer, assumed-shape dummy array,
or assumed-rank dummy argument (C752, C830). As currently implemented,
f18 only implements the array requirement if the entity is a pointer.
Combine these checks and start issuing citations to scalars.
Differential Revision: https://reviews.llvm.org/D146588
Mariya Podchishchaeva [Tue, 28 Mar 2023 11:28:47 +0000 (07:28 -0400)]
[clang] Fix consteval initializers of temporaries
When a potential immediate invocation is met, it is immediately wrapped by a
`ConstantExpr`. There is also a TreeTransform that removes this `ConstantExpr`
wrapper when corresponding expression evaluation context is popped.
So, in case initializer was an immediate invocation, `CXXTemporaryObjectExpr`
was wrapped by a `ConstantExpr`, and that caused additional unnecessary
`CXXFunctionalCastExpr` to be added, which later confused the TreeTransform
that rebuilds immediate invocations, so it was adding unnecessary
constructor call.
Fixes https://github.com/llvm/llvm-project/issues/60286
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D146801
Peter Klausler [Mon, 20 Mar 2023 18:44:56 +0000 (11:44 -0700)]
[flang] Disallow scalar argument to SIZE/LBOUND/UBOUND
The compiler accepts arguments of any rank, or assumed rank, to a host
of intrinsic inquiry functions. For scalars, this is correct for most
of them, but the standard (and other compilers) prohibit scalar arguments
to SIZE, LBOUND, and UBOUND (without DIM=).
There are meaningful interpretations for these intrinsic inquiries
on scalars, but since there's no portability concern here, continuing
to support them would be an unjustifiable extension.
Differential Revision: https://reviews.llvm.org/D146587
Manas [Tue, 28 Mar 2023 11:33:09 +0000 (17:03 +0530)]
[mlir][doc] Fix typos
It fixes some typos in the language reference.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D147028
David Green [Tue, 28 Mar 2023 11:12:02 +0000 (12:12 +0100)]
[ComplexDeinterleaving] Propagate fast math flags to symmetric operations.
This is a simple patch to make sure fast math flags are propagated through to
the newly created symmetric operations, which can help with later
simplifications.
Differential Revision: https://reviews.llvm.org/D146409
David Green [Tue, 28 Mar 2023 10:10:46 +0000 (11:10 +0100)]
[AArch64] Combine fadd into fcmla
This adds a target combine for `fadd(a, vcmla(b, c, d))` -> `vcmla(fadd(a, b), b, c)`,
pushing the fadd into the operands of the fcmla, which can help simplify away some
additions.
Differential Revision: https://reviews.llvm.org/D146407
Martin Braenne [Tue, 28 Mar 2023 08:07:51 +0000 (08:07 +0000)]
[clang][dataflow][NFC] Put TransferVisitor in an unnamed namespace.
This avoids the risk of ODR violations.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D147032
Adrian Kuegel [Tue, 28 Mar 2023 09:55:37 +0000 (11:55 +0200)]
Chuanqi Xu [Tue, 28 Mar 2023 09:34:43 +0000 (17:34 +0800)]
[C++20] [Modules] Don't create duplicated deduction guides for duplicated classes
Close https://github.com/llvm/llvm-project/issues/56916
Within C++20 modules, we may have multiple same constructors in
multiple same RecordDecls. And it doesn't make sense naturally to create
duplicated deduction guides for the duplicated constructors.
Adrian Kuegel [Tue, 28 Mar 2023 09:50:07 +0000 (11:50 +0200)]
[llvm][Bazel] Add missing dependency.
Alex Zinenko [Mon, 27 Mar 2023 14:03:03 +0000 (14:03 +0000)]
[mlir] support external named transform libraries
Introduce support for external definitions of named sequences in the
transform dialect by letting the TransformInterpreterPassBase read a
"library" MLIR file. This file is expected to contain definitions for
named sequences that are only declared in the main transformation
script. This allows for sharing non-trivial transform combinations
without duplication.
This patch provides only the minimal plumbing for a single textual IR
file. Further changes are possible to support multiple libraries and
bytecode files.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D146961
Martin Storsjö [Tue, 28 Mar 2023 08:57:39 +0000 (11:57 +0300)]
[llvm-windres] Fix a test that failed on Windows. NFC.
Skip this test on Windows (by requiring a posix shell), since we
want to test specific corner cases of quotes passed to the executable,
and llvm-lit/cmd don't seem to handle it correctly at the moment.
Stefan Gränitz [Tue, 28 Mar 2023 08:31:46 +0000 (10:31 +0200)]
[Orc][AArch32] Polish Thumb symbol assertions in ObjectLinkingLayer
Ingo Müller [Tue, 21 Feb 2023 11:21:25 +0000 (11:21 +0000)]
[mlir] Add another test case for 1:N type conversion facilities. (NFC)
This patch adds another test case for the new 1:N type conversion utils
testing that the proper user materializations are applied depending on
which of the ops in are converted by the test pass.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D147027
Ingo Müller [Tue, 21 Feb 2023 11:21:25 +0000 (11:21 +0000)]
[mlir][scf] Implement structural conversion for 1:N type conversions.
This patch implements patterns for the newly introduced 1:N type
conversion utils for several ops of the SCF dialect. It also adds an
option to the existing test pass as well as test cases that applies the
patterns through the test pass.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D146959
Petr Hosek [Tue, 28 Mar 2023 08:28:17 +0000 (08:28 +0000)]
Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
This reverts commit
55e65ad876e3ac0b1cb0410a5cce3554c009af65.
zhanglimin [Mon, 27 Mar 2023 12:27:21 +0000 (20:27 +0800)]
[tsan] Derive the unmangled SP in longjmp with xor key on loongarch64
Introducing xor key to derive unmangled sp is here to follow the way
that the glibc adds support for pointer mangling on loongarch in commit
1c9bc1b6e50293a1b7037a7bfbf835868a55baed.
Reviewed By: SixWeining, wangleiat, xen0n
Differential Revision: https://reviews.llvm.org/D146716
Juan Manuel MARTINEZ CAAMAÑO [Tue, 28 Mar 2023 08:04:53 +0000 (10:04 +0200)]
[Clang][DebugInfo][AMDGPU] Emit zero size bitfields in the debug info to delimit bitfields in different allocation units.
Consider the following sturctures when targetting:
struct foo {
int space[4];
char a : 8;
char b : 8;
char x : 8;
char y : 8;
};
struct bar {
int space[4];
char a : 8;
char b : 8;
char : 0;
char x : 8;
char y : 8;
};
Even if both structs have the same layout in memory, they are handled
differenlty by the AMDGPU ABI.
With the following code:
// clang --target=amdgcn-amd-amdhsa -g -O1 example.c -S
char use_foo(struct foo f) { return f.y; }
char use_bar(struct bar b) { return b.y; }
For use_foo, the 'y' field is passed in v4
; v_ashrrev_i32_e32 v0, 24, v4
; s_setpc_b64 s[30:31]
For use_bar, the 'y' field is passed in v5
; v_bfe_i32 v0, v5, 8, 8
; s_setpc_b64 s[30:31]
To make this distinction, we record a single 0-size bitfield for every member that is preceded
by it.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D144870
Martin Braenne [Tue, 28 Mar 2023 07:56:24 +0000 (07:56 +0000)]
[clang][dataflow][NFC] Eliminate StmtToEnvMap interface.
Instead, we turn StmtToEnvMap into a concrete class with the implementation that used to live in StmtToEnvMapImpl.
The layering issue that originally required the indirection through the
`StmtToEnvMap` interface no longer exists.
Reviewed By: ymandel, xazax.hun, gribozavr2
Differential Revision: https://reviews.llvm.org/D146507
Martin Storsjö [Fri, 26 Aug 2022 11:03:36 +0000 (14:03 +0300)]
[lvm-windres] Try to match GNU windres regarding handling of unescaped quotes
Some background context: GNU windres invokes the preprocessor in
a subprocess. Some windres options are passed through to the
preproocessor, e.g. -D options for predefining defines.
When GNU windres passes these options onwards, it takes the options
in exact the form they are received (in argv or similar) and
assembles them into a single preprocessor command string which gets
interpreted by a shell (IIRC via the popen() function, or similar).
When LLVM invokes subprocesses, it does so via APIs that take
properly split argument vectors, to avoid needing to worry about
shell quoting/escaping/unescaping. But in the case of LLVM windres,
we have to emulate the effect of the shell parsing done by popen().
Most of the relevant cases are already taken care of here, but this
patch fixes an uncommon case encountered in
https://github.com/llvm/llvm-project/issues/57334.
(This case is uncommon since it doesn't do what one would want to;
the quotes need to be escaped more to work as intended through
the popen() shell).
Differential Revision: https://reviews.llvm.org/D146848
Martin Storsjö [Fri, 24 Mar 2023 10:06:24 +0000 (12:06 +0200)]
[llvm-rc] Remove transitional preprocessing fallback logic
When preprocessing was integrated to llvm-rc in 2021, this was a
new requirement (previously one could execute llvm-rc without a
suitable preprocessing tool to be available).
As a transitional helper, llvm-rc fell back on skipping preprocessing
if no suitable tool was found (with a warning printed), but users
could pass an llvm-rc specific option to silence the warning, if they
explicitly want to run the tool without preprocessing.
Now 2 years later, remove the transitional helper - error out if
preprocessing failed. The option for disabling preprocessing remains.
Differential Revision: https://reviews.llvm.org/D146797
Martin Storsjö [Thu, 23 Mar 2023 22:24:23 +0000 (00:24 +0200)]
[llvm-rc] Fix the reference to the option for disabling preprocessing in a message
This was the original option name from the first iteration of the patch
that added the feature, but during review, a different name was suggested
and preferred - but the reference in the helpful message was missed.
Differential Revision: https://reviews.llvm.org/D146796
Martin Storsjö [Thu, 23 Mar 2023 22:37:29 +0000 (00:37 +0200)]
[llvm-rc] Look for "clang-<major>" when locating a suitable preprocessor
In some cases, there's no adjacent executable named "clang" or
"clang-cl", but one name "clang-<major>". This logic doesn't
cover every possible deployment setup of course, but should
cover more fairly common/reasonable cases.
See
https://github.com/curl/curl-for-win/commit/
caaae171ac43af5b883403714dafd42030d8de61#commitcomment-
105808524
for discussion about a case where this would have been helpful.
Differential Revision: https://reviews.llvm.org/D146794
Martin Storsjö [Fri, 24 Mar 2023 10:17:25 +0000 (12:17 +0200)]
[llvm-rc] Respect the executable specified in the --preprocessor command
The arguments passed in this option were passed onto the child
process, but we still blindly used the clang binary that we had
found to sys::ExecuteAndWait as the intended executable to run.
If the user hasn't specified any custom --preprocessor command,
Args[0] is equal to the variable Clang.
This doesn't affect any tests, since the tests only print the
arguments it would try to execute (but not the first parameter to
sys::ExecuteAndWait), but there's no testes for executing it
(and validating that it did execute the right thing).
Differential Revision: https://reviews.llvm.org/D146793
Nicolas Vasilache [Tue, 28 Mar 2023 07:54:16 +0000 (00:54 -0700)]
[mlir][Linalg][Transform] Drop spurious assertion in packGreedilyOp
`transform.pack_greedily` supports skipping dimensions in which case we
may well end up with e.g. a matvec innermost.
We should not spuriously crash in such cases.
Adrian Kuegel [Tue, 28 Mar 2023 07:47:44 +0000 (09:47 +0200)]
[mlir] Apply ClangTidy readability fix (NFC)
Bjorn Pettersson [Mon, 27 Mar 2023 14:15:56 +0000 (16:15 +0200)]
[SimpleLoopUnswitch] Fix SCEV invalidation for unswitchTrivialSwitch
When doing a trivial unswitch of a switch statement the code need
to "invalidate SCEVs for the outermost loop reached by any of the
exits", as indicated by code comments.
Depending on if we find such an outermost loop or not we can limit
the invalidation to some sub-loops or the full loop-nest. As shown
in the added test case there seem to have been some bugs in the code
that was finding the "outermost loop", so we could end up invalidating
too few loops.
Seems like commit
1bf8ae17f5e2714c8c87978 introduced the bug by
moving the code that invalidates the loops above some of the code
that computed 'OuterL'. This patch fixes that by also moving that
computation of 'OuterL' so that we compute 'OuterL' properly before
we use it for the SCEV invalidation.
Differential Revision: https://reviews.llvm.org/D146963
pvanhout [Mon, 13 Feb 2023 10:08:46 +0000 (11:08 +0100)]
[AMDGPU] Break-up large PHIs for DAGISel
DAGISel uses CopyToReg/CopyFromReg to lower PHI nodes. With large PHIs, this can result in poor codegen.
This is because it introduces a need to have a build_vector before copying the PHI value, and that build_vector may have many undef elements. This can cause very high register pressure and abnormal stack usage in some cases.
This scalarization/phi "break-up" can be easily tuned/disabled through CL options in case it's not beneficial for some users.
It's also only enabled for DAGIsel and GlobalISel handles PHIs much better (as it works on the whole function).
This can both scalarize (break a vector into its elements) and simplify (break a vector into smaller, more manageable subvectors) PHIs.
Fixes SWDEV-321581
Reviewed By: kzhuravl
Differential Revision: https://reviews.llvm.org/D143731
Petr Hosek [Tue, 21 Feb 2023 01:02:42 +0000 (01:02 +0000)]
[runtimes][CMake] Drop the check to see if linker works
This isn't needed anymore.
Differential Revision: https://reviews.llvm.org/D144440
pvanhout [Fri, 17 Feb 2023 10:18:36 +0000 (11:18 +0100)]
[AMDGPU] Fold more AGPR copies/PHIs in SIFoldOperands
Generalize `tryFoldLCSSAPhi` into `tryFoldPhiAGPR` which works
on any kind of PHI node (not just LCSSA ones) and attempts to
create AGPR Phis more aggressively.
Also adds a GFX908-only "cleanup" function `tryOptimizeAGPRPhis`
which tries to minimize AGPR to AGPR copies on GFX908, which doesn't
have a ACCVGPR MOV instruction (so AGPR-AGPR copies become 2 or 3 instructions
as they need a VGPR temp). The reason why this is needed is because D143731
+ the new `tryFoldPhiAGPR` may create a lot more PHIs (one 32xfloat PHI becomes
32 float phis), and if each PHI hits the same AGPR (like in `test_mfma_loop_agpr_init`)
they will be lowered to 32 copies from the same AGPR, which will each become 2-3 instructions.
Creating a VGPR cache in this case prevents all those copies from being generated
(we have AGPR-VGPR copies instead which are trivial).
This is a prepation patch intended to prevent regressions in D143731 when
AGPRs are involved.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D144099
Max Kazantsev [Tue, 28 Mar 2023 07:29:09 +0000 (14:29 +0700)]
[Test] Add two tests showing unprofitable case of Guard Widening
Guard Widening is ignorant about blocks frequency. As result, it may
end up widening conditions from cold/effectively dead code into some
much hotter place, harming average performance.
Florian Hahn [Tue, 28 Mar 2023 07:06:53 +0000 (08:06 +0100)]
Revert "[SLP] Check with target before vectorizing GEP Indices."
This reverts commit
1387a13e1d0bac94457626ef3e7427c84caf6e65.
This introduced performance regressions on AArch64, when the cost of a
vector GEP + extracts is offset by the benefits of vectorizing the rest
of the tree.
The test in llvm/test/Transforms/SLPVectorizer/AArch64/vector-getelementptr.ll
illustrates the issue. It was extracted from code that regressed a SPEC
benchmark by 15%.
Chris Cotter [Tue, 28 Mar 2023 06:30:34 +0000 (06:30 +0000)]
[clang-tidy] Ignore unevaluated exprs in rvalue-reference-param-not-moved
Ignore unevaluated expressions in rvalue-reference-param-not-moved
check since they are not actual uses of a move().
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D146929
Jakub Chlanda [Thu, 23 Mar 2023 11:05:34 +0000 (11:05 +0000)]
[NVPTX] Enforce half type support is present for builtins
Differential Revision: https://reviews.llvm.org/D146715
Nicolas Vasilache [Mon, 27 Mar 2023 15:00:43 +0000 (08:00 -0700)]
[mlir][Linalg][Transform] Add support to let `transform.structured.pack_greedily` pad to the next multiple of a static constant
This increase the flexibility of the transformation to allow mixed packing / padding specifications.
Differential Revision: https://reviews.llvm.org/D146969
Tom Stellard [Tue, 28 Mar 2023 06:27:28 +0000 (23:27 -0700)]
workflows/release-tasks: Fix missing suffix on doxygen tarballs
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D145997
Tom Stellard [Tue, 28 Mar 2023 06:14:59 +0000 (23:14 -0700)]
workflows/release-tasks: Upload release notes as an artifact
This make sure the docs are always available and can be manually uploaded
if a later step fails.
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D145996
Petr Hosek [Thu, 9 Mar 2023 18:23:04 +0000 (18:23 +0000)]
[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
These will be replaced by CMake's check_linker_flag once we update
the minimum CMake version 3.20.
Differential Revision: https://reviews.llvm.org/D145716
Jonas Devlieghere [Tue, 28 Mar 2023 05:29:54 +0000 (22:29 -0700)]
[dsymutil] Initialize the debug map before loading the main binary
Fix a crash when a warning is emitted while loading the symbols from the
main binary. The warning helper assumes that the resulting debug map is
initialized, but this happened after loading the main binary. Since
there's no dependency between the two the initialization can be moved
up.
rdar://
107298776
Kazu Hirata [Tue, 28 Mar 2023 05:32:23 +0000 (22:32 -0700)]
[llvm] Use isIntOrFPConstant (NFC)
Johannes Doerfert [Tue, 28 Mar 2023 05:13:38 +0000 (22:13 -0700)]
[OpenMP] Resolve const cast issue introduced in D123446
Johannes Doerfert [Fri, 24 Mar 2023 21:53:02 +0000 (14:53 -0700)]
[OpenMP][FIX] More AAExecutionDomain fixes
We missed certain updates, mostly to call site information, and
dependent AAs did not get recomputed. We also did not properly
distinguish and propagate incoming and outgoing information of call
sites.
The runtime tests passes now, I'll add a proper test for
AAExecutionDomain soon that covers all the cases and ensures we haven't
forgotten more updates. To help unblock some apps, I'll put the fix
first.
Johannes Doerfert [Mon, 27 Mar 2023 06:23:22 +0000 (23:23 -0700)]
[OpenMP] Adjust generic state machine simplification CB
This callback caused us to potentially miss out on call edges if we were
expecting a custom state machine since the custom state machine was not
created but the workers also did not enter the generic one. I have not
observed an issue and don't know how to create a test for sure, but it
is saver to err on the conservative side for now.
Johannes Doerfert [Mon, 27 Mar 2023 05:02:15 +0000 (22:02 -0700)]
[Attributor][FIX] Account for blocks w/o predecessors
Johannes Doerfert [Sun, 26 Mar 2023 06:50:23 +0000 (23:50 -0700)]
[OpenMP] Be smarter about the insertion point for deduplication
We can use dominance and avoid the special handling of kernels and
prevent inserting code before allocas accidentally (as happend in the
runtime test).
Johannes Doerfert [Fri, 24 Mar 2023 18:51:39 +0000 (11:51 -0700)]
[OpenMP][NFC] Delete dead code
This code may have served a purpose at some point but it has been dead
for a long while. `FromMapperBase` was always `nullptr` which is `false`
which makes the rest of the code dead. Since this has not
affected tests, I delete it for now.
Johannes Doerfert [Fri, 24 Mar 2023 18:43:38 +0000 (11:43 -0700)]
[OpenMP] Allow more tests to run on AMDGPU
This basically works around the printf issue to increase test coverage.
Differential Revision: https://reviews.llvm.org/D146838
Lang Hames [Tue, 28 Mar 2023 02:38:21 +0000 (19:38 -0700)]
[mlir] Fix unit tests after LLVM commit
8b1771bd9f3.
Lang Hames [Tue, 28 Mar 2023 02:16:45 +0000 (19:16 -0700)]
[mlir] Update JitRunner, ExecutionEngine after LLVM commit
8b1771bd9f3.
LLVM commit
8b1771bd9f3 replaced JITEvaluatedSymbol with ExecutorSymbolDef.
AmosLewis [Tue, 28 Mar 2023 01:49:19 +0000 (18:49 -0700)]
[mlir][tosa] Add TOSA f64 type support for const op
[mlir][tosa] Add TOSA f64 type support for const op
Reviewed By: eric-k256, jpienaar
Differential Revision: https://reviews.llvm.org/D145336
Yeting Kuo [Mon, 27 Mar 2023 07:16:02 +0000 (15:16 +0800)]
[RISCV] Support vector type strict_fma.
Like D145900, the patch also supports fixed vector strict_fma nodes in RISC-V by
customized lowering them to riscv_strict_vfmadd_vl nodes. riscv_strict_vfmadd_vl
is created to avoid some riscv_vfmadd_vl optimizations happening to original
strict_fma nodes. The patch also adds combine patterns for riscv_strict_fmadd_vl
nodes with negation operands.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D146939
Lang Hames [Tue, 28 Mar 2023 00:43:58 +0000 (17:43 -0700)]
[ORC] Add missing header.
Accidentally left out of
8b1771bd9f3.
Lang Hames [Wed, 22 Mar 2023 18:45:10 +0000 (11:45 -0700)]
[ORC] Move most ORC APIs to ExecutorAddr, introduce ExecutorSymbolDef.
ExecutorAddr was introduced in
b8e5f918166 as an eventual replacement for
JITTargetAddress. ExecutorSymbolDef is introduced in this patch as a
replacement for JITEvaluatedSymbol: ExecutorSymbolDef is an (ExecutorAddr,
JITSymbolFlags) pair, where JITEvaluatedSymbol was a (JITTargetAddress,
JITSymbolFlags) pair.
A number of APIs had already migrated from JITTargetAddress to ExecutorAddr,
but many of ORC's internals were still using the older type. This patch aims
to address that.
Some public APIs are affected as well. If you need to migrate your APIs you can
use the following operations:
* ExecutorAddr::toPtr replaces jitTargetAddressToPointer and
jitTargetAddressToFunction.
* ExecutorAddr::fromPtr replace pointerToJITTargetAddress.
* ExecutorAddr(JITTargetAddress) creates an ExecutorAddr value from a
JITTargetAddress.
* ExecutorAddr::getValue() creates a JITTargetAddress value from an
ExecutorAddr.
JITTargetAddress and JITEvaluatedSymbol will remain in JITSymbol.h for now, but
the aim will be to eventually deprecate and remove these types (probably when
MCJIT and RuntimeDyld are deprecated).
Peter Klausler [Sat, 18 Mar 2023 00:16:40 +0000 (17:16 -0700)]
[flang] Settle ambiguity between C795 and C721
C721 says that a type parameter value of '*' is permitted in the type-spec
for a named constant; C795 says that such type parameters are allowed
in type-specs only for a few kinds of things, not including named
constants. The interpretation seems to depend on context, with C721
applying to intrinsic types (i.e., character) and C795 applying only
to derived types.
Differential Revision: https://reviews.llvm.org/D146586
Craig Topper [Tue, 28 Mar 2023 00:29:28 +0000 (17:29 -0700)]
[RISCV] Move compressible registers to the beginning of the FP allocation order.
We don't have very many compressible FP instructions, just load and store.
These instruction require the FP register to be f8-f15.
This patch changes the FP allocation order to prioritize f10-f15 first.
These are also the FP argument registers. So I allocated them in reverse
order starting at f15 to avoid taking the first argument registers.
This appears to match gcc allocation order.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D146488
Peter Klausler [Fri, 17 Mar 2023 23:01:47 +0000 (16:01 -0700)]
[flang] Catch impure defined assignments in DO CONCURRENT
The semantic checking of DO CONCURRENT bodies looks only at the
parse tree, not the typed expressions produced from it, so it
misses calls to defined assignment subroutines that arise from
assignment statements that resolve via generic interfaces into
subroutine calls. Extend the checking to peek into the typed
assignment operations left on the parse tree by semantics.
Differential Revision: https://reviews.llvm.org/D146585
Vadim Paretsky [Tue, 28 Mar 2023 00:20:54 +0000 (17:20 -0700)]
[OpenMP] Fix an OpenMP Windows build problem
When building OpenMP as part of LLVM, CMAKE was generating incorrect
location references for OpenMP build's first step's artifacts being used
in regenerating its Windows import library in the second step. The fix is
to feed a dummy non-buildable, rather than buildable, source to CMAKE to
satisfy its source requirements removing the need to reference the first
step's artifacts in the second step altogether.
Differential Revision:https://reviews.llvm.org/D146894
Peter Klausler [Fri, 17 Mar 2023 22:26:25 +0000 (15:26 -0700)]
[flang] Detect image control statements in non-construct IF statements
The utility routine in semantics that determines whether an
executable construct constitutes an image control statement
was not examining the single action statement controlled by
a non-construct IF statement, e.g. 'IF(P) STOP'.
Differential Revision: https://reviews.llvm.org/D146584
Usman Akinyemi [Tue, 28 Mar 2023 00:00:14 +0000 (17:00 -0700)]
Added instruction to join the llvm discourse and discord group.
Added instruction and link to join the llvm discord and discourse group
in the CONTRIBUTING.md files
Reviewed By: keith
Differential Revision: https://reviews.llvm.org/D146877
Peter Klausler [Fri, 17 Mar 2023 21:13:39 +0000 (14:13 -0700)]
[flang] Tune handling of LEN type parameter discrepancies on ALLOCATE
Presently, semantics doesn't check for discrepancies between known
constant corresponding LEN type parameters between the declared type
of an allocatable/pointer and either the type-spec or the SOURCE=/MOLD=
on an ALLOCATE statement.
This allows discrepancies between character lengths to go unchecked.
Some compilers accept mismatched character lengths on SOURCE=/MOLD=
and the allocate object, and that's useful and unambiguous feature
that already works in f18 via truncation or padding. A portability
warning should issue, however.
But for mismatched character lengths between an allocate object and
an explicit type-spec, and for any mismatch between derived type
LEN type parameters, an error is appropriate.
Differential Revision: https://reviews.llvm.org/D146583
Peiming Liu [Mon, 27 Mar 2023 23:45:54 +0000 (23:45 +0000)]
[mlir][sparse] rephrase the documentation for sparse compiler create-sparse-deallocs option.
To address post-submit comments in https://reviews.llvm.org/D147010.
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D147014
Jonas Devlieghere [Mon, 27 Mar 2023 16:25:21 +0000 (09:25 -0700)]
[dsymutil] Add the ability to generate universal binaries with a fat64 header
Add the ability to generate universal binaries with a fat64 header.
rdar://
107223939
Differential revision: https://reviews.llvm.org/D146879
Peter Klausler [Thu, 16 Mar 2023 19:41:25 +0000 (12:41 -0700)]
[flang] Consolidate and enhance pointer assignment checks
Consolidate aspects of pointer assignment & structure constructor pointer component
checking from Semantics/assignment.cpp and /expression.cpp into /pointer-assignment.cpp,
and add a warning about data targets that are not definable objects
but not hard errors. Specifically, a structure component pointer component data
target is not allowed to be a USE-associated object in a pure context by a numbered
constraint, but the right-hand side data target of a pointer assignment statement
has no such constraint, and that's the new warning.
Differential Revision: https://reviews.llvm.org/D146581
Peiming Liu [Mon, 27 Mar 2023 22:56:52 +0000 (22:56 +0000)]
[mlir][sparse] add create-sparse-deallocs options to match the create-deallocs in BufferizationOption.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147010
Peter Klausler [Thu, 16 Mar 2023 00:57:58 +0000 (17:57 -0700)]
[flang] Catch more bad DATA statement objects
The data statement variable checker is missing some cases, like expressions
that are not variables. Run the checker first to enjoy its very specific
error messages, but when it finds no problems, still apply a general
check that an expression is a "variable" and also not a constant expression
at the top level as a backstop.
Differential Revision: https://reviews.llvm.org/D146580
Jakob Leifhelm [Mon, 27 Mar 2023 23:03:36 +0000 (16:03 -0700)]
[llvm-c][ORC] Fix LLVMOrcObjectLayerAddObjectFileWithRT.
The LLVMOrcObjectLayerAddObjectFileWithRT method does not have an
implementation. LLVMOrcLLJITAddObjectFileWithRT exists twice (maybe a copy
paste error).
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D118447
Joseph Huber [Mon, 27 Mar 2023 15:19:16 +0000 (10:19 -0500)]
[NVPTX] Add __CUDA_ARCH__ macro to standalone NVPTX compilations
We can now target the NVPTX architecture directly via
`--target=nvptx64-nvidia-cuda`. This currently does not define the
`__CUDA_ARCH__` macro with is used to allow code to target different
codes based on support. This patch simply adds this support.
Reviewed By: tra, jdoerfert
Differential Revision: https://reviews.llvm.org/D146975
Jorge Gorbe Moya [Mon, 27 Mar 2023 21:46:08 +0000 (14:46 -0700)]
[lldb] Fix double free in python bindings error handling.
If we have a `%typemap(freearg)` that frees the argument, we shouldn't
free it manually on an error path before calling `SWIG_fail`.
`SWIG_fail` will already free the memory in this case, and doing it
manually results in a double free.
Differential Revision: https://reviews.llvm.org/D147007
Hongtao Yu [Mon, 27 Mar 2023 23:04:52 +0000 (16:04 -0700)]
[NFC][scciter] Update code comments.
Peter Klausler [Wed, 15 Mar 2023 23:50:31 +0000 (16:50 -0700)]
[flang] Move SAVE attribute checks to declaration checking
Constraint checking for explicit SAVE attributes is more
accurate when done along with other declaration checking, rather
than on the fly during name resolution. This allows us to
catch attempts to attach explicit SAVE attributes to anything
that can't have one (constraints C859, C860).
Also delete `IsSave()`, whose few remaining uses were changed to the
more general `IsSaved()` predicate that seems more correct for
those uses, returning true for both explicit and implied SAVE
attributes.
Differential Revision: https://reviews.llvm.org/D146579
Peter Klausler [Wed, 15 Mar 2023 20:06:20 +0000 (13:06 -0700)]
[flang] Fix check for PRIVATE override of PUBLIC t.b.p.
A PRIVATE procedure binding in a derived type extension may not
be an override of a PUBLIC procedure binding. Declaration checking
for this case was working only in the presence of an explicit
PUBLIC accessibility attribute, when it should be checking for the
absence of a PRIVATE accessibility attribute.
Differential Revision: https://reviews.llvm.org/D146577
Peter Klausler [Wed, 15 Mar 2023 19:21:04 +0000 (12:21 -0700)]
[flang] Reimplement C1406 check as a warning
Constraint C1406 in Fortran 2018 prohibits the USE of the same module
name as both an intrinsic module and a non-intrinsic module in a scope.
The current check misinterprets the constraint as applying only to
explicitly INTRINSIC or NON_INTRINSIC module natures.
Change the check to also apply to non-explicit module natures, and
also downgrade it to a portability warning, since there is no ambiguity
and I suspect that we need to accept this usage when building f18's
own intrinsic modules.
Differential Revision: https://reviews.llvm.org/D146576
Mikhail R. Gadelha [Mon, 27 Mar 2023 22:41:39 +0000 (19:41 -0300)]
[libc] Fix longjmp's fake return in x86_64
This implements the fake return after a successful longjmp(), as
described in the linux man page:
Following a successful longjmp(), execution continues as if setjmp()
had returned for a second time. This "fake" return can be distin-
guished from a true setjmp() call because the "fake" return returns the
value provided in val. If the programmer mistakenly passes the value 0
in val, the "fake" return will instead return 1.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D146981
Alexander Yermolovich [Wed, 22 Mar 2023 20:25:48 +0000 (13:25 -0700)]
[DWARF][GDB INDEX] Fix to deal with constant pool de-dupliation Summary:
GDB 11.2 generates V8 version of gdb-index where it de-duplicates entries in
constant pool based on cu indices. Changed how constant pool entries are counted
to account for this.
Differential Revision: https://reviews.llvm.org/D146852
Peter Klausler [Wed, 15 Mar 2023 00:11:48 +0000 (17:11 -0700)]
[flang] Emit error when a positional actual argument follows an argument with a keyword
A positional (non-keyword) actual argument or alternate return label is not
allowed to follow an actual argument with a keyword.
Differential Revision: https://reviews.llvm.org/D146575
Peter Klausler [Tue, 14 Mar 2023 23:02:30 +0000 (16:02 -0700)]
[flang] Warn about inconsistent external procedure interfaces
When multiple scopes in a compilation define interfaces (explicit
or implicit) for an external procedure, warn when those interfaces
are inconsistent.
Differential Revision: https://reviews.llvm.org/D146574
Peter Klausler [Tue, 14 Mar 2023 20:10:25 +0000 (13:10 -0700)]
[flang] Catch attempt to apply ASYNCHRONOUS attribute to a non-variable
Complain about the ASYNCHRONOUS attribute on symbols that aren't
variables.
Differential Revision: https://reviews.llvm.org/D146573