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.
Guozhi Wei [Wed, 26 Oct 2022 20:57:49 +0000 (20:57 +0000)]
[dexter-tests] Add attribute optnone to main function
The test case optnone-simple-functions.cpp is expected to be compiled
unoptimized even under -O2 because of attribute optnone. But this attribute is
missed for main function, and caused the fail in
https://lab.llvm.org/buildbot/#/builders/217/builds/14046 when it triggered
optimizations. This patch fixes that by adding attribute optnone to main
function.
Differential Revision: https://reviews.llvm.org/D136778
Sami Tolvanen [Mon, 19 Sep 2022 23:06:18 +0000 (23:06 +0000)]
[Clang][Sema] Add -Wcast-function-type-strict
Clang supports indirect call Control-Flow Integrity (CFI) sanitizers
(e.g. -fsanitize=cfi-icall), which enforce an exact type match between
a function pointer and the target function. Unfortunately, Clang
doesn't provide diagnostics that would help developers avoid function
type casts that lead to runtime CFI failures. -Wcast-function-type,
while helpful, only warns about ABI incompatibility, which isn't
sufficient with CFI.
Add -Wcast-function-type-strict, which checks for a strict type
compatibility in function type casts and helps warn about casts that
can potentially lead to CFI failures.
Reviewed By: nickdesaulniers, aaron.ballman
Differential Revision: https://reviews.llvm.org/D134831
Jonas Devlieghere [Wed, 26 Oct 2022 20:06:22 +0000 (13:06 -0700)]
[dexter] Temporary disable optnone-simple-functions
D136396 broke optnone-simple-functions. Temporary disabling the test to
unblock the bot until the Sony folks can have a look.
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/47878/
Félix Cloutier [Wed, 26 Oct 2022 19:53:14 +0000 (12:53 -0700)]
Revert "[NFC] Make format() more amenable to format attributes"
This reverts commit
fb1e90ef07fec0d64a05c0b6d41117a5ea3e8344.
Ben Langmuir [Tue, 25 Oct 2022 22:12:24 +0000 (15:12 -0700)]
[clang] Move getenv call for SOURCE_DATE_EPOCH out of frontend NFC
Move the check for SOURCE_DATE_EPOCH to the driver and use a cc1 option
to pass it to the frontend. This avoids hidden state in the cc1
invocation and makes this env variable behave more like other env
variables that clang handles in the driver.
Differential Revision: https://reviews.llvm.org/D136717
Johannes Doerfert [Wed, 26 Oct 2022 19:31:33 +0000 (12:31 -0700)]
[OpenMP][FIX] Adjust to clang tests after D136740
Nico Weber [Wed, 26 Oct 2022 19:30:10 +0000 (15:30 -0400)]
[gn build] port
cb0eb9d8dd5 (lldb test libc++ refs)
raghavmedicherla [Wed, 26 Oct 2022 19:08:10 +0000 (15:08 -0400)]
[NFC][Offload Bundler] Formatting clang offloadbundler source file.
Differential Revision: https://reviews.llvm.org/D136715
Félix Cloutier [Fri, 9 Sep 2022 21:08:19 +0000 (14:08 -0700)]
[NFC] Make format() more amenable to format attributes
This change modifies the implementation of the format() function
so that vendor forks committed to building with compilers that
support __attribute__((format)) on non-variadic functions can
check the format() function with it.
Reviewed By: ahatanak
Differential Revision: https://reviews.llvm.org/D132413
rdar://
84571523
Jordan Rupprecht [Wed, 26 Oct 2022 19:07:22 +0000 (12:07 -0700)]
[test] Fix LLDB tests with just-built libcxx when using a target directory.
In certain configurations, libc++ headers all exist in the same directory, and libc++ binaries exist in the same directory as lldb libs. When `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is enabled (*and* the host is not Apple, which is why I assume this wasn't caught by others?), this is not the case: most headers will exist in the usual `include/c++/v1` directory, but `__config_site` exists in `include/$TRIPLE/c++/v1`. Likewise, the libc++.so binary exists in `lib/$TRIPLE/`, not `lib/` (where LLDB libraries reside).
This also adds the just-built-libcxx functionality to the lldb-dotest tool.
The `LIBCXX_` cmake config is borrowed from `libcxx/CMakeLists.txt`. I could not figure out a way to share the cmake config; ideally we would reuse the same config instead of copy/paste.
Reviewed By: JDevlieghere, fdeazeve
Differential Revision: https://reviews.llvm.org/D133973
Jeremy Furtek [Wed, 26 Oct 2022 18:07:20 +0000 (11:07 -0700)]
[mlir][arith] Initial support for fastmath flag attributes in the Arithmetic dialect (v2)
This diff adds initial (partial) support for "fastmath" attributes for floating
point operations in the arithmetic dialect. The "fastmath" attributes are
implemented using a default-valued bit enum. The defined flags currently mirror
the fastmath flags in the LLVM dialect (and in LLVM itself). Extending the
set of flags (if necessary) is left as a future task.
In this diff:
- Definition of FastMathAttr as a custom attribute in the Arithmetic dialect
that inherits from the EnumAttr class.
- Definition of ArithFastMathInterface, which is an interface that is
implemented by operations that have an arith::fastmath attribute.
- Declaration of a default-valued fastmath attribute for unary and (some) binary
floating point operations in the Arithmetic dialect.
- Conversion code to lower arithmetic fastmath flags to LLVM fastmath flags
NOT in this diff (but planned or currently in progress):
- Documentation of flag meanings
- Addition of FastMathAttr attributes to other dialects that might lower to the
Arithmetic dialect (e.g. Math and Complex)
- Folding/rewrite implementations that are enabled by fastmath flags
- Specification of fastmath values from Python bindings (pending other in-
progress diffs)
Reviewed By: mehdi_amini, vzakhari
Differential Revision: https://reviews.llvm.org/D126305
Jakob Johnson [Mon, 24 Oct 2022 14:01:40 +0000 (07:01 -0700)]
[trace][intelpt] Fix multi CPU decoding TSC assertion error
Occasionally the assertion that enforces increasing TSC values in `DecodedThread::NotifyTsc`
would get tripped during large multi CPU trace decoding.
The root cause of this issue was an assumption that all the data of a
PSB will fit within the start,end TSC of the "owning"
`ThreadContinuousExecution`. After investigating, this is not the case
because PSBs can have multiple TSCs.
This diff works around this issue by introducing a TSC upper bound for
each `PSBBlockDecoder`. This fixes the assertion failure by simply
"dropping" the remaining data of PSB whenever the TSC upper bound is
exceeded during decoding.
Future work will do a larger refactor of the multi CPU decoding to
remove the dependencies on this incorrect assumption so that PSB blocks
that span multiple `ThreadContinuousExecutions` are correctly handled.
correctly
Test Plan:
Differential Revision: https://reviews.llvm.org/D136610
Katherine Rasmussen [Wed, 19 Oct 2022 16:16:28 +0000 (10:16 -0600)]
[flang] Add semantics tests for lock-stmt
Add three tests for lock-stmt. The first includes
standard-conforming statements, the second includes
non-standard-conforming statements because of errors where
something unexpected occurs, such as a missing lock-variable,
and the third includes non-standard-conforming statements
because of semantic errors, such as type or rank mismatches.
Reviewed By: rouson
Differential Revision: https://reviews.llvm.org/D136628
Michael Jones [Tue, 25 Oct 2022 17:10:00 +0000 (10:10 -0700)]
[libc] tighten strtofloat cutoffs
When a number for strtofloat has an exponent that's too big or small, it
doesn't need to be calculated precisely since it is guaranteed to be
either INF or 0.0. This tightens those cutoffs to improve performance.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D136699