rkayaith [Thu, 20 Oct 2022 04:51:06 +0000 (00:51 -0400)]
[mlir][CAPI] Allow specifying pass manager anchor
This adds a new function for creating pass managers that takes an
argument for the anchor string.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D136404
Chris Bieneman [Wed, 26 Oct 2022 17:25:19 +0000 (12:25 -0500)]
[ObjectYAML] Add support for DXContainer HASH
DXContainer files contain a part that has an MD5 of the generated
shader. This adds support to the ObjectYAML tooling to expand the hash
part data and hash iteself in preparation for adding hashing support to
DirectX code generation.
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D136632
Michael Jones [Wed, 26 Oct 2022 20:42:39 +0000 (13:42 -0700)]
[libc] add fgets
This adds the fgets function and its unit tests.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D136785
eopXD [Wed, 28 Sep 2022 18:01:23 +0000 (11:01 -0700)]
[LSR] Drop LSR solution if it is less profitable than baseline
The LSR may suggest less profitable transformation to the loop. This
patch adds check to prevent LSR from generating worse code than what
we already have.
Since LSR affects nearly all targets, the patch is guarded by the
option 'lsr-drop-solution' and default as disable for now.
The next step should be extending an TTI interface to allow target(s)
to enable this enhancememnt.
Debug log is added to remind user of such choice to skip the LSR
solution.
Reviewed By: Meinersbur, #loopoptwg
Differential Revision: https://reviews.llvm.org/D126043
rkayaith [Thu, 20 Oct 2022 20:40:32 +0000 (16:40 -0400)]
[mlir][python] Include pipeline parse errors in exception message
Currently any errors during pipeline parsing are reported to stderr.
This adds a new pipeline parsing function to the C api that reports
errors through a callback, and updates the python bindings to use it.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D136402
Fangrui Song [Thu, 27 Oct 2022 16:25:21 +0000 (09:25 -0700)]
[llvm-readelf] --section-details: display SHF_COMPRESSED headers
readelf --section-details displays ch_type/ch_size/ch_addralign for
a SHF_COMPRESSED section. Port the feature. There is a small difference
that readelf doesn't display `[<corrupt>]` for an empty section while
we do.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D136636
Alexander Belyaev [Thu, 27 Oct 2022 16:02:32 +0000 (18:02 +0200)]
[mlir] Fix asan issue in Vectorization.cpp of Linalg.
Differential Revision: https://reviews.llvm.org/D136852
Roman Lebedev [Thu, 27 Oct 2022 16:08:43 +0000 (19:08 +0300)]
[NFC][PhaseOrdering] Add one more test for SROA after partial unroll
https://reviews.llvm.org/D136806
Craig Topper [Thu, 27 Oct 2022 15:52:05 +0000 (08:52 -0700)]
[LegalizeVectorOps][X86][RISCV] Expand vector S/USHLSAT instead of unrolling.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D136478
Dave Lee [Thu, 27 Oct 2022 15:48:12 +0000 (08:48 -0700)]
[lldb][test] Remove explicit mydir definitions (NFC)
Kito Cheng [Thu, 27 Oct 2022 15:45:59 +0000 (23:45 +0800)]
[RISCV] Drop single letter b extension support
It splited into several zb* extensions, and `b` is dropped after
0.93, so it time to retired that as other non-ratified zb* extensions.
Currntly clang can accept that with warning:
$ clang -target riscv64-elf ~/hello.c -S -march=rv64gcb
'+b' is not a recognized feature for this target (ignoring feature)
'+b' is not a recognized feature for this target (ignoring feature)
'+b' is not a recognized feature for this target (ignoring feature)
Reviewed By: asb, luismarques
Differential Revision: https://reviews.llvm.org/D136812
Dave Lee [Thu, 27 Oct 2022 05:05:41 +0000 (22:05 -0700)]
[lldb][test] Remove empty setUp/tearDown methods (NFC)
Alexandros Lamprineas [Tue, 25 Oct 2022 15:45:18 +0000 (16:45 +0100)]
[FuncSpec] Do not overestimate the specialization bonus for users inside loops.
When calculating the specialization bonus for a given function argument,
we recursively traverse the chain of (certain) users, accumulating the
instruction costs. Then we exponentially increase the bonus to account
for loop nests. This is problematic for two reasons: (a) the users might
not themselves be inside the loop nest, (b) if they are we are accounting
for it multiple times. Instead we should be adjusting the bonus before
traversing the user chain.
This reduces the instruction count for CTMark (newPM-O3) when Function
Specialization is enabled without actually reducing the amount of
specializations performed (geomean: -0.001% non-LTO, -0.406% LTO).
Differential Revision: https://reviews.llvm.org/D136692
Sanjay Patel [Thu, 27 Oct 2022 12:54:07 +0000 (08:54 -0400)]
[InstCombine] improve demanded bits for Sub operand 0
This is copying the code that was added for 'add' with D130075.
(That patch removed a fallthrough in the cases, but we can
probably still share at least some code again as a follow-up
cleanup, but I didn't want to risk it here.)
The reasoning is similar to the carry propagation for 'add':
if we don't demand low bits of the subtraction and the
subtrahend (aka RHS or operand 1) is known zero in those low
bits, then there can't be any borrowing required from the
higher bits of operand 0, so the low bits don't matter.
Also, the no-wrap flags can be propagated (and I think that
should be true for add too).
Here's an attempt to prove that in Alive2:
https://alive2.llvm.org/ce/z/xqh7Pa
(can add nsw or nuw to src and tgt, and it should still pass)
Differential Revision: https://reviews.llvm.org/D136788
Liming Liu [Thu, 27 Oct 2022 13:27:02 +0000 (06:27 -0700)]
[P0857R0 Part-B] Allows `require' clauses appearing in
template-template parameters. Although it effects whether a template can be
used as an argument for another template, the constraint seems not to
be checked, nor other major implementations (GCC, MSVC, et al.) check it.
Additionally, Part-A of the document seems to have been implemented.
So mark P0857R0 as completed.
Differential Revision: https://reviews.llvm.org/D134128
gonglingqin [Thu, 27 Oct 2022 12:45:57 +0000 (20:45 +0800)]
[LoongArch] Add codegen support for cmpxchg on LA64
Differential Revision: https://reviews.llvm.org/D135948
John Brawn [Thu, 27 Oct 2022 13:14:57 +0000 (14:14 +0100)]
[MachineCSE] Allow PRE of instructions that read physical registers
Currently MachineCSE forbids PRE when the instruction reads a physical
register. Relax this so that it's allowed when the value being read is
the same as what would be read in the place the instruction would be
hoisted to.
This is being done in preparation for adding FPCR handling to the
AArch64 backend, in order to prevent it to from worsening the
generated code, but for targets that already have a similar register
it should improve things.
This patch affects code generation in several tests. The new code
looks better except for in Thumb2/LowOverheadLoops/memcall.ll where
we perform PRE but the LowOverheadLoops transformation then undoes
it. Also in AMDGPU/selectcc-opt.ll the CHECK makes things look worse,
but actually the function as a whole is better (as a MOV is PRE'd).
Differential Revision: https://reviews.llvm.org/D136675
LLVM GN Syncbot [Thu, 27 Oct 2022 12:53:31 +0000 (12:53 +0000)]
[gn build] Port
b51b90d6e25c
LLVM GN Syncbot [Thu, 27 Oct 2022 12:53:30 +0000 (12:53 +0000)]
[gn build] Port
17059753f133
Nico Weber [Thu, 27 Oct 2022 12:47:12 +0000 (08:47 -0400)]
[gn build] semi-automatically ort
4f06d46f465c (LogicalView input files)
Michał Górny [Thu, 27 Oct 2022 12:30:02 +0000 (14:30 +0200)]
Revert "Harmonize cmake_policy() across standalone builds of all projects"
This reverts commit
88d7508dc479210f07abccb17f0194b66264b125.
It's reported to break builds when symlinking other projects inside
the `tools` directory.
Jakob Johnson [Wed, 26 Oct 2022 22:48:56 +0000 (15:48 -0700)]
[intelpt] Update Python tests to account for new errrors
Update the Python tests (ie tests run via `lldb-dotest -p TestTrace`) to
handle new error introduced in D136610.
Test Plan:
`lldb-dotest -p TestTrace`
Differential Revision: https://reviews.llvm.org/D136801
Carlos Alberto Enciso [Thu, 27 Oct 2022 11:04:27 +0000 (12:04 +0100)]
[llvm-debuginfo-analyzer] (08/09) - ELF Reader
The fix for the unitest case introduced a dependency on the
MC library causing a failure in:
https://lab.llvm.org/buildbot/#/builders/121/builds/24567
clang-ppc64le-multistage/stage1
undefined reference to symbol 'llvm::TargetRegistry::lookupTarget'
Added:
- MC to the LLVM_LINK_COMPONENTS list.
Reviewed By: jryans
Differential Revision: https://reviews.llvm.org/D136837
Alexander Belyaev [Thu, 27 Oct 2022 11:01:22 +0000 (13:01 +0200)]
[mlir] Fix printing when linalg.map has no inputs.
Differential Revision: https://reviews.llvm.org/D136836
Momchil Velikov [Thu, 27 Oct 2022 11:23:03 +0000 (12:23 +0100)]
Recommit: [FuncSpec] Fix specialisation based on literals
[fixed test to work with reverse iteration]
The `FunctionSpecialization` pass has support for specialising
functions, which are called with literal arguments. This functionality
is disabled by default and is enabled with the option
`-function-specialization-for-literal-constant` . There are a few
issues with the implementation, though:
* even with the default, the pass will still specialise based on
floating-point literals
* even when it's enabled, the pass will specialise only for the `i1`
type (or `i2` if all of the possible 4 values occur, or `i3` if all
of the possible 8 values occur, etc)
The reason for this is incorrect check of the lattice value of the
function formal parameter. The lattice value is `overdefined` when the
constant range of the possible arguments is the full set, and this is
the reason for the specialisation to trigger. However, if the set of
the possible arguments is not the full set, that must not prevent the
specialisation.
This patch changes the pass to NOT consider a formal parameter when
specialising a function if the lattice value for that parameter is:
* unknown or undef
* a constant
* a constant range with a single element
on the basis that specialisation is pointless for those cases.
Is also changes the criteria for picking up an actual argument to
specialise if the argument is:
* a LLVM IR constant
* has `constant` lattice value
has `constantrange` lattice value with a single element.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D135893
Change-Id: Iea273423176082ec51339aa66a5fe9fea83557ee
Michał Górny [Mon, 24 Oct 2022 04:31:37 +0000 (06:31 +0200)]
Harmonize cmake_policy() across standalone builds of all projects
Move `cmake_policy()` settings from `llvm/CMakeLists.txt` into a shared
`cmake/modules/CMakePolicy.cmake`. Include it from all relevant
projects that support standalone builds, in order to ensure that
the policies are consistently set whether they are built in-tree
or stand-alone.
Differential Revision: https://reviews.llvm.org/D136572
Oleg Shyshkov [Thu, 27 Oct 2022 11:32:52 +0000 (13:32 +0200)]
[mlir] Fix `AffineMap.dropResults`.
`AffineMap.dropResult` erases one result from the array and it changes indexing. Calling `dropResult` is a loop with increasing indexes does not produce a desired result.
Differential Revision: https://reviews.llvm.org/D136833
Max Kazantsev [Thu, 27 Oct 2022 10:54:15 +0000 (17:54 +0700)]
Fix iterator corruption in splitBasicBlockBefore
We should not delete block predecessors (via replacing successors
of terminators) while iterating them, otherwise we may skip some
of them. Instead, save predecessors to a separate vector and iterate
over it.
Nikita Popov [Thu, 27 Oct 2022 10:38:55 +0000 (12:38 +0200)]
[FunctionAttrs] Add additional tests with operand bundles (NFC)
Matthias Springer [Thu, 27 Oct 2022 10:24:02 +0000 (12:24 +0200)]
[mlir][tensor][bufferize] Support memory_space for tensor.pad
This change adds memory space support to tensor.pad. (tensor.generate and tensor.from_elements do not support memory spaces yet.)
The memory space is inferred from the buffer of the source tensor.
Instead of lowering tensor.pad to tensor.generate + tensor.insert_slice, it is now lowered to bufferization.alloc_tensor (with the correct memory space) + linalg.map + tensor.insert_slice.
Memory space support for the remaining two tensor ops is left for a later point, as this requires some more design discussions.
Differential Revision: https://reviews.llvm.org/D136265
Phoebe Wang [Thu, 27 Oct 2022 10:23:05 +0000 (18:23 +0800)]
Fix buildbot fail
Matthias Springer [Thu, 27 Oct 2022 10:20:05 +0000 (12:20 +0200)]
[mlir][tensor] Fix build: Add missing line break to test case
This should have been part of D136767.
Matthias Springer [Thu, 27 Oct 2022 09:54:01 +0000 (11:54 +0200)]
[mlir][tensor][bufferize] Lower tensor.generate to linalg.map
There is no memref equivalent of tensor.generate. The purpose of this change is to avoid creating scf.parallel loops during bufferization.
Differential Revision: https://reviews.llvm.org/D136767
Nikita Popov [Thu, 27 Oct 2022 10:00:30 +0000 (12:00 +0200)]
[BasicAA] Remove redundant libcall handling
The writeonly attribute for memset_pattern16 (and other referenced
libcalls) is being added by InferFunctionAttrs nowadays. No need
to special-case it here.
Utkarsh Saxena [Thu, 27 Oct 2022 09:50:43 +0000 (11:50 +0200)]
[clang] Do not hide base member using-decls with different template head.
Fixes: https://github.com/llvm/llvm-project/issues/50886
**Adding requires clause to template head** or **constraining the template parameter type** is ineffective because, even though it creates a non-equivalent template head [temp.over.link#6](https://eel.is/c++draft/temp.over.link#6) and hence eligible for overload resolution, `Derived::foo` still [hides any previous using decl](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L1283-L1301,).
Clang diverges from gcc here and can be seen more clearly in this example:
```
struct base {
template <int N, int M>
int foo() { return 1; };
};
struct bar : public base {
using base::foo;
template <int N>
int foo() { return 2; };
};
int main() {
bar f;
f.foo<10, 10>(); // clang previously errored while GCC does not.
}
```
https://godbolt.org/z/v5hnh6czq. We see that `bar::foo` hides `base::foo` because it only differs in the head.
Adding a trailing `requires` to the definition was a nice find. In this case, clang considers them [overloads](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L1148-L1152) because of [mismatching requires clause.](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L1390-L1405). So both of them make it to the overload resolution (where constrained Derived::foo is rejected then).
---
In this patch, we do not ignore matching the template head (template parameters, type contraints and trailing requires) while considering whether the using decl of base member should be hidden. The return type of a templated function is still not considered as different return types would create ambiguous candidates.
The changed tests looks reasonable and also matches GCC behaviour: https://godbolt.org/z/8KqPEThrY
Note: We are now able to create an ambiguity in case where both base member and derived member specialisations satisfy the constraints (when the constraints are not same). Ideally using-decl should not create ambiguity. I plan to fix this later if it gathers more attention.
Reviewed By: ilya-biryukov, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D136440
Matthias Springer [Thu, 27 Oct 2022 09:45:15 +0000 (11:45 +0200)]
[mlir] Fix circular dialect initialization
This change fixes a bug where a dialect is initialized multiple times. This triggers an assertion when the ops of the dialect are registered (`error: operation named ... is already registered`).
This bug can be triggered as follows:
1. Dialect A depends on dialect B (as per ADialect.td).
2. Somewhere there is an extension of dialect B that depends on dialect A (e.g., it defines external models create ops from dialect A). E.g.:
```
registry.addExtension(+[](MLIRContext *ctx, BDialect *dialect) {
BDialectOp::attachInterface ...
ctx->loadDialect<ADialect>();
});
```
3. When dialect A is loaded, its `initialize` function is called twice:
```
ADialect::ADialect()
| |
| v
| ADialect::initialize()
v
getOrLoadDialect<BDialect>()
|
v
(load extension of BDialect)
|
v
ctx->loadDialect<ADialect>() // user wrote this in the extension
|
v
getOrLoadDialect<ADialect>() // the dialect is not "fully" loaded yet
|
v
ADialect::ADialect()
|
v
ADialect::initialize()
```
An example of a dialect extension that depends on other dialects is `Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp`. That particular dialect extension does not trigger this bug. (It would trigger this bug if the SCF dialect would depend on the Tensor dialect.)
This change introduces a new dialect state: dialects that are currently being loaded. Same as dialects that were already fully loaded (and initialized), dialects that are in the process of being loaded are not loaded a second time.
Differential Revision: https://reviews.llvm.org/D136685
Phoebe Wang [Thu, 27 Oct 2022 09:08:49 +0000 (17:08 +0800)]
[X86][1/2] SUPPORT RAO-INT
For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
Initial authored by Liu Chen (@LiuChen3)
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D135951
Matthias Springer [Thu, 27 Oct 2022 08:59:52 +0000 (10:59 +0200)]
[mlir][vector][bufferize] Implement DestinationStyleOpInterface on TransferWriteOp
This simplifies the BufferizableOpInterface implementation of vector.transfer_write.
Differential Revision: https://reviews.llvm.org/D136348
Carlos Alberto Enciso [Thu, 27 Oct 2022 08:47:09 +0000 (09:47 +0100)]
[llvm-debuginfo-analyzer] (08/09) - ELF Reader
The unitest and test cases are platform dependent (x86_64)
causing failures in:
https://lab.llvm.org/buildbot/#/builders/245/builds/146
https://lab.llvm.org/buildbot/#/builders/188/builds/21397
No available targets are compatible with triple "x86_64-unknown-unknown".
Added:
- ';REQUIRES: x86-registered-target' to the LIT tests.
- Code to check if the target 'Triple::x86_64' is supported to
the unittest case.
eopXD [Thu, 27 Oct 2022 07:42:31 +0000 (00:42 -0700)]
Pre-commit test case for D136784
This is a pre-commit for the fix in D136784.
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D136783
eopXD [Thu, 29 Sep 2022 09:08:50 +0000 (02:08 -0700)]
[LSR][RISCV] Pre-commit test case for D126043
Pre-commit test case for D126043
Reviewed By: Meinersbur, #loopoptwg
Differential Revision: https://reviews.llvm.org/D134823
Matthias Springer [Thu, 27 Oct 2022 08:40:24 +0000 (10:40 +0200)]
[mlir][bufferize] Provide default BufferizableOpInterface impl for destination style ops
tensor.insert and tensor.insert_slice (as destination style ops) do no longer need to implement the entire BufferizableOpInterface.
Differential Revision: https://reviews.llvm.org/D136347
Haojian Wu [Thu, 27 Oct 2022 08:50:29 +0000 (10:50 +0200)]
Fix a -Wunused-const-variable warning.
David Spickett [Mon, 10 Oct 2022 14:35:15 +0000 (14:35 +0000)]
[LLVM] Use DWARFv4 bitfields when tuning for GDB
GDB implemented data_bit_offset in https://sourceware.org/bugzilla/show_bug.cgi?id=12616
which has been present since GDB 8.0.
GCC started using it at GCC 11.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D135583
wangpc [Thu, 27 Oct 2022 08:42:26 +0000 (16:42 +0800)]
[RISCV] Map pseudos to their BaseInstr to reduce cases
There are a lot of cases for pseudos of the same instruction, here
we just use existed mapping table to map pseudos to real instructions
to reduce cases.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D128271
OCHyams [Thu, 27 Oct 2022 07:52:47 +0000 (08:52 +0100)]
[IntervalMap] Add move and copy ctors and assignment operators
And update the unittest.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D136242
Chuanqi Xu [Thu, 27 Oct 2022 08:34:10 +0000 (16:34 +0800)]
[NFC] [Modules] Rename modules related things in Preprocessor and AffectingModules
Rename module related things according to the consensus in
https://discourse.llvm.org/t/rfc-unifying-the-terminology-about-modules-in-clang/66054/
to reduce further confusings.
This only renames things I can make sure. It doesn't mean all the names
in Preprocessor are correct now.
Guillaume Chatelet [Thu, 27 Oct 2022 08:36:04 +0000 (08:36 +0000)]
Revert D136595 "[libc] Switch to new implementation of mem* functions"
This patch seems to introduce bugs on aarch64.
Reverting while we investigate the root cause.
This reverts commit
02841488138160f9064f334a833d4bf3e80385c6.
Nikita Popov [Wed, 19 Oct 2022 10:57:41 +0000 (12:57 +0200)]
[PowerPC] Fix check for ieeelongdouble support
Clang detects the GCC version from the libdir. However, modern
GCC versions only include the major version in the libdir
(something like lib/gcc/powerpc64le-linux-gnu/12/), not all
version components. For this reason, even though the system has
a supported libstdcxx, it will still fail the check against the
12.1.0 version requirement.
Fix this by doing the same thing we do for patch versions: Assume
that a missing minor version is larger than any specific version.
To allow this to be tested, we need to fix two additional issues:
First, the GCC toolchain directories used for testing need to
contain a crtbegin.o file to be properly detected. The existing
tests actually ended up using a 0.0.0 version, rather the intended
one. Second, we also need to satisfy the glibc version check based
on the dynamic linker. To do so, respect the --dyld-prefix argument
and add the necessary file to the test toolchain directory.
Differential Revision: https://reviews.llvm.org/D136258
Alexander Belyaev [Thu, 27 Oct 2022 08:28:38 +0000 (10:28 +0200)]
Revert "Revert "[mlir] Add vectorization tests for linalg.map,reduce,transpose.""
This reverts commit
c34de60ea3a0f58ac8d21d6176356161ba5cc875.
Matthias Springer [Thu, 27 Oct 2022 08:27:11 +0000 (10:27 +0200)]
[mlir][tensor] Implement DestinationStyleOpInterface for tensor.insert/insert_slice
Also allow unranked tensors/memrefs with destination style op outputs.
This allows for a simpler implementation of the BufferizableOpInterface (in a subsequent commit).
Differential Revision: https://reviews.llvm.org/D136346
Nikita Popov [Mon, 17 Oct 2022 11:09:32 +0000 (13:09 +0200)]
[BasicAA] Replace VisitedPhiBBs with a single flag
When looking through phis, BasicAA has to guard against the
possibility that values from two separate cycle iterations are
being compared -- in this case, even though the SSA values may
be the same, they cannot be considered as equal.
This is currently done by keeping a set of VisitedPhiBBs for any
phis we looked through, and then checking whether the relevant
instruction is reachable from one of the phis.
This patch replaces this set with a single flag. If the flag is
set, then we will not assume equality for any instruction part
of a cycle. While this is nominally less accurate, it makes
essentially no difference in practice. Here are the AA stats
for test-suite:
aa.NumMayAlias | 3072005 | 3072016
aa.NumMustAlias | 337858 | 337854
aa.NumNoAlias |
13255345 |
13255349
The motivation for the change is to expose the MayBeCrossIteration
flag to AA users, which will allow fixing miscompiles related to
incorrect handling of cross-iteration AA queries.
Differential Revision: https://reviews.llvm.org/D136174
owenca [Tue, 25 Oct 2022 03:22:04 +0000 (20:22 -0700)]
[clang-format] Move InsertBraces unit tests out of FormatTest.cpp
Also add line range examples from #58161.
Differential Revision: https://reviews.llvm.org/D136658
Matthias Springer [Thu, 27 Oct 2022 08:17:31 +0000 (10:17 +0200)]
[mlir][interfaces] Allow only ranked tensors/memrefs in DestinationStyleOpInterface
We have currently no need for unranked tensors/memrefs.
Differential Revision: https://reviews.llvm.org/D136588
Tatsuyuki Ishi [Thu, 27 Oct 2022 08:14:09 +0000 (10:14 +0200)]
[Support] Use find() for faster StringRef::count (NFC)
While profiling InclusionRewriter, it was found that counting lines was
so slow that it took up 20% of the processing time. Surely, calling
memcmp() of size 1 on every substring in the window isn't a good idea.
Use StringRef::find() instead; in the case of N=1 it will forward to
memcmp which is much more optimal. For 2<=N<256 it will run the same
memcmp loop as we have now, which is still suboptimal but at least does
not regress anything.
Differential Revision: https://reviews.llvm.org/D133658
Alexander Belyaev [Thu, 27 Oct 2022 07:39:52 +0000 (09:39 +0200)]
[mlir] Print bbArgs of linalg.map/reduce/tranpose on the next line.
```
%mapped = linalg.map
ins(%arg0 : tensor<64xf32>)
outs(%arg1 : tensor<64xf32>)
(%in: f32) {
%0 = math.absf %in : f32
linalg.yield %0 : f32
}
%reduced = linalg.reduce
ins(%arg0 : tensor<16x32x64xf32>)
outs(%arg1 : tensor<16x64xf32>)
dimensions = [1]
(%in: f32, %init: f32) {
%0 = arith.addf %in, %init : f32
linalg.yield %0 : f32
}
%transposed = linalg.transpose
ins(%arg0 : tensor<16x32x64xf32>)
outs(%arg1 : tensor<32x64x16xf32>)
permutation = [1, 2, 0]
```
Differential Revision: https://reviews.llvm.org/D136818
Matthias Springer [Thu, 27 Oct 2022 08:04:38 +0000 (10:04 +0200)]
[mlir][tensor] Disallow unranked tensors for tensor.extract/insert
When writing a tensor.extract/tensor.insert, the rank of the tensor is implied by the number of specified indices. When extracting from/inserting into an unranked tensor, it should first be casted to a ranked version.
Differential Revision: https://reviews.llvm.org/D136756
Nicolai Hähnle [Thu, 20 Oct 2022 09:33:49 +0000 (11:33 +0200)]
update_test_checks.py: allow use with custom tools
We have a downstream project with a command-line utility that operates
pretty much exactly like `opt`. So it would make sense for us to
maintain tests with update_test_checks.py with our custom tool
substituted for `opt`, as this change allows.
Differential Revision: https://reviews.llvm.org/D136329
OCHyams [Wed, 26 Oct 2022 16:15:02 +0000 (17:15 +0100)]
Account for memory locations in DIExpression::createFragmentExpression
createFragmentExpression rejects expressions containing certain ops, like
DW_OP_plus, that may cause the expression to compute a value that can't be
split.
Teach createFragmentExpression that the value loaded from an address computed
using those ops is safe to split.
Update a unittest to account for and test this change.
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D136243
Alex Brachet [Thu, 27 Oct 2022 06:47:24 +0000 (06:47 +0000)]
Revert "[libc] Implement getopt"
This reverts commit
a678f86351c30a7d57197ffefab4e6e44e61a857.
Alex Brachet [Thu, 27 Oct 2022 06:23:33 +0000 (06:23 +0000)]
[libc] Implement getopt
Differential Revision: https://reviews.llvm.org/D133487
Siva Chandra [Thu, 27 Oct 2022 05:52:53 +0000 (22:52 -0700)]
[libc] Cleanup stale documentation.
Ian Anderson [Thu, 6 Oct 2022 00:15:02 +0000 (17:15 -0700)]
[libunwind] Add module maps for libunwind
Add module maps for the libunwind headers. unwind_arm_ehabi.h and unwind_itanium.h aren't covered because they don't get installed on all platforms.
Reviewed By: #libunwind, MaskRay
Differential Revision: https://reviews.llvm.org/D135345
wangpc [Thu, 27 Oct 2022 05:35:48 +0000 (13:35 +0800)]
[RISCV][NFC] Remove ISel of SPLAT_VECTOR
Since we have converted SPLAT_VECTOR to VMV_V_X_VL
or VFMV_V_F_VL in RISCVDAGToDAGISel::PreprocessISelDAG().
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D136814
Sameer Sahasrabuddhe [Thu, 27 Oct 2022 05:15:29 +0000 (10:45 +0530)]
[NFC] [AAPointerInfo] OffsetAndSize is no longer an std::pair
The struct OffsetAndSize is a simple tuple of two int64_t. Treating it as a
derived class of std::pair has no special benefit, but it makes the code
verbose since we need get/set functions that avoid using "first" and "second" in
client code. Eliminating the std::pair makes this more readable.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D136745
Jordan Rupprecht [Thu, 27 Oct 2022 05:24:49 +0000 (22:24 -0700)]
[Bazel][llvm-debuginfo-analyzer] Add deps for DebugInfoLogicalView after
4f06d46f465c
Luca Di Sera [Thu, 27 Oct 2022 04:42:35 +0000 (06:42 +0200)]
Add clang_CXXMethod_isCopyAssignmentOperator to libclang
The new method is a wrapper of `CXXMethodDecl::isCopyAssignmentOperator` and
can be used to recognized copy-assignment operators in libclang.
An export for the method, together with its documentation, was added to
"clang/include/clang-c/Index.h" with an implementation provided in
"clang/tools/libclang/CIndex.cpp". The implementation was based on
similar `clang_CXXMethod.*` implementations, following the same
structure but calling `CXXMethodDecl::isCopyAssignmentOperator` for its
main logic.
The new symbol was further added to "clang/tools/libclang/libclang.map"
to be exported, under the LLVM16 tag.
"clang/tools/c-index-test/c-index-test.c" was modified to print a
specific tag, "(copy-assignment operator)", for cursors that are
recognized by `clang_CXXMethod_isCopyAssignmentOperator`.
A new regression test file,
"clang/test/Index/copy-assignment-operator.cpp", was added to ensure
that the correct constructs were recognized or not by the new function.
The "clang/test/Index/get-cursor.cpp" regression test file was updated
as it was affected by the new "(copy-assignment operator)" tag.
A binding for the new function was added to libclang's python's
bindings, in "clang/bindings/python/clang/cindex.py", adding a new
method for `Cursor`, `is_copy_assignment_operator_method`.
The current release note, `clang/docs/ReleaseNotes.rst`, was modified to
report the new addition under the "libclang" section.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D136604
Siva Chandra Reddy [Thu, 27 Oct 2022 00:22:20 +0000 (17:22 -0700)]
[libc] Add a doc about the libc overlay mode.
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D136810
Carlos Alberto Enciso [Wed, 26 Oct 2022 18:42:20 +0000 (19:42 +0100)]
[llvm-debuginfo-analyzer] (08/09) - ELF Reader
llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.
The code has been divided into the following patches:
1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
9) CodeView Reader
Full details:
https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570
This patch:
This is a high level summary of the changes in this patch.
ELF Reader
- Support for ELF/DWARF.
LVBinaryReader, LVELFReader
Reviewed By: psamolysov, probinson
Differential Revision: https://reviews.llvm.org/D125783
Matheus Izvekov [Sun, 23 Oct 2022 09:37:20 +0000 (11:37 +0200)]
[clang] Instantiate concepts with sugared template arguments
Since we don't unique specializations for concepts, we can just instantiate
them with the sugared template arguments, at negligible cost.
If we don't track their specializations, we can't resugar them later
anyway, and that would be more expensive than just instantiating them
sugared in the first place since it would require an additional pass.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D136566
Matheus Izvekov [Sun, 23 Oct 2022 14:57:12 +0000 (16:57 +0200)]
[clang] Instantiate alias templates with sugar
This makes use of the changes introduced in D134604, in order to
instantiate alias templates witn a final sugared substitution.
This comes at no additional relevant cost.
Since we don't track / unique them in specializations, we wouldn't be
able to resugar them later anyway.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D136565
Matheus Izvekov [Sun, 23 Oct 2022 11:41:57 +0000 (13:41 +0200)]
[clang] Instantiate NTTPs and template default arguments with sugar
This makes use of the changes introduced in D134604, in order to
instantiate non-type template parameters and default template arguments
with a final sugared substitution.
This comes at no additional relevant cost.
Since we don't track / unique them in specializations, we wouldn't be
able to resugar them later anyway.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D136564
Matheus Izvekov [Sun, 25 Sep 2022 15:18:39 +0000 (17:18 +0200)]
[clang] Implement sugared substitution changes to infrastructure
Implements the changes required to perform substitution with
non-canonical template arguments, and to 'finalize' them
by not placing 'Subst' nodes.
A finalized substitution means we won't resugar them later,
because these templates themselves were eagerly substituted
with the intended arguments at the point of use. We may still
resugar other templates used within those, though.
This patch does not actually implement any uses of this
functionality, those will be added in subsequent patches,
so expect no changes to existing tests.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D134604
wlei [Mon, 24 Oct 2022 17:48:50 +0000 (10:48 -0700)]
[SampleFDO] Compute and report profile staleness metrics
When a profile is stale and profile mismatch could happen, the mismatched samples are discarded, so we'd like to compute the mismatch metrics to quantify how stale the profile is, which will suggest user to refresh the profile if the number is high.
Two sets of metrics are introduced here:
- (Num_of_mismatched_funchash/Total_profiled_funchash), (Samples_of_mismached_func_hash / Samples_of_profiled_function) : Here it leverages the FunctionSamples's checksums attribute which is a feature of pseudo probe. When the source code CFG changes, the function checksums will be different, later sample loader will discard the whole functions' samples, this metrics can show the percentage of samples are discarded due to this.
- (Num_of_mismatched_callsite/Total_profiled_callsite), (Samples_of_mismached_callsite / Samples_of_profiled_callsite) : This shows how many mismatching for the callsite location as callsite location mismatch will affect the inlining which is highly correlated with the performance. It goes through all the callsite location in the IR and profile, use the call target name to match, report the num of samples in the profile that doesn't match a IR callsite.
This is implemented in a new class(SampleProfileMatcher) and under a switch("--report-profile-staleness"), we plan to extend it with a fuzzy profile matching feature in the future.
Reviewed By: hoy, wenlei, davidxl
Differential Revision: https://reviews.llvm.org/D136627
Matheus Izvekov [Sun, 23 Oct 2022 11:38:39 +0000 (13:38 +0200)]
[clang] Perform sugared substitution of builtin templates
Since these are much like template type aliases, where we don't
track a specialization for them and just substitute them eagerly,
we can't resugar them anyway, and there is no relevant cost in just
performing a finalizing sugared substitution.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D136563
Matheus Izvekov [Mon, 5 Sep 2022 19:57:37 +0000 (21:57 +0200)]
[clang] Changes to produce sugared converted template arguments
Makes CheckTemplateArgumentList and the template deduction functions
produce a sugared converted argument list in addition to the canonical one.
This is mostly NFC except that we hook this up to a few diagnostics in
SemaOverload.
The infrastructure here will be used in subsequent patches
where we perform a finalized sugared substitution for entities
which we do not unique per specializations on canonical arguments,
and later on will be used for template specialization resugaring.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D133874
Richard Smith [Sun, 11 Oct 2020 22:57:52 +0000 (15:57 -0700)]
[clang] Include the type of a pointer or reference non-type template parameter in its notion of template argument identity.
We already did this for all the other kinds of non-type template
argument.
Note: Based on earlier reverted patch from zygoloid.
Differential Revision: https://reviews.llvm.org/D136803
Mahesh Ravishankar [Thu, 27 Oct 2022 03:12:40 +0000 (03:12 +0000)]
[mlir][Tensor] Change `createDimValues` to return a list of `OpFoldResult`s.
Reviewed By: nicolasvasilache, hanchung, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D136733
Wanyi Ye [Thu, 27 Oct 2022 02:49:03 +0000 (19:49 -0700)]
Revert "[lldb-vscode] Send Statistics Dump in terminated event"
This reverts commit
c8a26f8c6de30dbd814546f02e4c89a4fcb2b4ef.
Returning full statistics result in "terminated" (DAP) event could result in delay in the UI when debugging from VSCode.
If the program run to exit and debug session terminates. The DAP event order will be: exited event --> terminateCommands --> terminated event --> disconnect request --> disconnect response.
The debugging UI in VSCode corresponds to "disconnect" request/response. If the terminated event is taking long to process, the IDE won't quit debugging UI until it's done.
For big binary (tested example has 29 GB of debug info), it can cause ~15s delay in terminated event itself. And the UI could take ~20s to reflect.
This may cause confusion in debug sessions. We should persuit a more lightweight return or other solution to return such info.
chenglin.bi [Thu, 27 Oct 2022 02:04:57 +0000 (10:04 +0800)]
[AArch64] Adjust operand sequence for Add+Sub to combine more inline shift
((X >> C) - Y) + Z --> (Z - Y) + (X >> C)
Fix AArch part: #55714
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D136158
Paul Kirth [Fri, 21 Oct 2022 18:22:03 +0000 (18:22 +0000)]
[CodeGen] Improve large stack frame diagnostic
Add statistics about how much memory is used, in variables, spills, and
unsafestack.
Issue #58168 describes some of the difficulty diagnosing stack size issues
identified by -Wframe-larger-than. D135488 addresses some of those issues by
giving developers a method to view the stack layout and thereby understand
where and how stack memory is used.
However, that solution requires an additional pass, when a short summary about
how the compiler has allocated stack memory can inform developers about where
they should investigate. When they need the complete context, D135488 can
provide them with a more comprehensive set of diagnostics.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D136484
Roman Lebedev [Thu, 27 Oct 2022 00:08:19 +0000 (03:08 +0300)]
[NFC][PhaseOrdering] Add new test for SROA misplacement
Katherine Rasmussen [Tue, 25 Oct 2022 23:26:59 +0000 (16:26 -0700)]
[flang] Add atomic_fetch_and to list of intrinsics
Add the atomic subroutine, atomic_fetch_and, to the list of
intrinsic subroutines, add its last dummy argument to a check
for coindexed-object, and update test.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D136720
Dan McGregor [Wed, 26 Oct 2022 23:52:32 +0000 (16:52 -0700)]
[Driver] Allow target override containing . in executable name
The gcc compatible driver has support for overriding the default
target based on the driver's executable name, for instance
x86_64-pc-linux-gnu-clang will set the default target to
x86_64-pc-linux-gnu.
Previously, this failed when the target contained a minor version, for
example x86_64-pc-freebsd13.1, so instead of finding the file's
stem, use the whole file name, but strip off any '.exe' from the tail.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D135284
Jonas Devlieghere [Wed, 26 Oct 2022 23:38:09 +0000 (16:38 -0700)]
[dwarfdump] Fix bogus incompatible tag warning
Because DW_TAG_LLVM_ptrauth_type is not marked as a type, dwarfdump
currently emits a spurious error: DIE has DW_AT_type with incompatible
tag DW_TAG_LLVM_ptrauth_type. This patch fixes that and adds a test.
Mehdi Amini [Wed, 26 Oct 2022 23:22:44 +0000 (23:22 +0000)]
Fix MLIR Build with some version of GCC
mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp:67:30: error: use 'template' keyword to treat 'dyn_cast_or_null' as a dependent template name
.dyn_cast_or_null<arith::FastMathFlagsAttr>();
^
template
Michael Kruse [Wed, 26 Oct 2022 22:24:43 +0000 (17:24 -0500)]
[Polly] Add support for -polly-enable-mse with NPM.
The MaximalStaticExpansionPass was already ported to the NPM in
02f640672e2875c4e7578366bb2e22582548d7c1. Allow adding it to the default
NPM pass builder pipeline using -polly-enable-mse.
Michael Kruse [Wed, 26 Oct 2022 21:50:50 +0000 (16:50 -0500)]
[Polly] Add support for -polly-export with NPM.
The JSONExporter pass was already ported to the NPM, the pass builder
jsut had to add it to the pass pipeline when requested.
David Blaikie [Fri, 28 Jan 2022 22:22:21 +0000 (14:22 -0800)]
Add a warning for not packing non-POD members in packed structs
Differential Revision: https://reviews.llvm.org/D118511
Steven Wu [Wed, 26 Oct 2022 22:13:00 +0000 (15:13 -0700)]
[LTO] Fix lto_module_create_in_codegen_context return value on error
According to the documentation, lto_module_create_in_codegen_context
should return NULL on error but currently it is accidentally return
error_code. Since this is a bug fix and it seems to be a one-off bug
that only affects this API, there is no need to bump API version.
rdar://
101505192
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D136769
Tue Ly [Wed, 26 Oct 2022 02:10:32 +0000 (22:10 -0400)]
[libc] Add a testing macro for MPFR matchers skipping `explainError` calls.
Adding `EXPECT_MPFR_MATCH_ROUNDING_SILENTLY` macro that does not call
`explainError` when the tests fail. This is useful to check the passing or
failing rates, such as hitting percentages of fast passes in math
implementations.
Reviewed By: michaelrj, sivachandra
Differential Revision: https://reviews.llvm.org/D136731
David Blaikie [Sat, 5 Feb 2022 04:06:13 +0000 (20:06 -0800)]
Extend the C++03 definition of POD to include defaulted functions
The AST/conditionally-trivial-smfs tests look a bit questionable, but
are consistent with GCC's POD-ness, at least as far as packing is
concerned: https://godbolt.org/z/36nqPMbKM
(questionable because it looks like the type would be non-copyable, so
how could it be pod? But the calling convention/pass by value seems to
work correctly (local testing verifies that this behavior is preserved
even with this patch: https://godbolt.org/z/3Pa89zsv6 ))
Differential Revision: https://reviews.llvm.org/D119051
Emilio Cota [Wed, 26 Oct 2022 21:45:25 +0000 (17:45 -0400)]
[bazel][mlir][arith] build fixes for arith fastmath flags
David Blaikie [Wed, 26 Oct 2022 21:37:25 +0000 (21:37 +0000)]
[ADT] Add deduction guide for llvm::Optional
Added to address some uses of implicit CTAD added in clang recently.
Craig Topper [Wed, 26 Oct 2022 21:23:51 +0000 (14:23 -0700)]
[RISCV] Inline scalar ceil/floor/trunc/rint/round/roundeven.
This avoids the call overhead as well as the the save/restore of
fflags and the snan handling in the libm function.
The save/restore of fflags and snan handling are needed to be
correct for -ftrapping-math. I think we can ignore them in the
default environment.
The inline sequence will generate an invalid exception for nan
and an inexact exception if fractional bits are discarded.
I've used a custom inserter to explicitly create the control flow
around the float->int->float conversion.
We can probably avoid the final fsgnj after the conversion for
no signed zeros FMF, but I'll leave that for future work.
Note the comparison constant is slightly different than glibc uses.
They use 1<<53 for double, I'm using 1<<52. I believe either are valid.
Numbers >= 1<<52 can't have any fractional bits. It's ok to do the
float->int->float conversion on numbers between 1<<53 and 1<<52 since
they will all fit in 64. We only have a problem if the double can't fit
in i64
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D136508
Quentin Colombet [Fri, 14 Oct 2022 21:00:55 +0000 (21:00 +0000)]
[mlir][MemRefToLLVM] Lower extract_strided_metadata
The `extract_strided_metadata` operation literally breaks down a memory
descriptor into its different components.
Teach the MemRefToLLVM conversion framework this fact.
Differential Revision: https://reviews.llvm.org/D136304
Nick Desaulniers [Wed, 26 Oct 2022 21:24:08 +0000 (14:24 -0700)]
git clang-format HEAD~
for
commit
ad78ce44bb47 ("[clang][Toolchains][Gnu] pass -gdwarf-* through to
assembler")
Sanjay Patel [Wed, 26 Oct 2022 18:34:42 +0000 (14:34 -0400)]
[InstCombine] add tests for demanded bits of sub; NFC
Craig Topper [Wed, 26 Oct 2022 19:09:39 +0000 (12:09 -0700)]
[RISCV] Add tests for fixed vector sshl_sat/ushl_sat. NFC
Siva Chandra [Wed, 26 Oct 2022 21:02:52 +0000 (14:02 -0700)]
[libc] Enable more entrypoints on aarch64.