411248 Commits

Author SHA1 Message Date
Simon Pilgrim
86bbf01d89 [llvm-profgen] CSProfileGenerator::generateLineNumBasedProfile - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr
2022-01-14 14:49:57 +00:00
David Truby
0af1808f9b
[AArch64][SVE] Fix VLS mulh tests to use literal vectors
This is a simple test fix that canonicalises the SVE mulh tests.
2022-01-14 14:21:36 +00:00
Roman Lebedev
b32077234b
[NFCI][SCEV] computeExitLimitFromCondFromBinOp(): rely on getSequentialMinMaxExpr() constant relaxation
`getSequentialMinMaxExpr()` has been taught to perform this relaxation,
so rely on that now. Not sure this can be tested.
2022-01-14 17:07:48 +03:00
Roman Lebedev
8dcba20674
[SCEV] getSequentialMinMaxExpr(): relax 2-op umin_seq w/ constant to umin
Currently, `computeExitLimitFromCondFromBinOp()` does that directly.
2022-01-14 17:07:48 +03:00
Roman Lebedev
f34742d7c1
[NFC][SCEV] Add test with umin_seq w/ 1op and constant 2022-01-14 17:07:48 +03:00
Uday Bondhugula
05f6e93938 [MLIR] NFC. affine data copy generate utility return value cleanup
Clean up return value on affineDataCopyGenerate utility. Return the
actual success/failure status instead of the "number of bytes" which
isn't being used in the codebase in any way. The success/failure status
wasn't being sent out earlier.

Differential Revision: https://reviews.llvm.org/D117209
2022-01-14 19:37:05 +05:30
Jun Zhang
8de0c1feca
[Clang] Add __builtin_reduce_or and __builtin_reduce_and
This patch implements two builtins specified in D111529.
The last __builtin_reduce_add will be seperated into another one.

Differential Revision: https://reviews.llvm.org/D116736
2022-01-14 22:05:26 +08:00
Coelacanthus
1dab5f6c83
[LLDB][NFC] Fix a typo in comment
fix typo in comment: libcstd++ -> libstdc++

Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D117288
2022-01-14 22:01:18 +08:00
Matthias Springer
1eeffcdb7a [mlir][linalg][bufferize] Support custom insertion point for buffer copies
By default, copies are inserted right before the tensor OpOperand use. With this change, `bufferize` implementation can change the insertion point. This is needed for some ops where it would be illegal to insert a copy right before the use.

Differential Revision: https://reviews.llvm.org/D117291
2022-01-14 22:47:20 +09:00
Matthias Springer
e58e401b79 [mlir][memref] Fold self copies
Fold `memref.copy %x, %x`.

Differential Revision: https://reviews.llvm.org/D117224
2022-01-14 22:44:22 +09:00
Marek Kurdej
6a4957cbdf [clang-format] Add missing test for loops formatting. NFC.
The case with an inner while loop wasn't tested before. Same for outer loop with a ForeachMacro.
2022-01-14 14:43:15 +01:00
Florian Hahn
f3c664e5de
[LoopVersioning] Add test case with foldable icmp in runtime check.
Test case showing a foldable icmp ('icmp ult i8* [[SCEVGEP1]], [[SCEVGEP1]]').
This can be simplified in a follow-up change.
2022-01-14 13:42:20 +00:00
Kadir Cetinkaya
1093b9f2e9
Revert "[clangd] Elide even more checks in SelectionTree."
This reverts commit 07f9fb8b51417ec3e6f46508e1b5ef78287b32ad.
2022-01-14 14:32:43 +01:00
Matthias Springer
40f5f3d62d [mlir][linalg][bufferize] Use memref.copy instead of linalg.copy
Differential Revision: https://reviews.llvm.org/D117220
2022-01-14 22:29:05 +09:00
Stephan Herhut
ab95ba704d [mlir][memref] Implement fast lowering of memref.copy
In the absence of maps, we can lower memref.copy to a memcpy.

Differential Revision: https://reviews.llvm.org/D116099
2022-01-14 14:22:15 +01:00
Alexey Lapshin
713c2b47a0 [DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print type dies.
This patch creates functions which might be used to dump types.
This functionality was already implemented by  DWARFTypePrinter.
Now it could be reused. It will help D96035, which uses DWARFTypePrinter.

Differential Revision: https://reviews.llvm.org/D117134
2022-01-14 16:19:08 +03:00
Matthias Springer
96acdfa0de [mlir][memref] Fold copy of cast
If the source/dest is a cast that does not change shape/element type, the cast can be skipped.

Differential Revision: https://reviews.llvm.org/D117215
2022-01-14 21:51:12 +09:00
Roman Lebedev
c86a982d7d
[SCEV] getSequentialMinMaxExpr(): rewrite deduplication to be fully recursive
Since we don't merge/expand non-sequential umin exprs into umin_seq exprs,
we may have umin_seq(umin(umin_seq())) chain, and the innermost umin_seq
can have duplicate operands still.
2022-01-14 15:42:26 +03:00
Marek Kurdej
cd3ab156a7 [clang-format] Fix typos in test. NFC. 2022-01-14 13:24:16 +01:00
Alex Bradbury
4a4a652f34 [RISCV][NFC] Use TableGen 'foreach' to simplify repetitive CSR definitions
Make the definitions of hpmcounter3-hpmcounter31,
hpmcounter3h-hpmcounter31h, mhpmcounter3-mhpmcounter31,
mhpmcounter3h-mhpmcounter31h, pmpaddr0-pmpaddr63, mhpmevent3-31, and
pmpcfg0-15 substantially less repetitive using a foreach loop.

Differential Revision: https://reviews.llvm.org/D117227
2022-01-14 11:59:39 +00:00
Alex Zinenko
bea16e72a7 [mlir] Fix invalid assertion in ModuleTranslation.cpp
LLVM dialect supports terminators with repeated successor blocks that take
different operands. This cannot be directly expressed in LLVM IR though since
it uses the number of the predecessor block to differentiate values in its PHI
nodes. Therefore, the translation to LLVM IR inserts dummy blocks to forward
arguments in case of repeated succesors with arguments. The insertion works
correctly. However, when connecting PHI nodes to their source values, the
assertion of the insertion having worked correctly was incorrect: it would only
trigger if repeated blocks were adjacent in the successor list (not guaranteed
by anything) and would not check if the successors have operands (no need for
dummy blocks in absence of operands since no PHIs are being created). Change
the assertion to only trigger in case of duplicate successors with operands,
and don't expect them to be adjacent.

Reviewed By: wsmoses

Differential Revision: https://reviews.llvm.org/D117214
2022-01-14 12:56:33 +01:00
Florian Hahn
daf06590dc
[IRBuilder] Migrate gep-folding to value-based FoldGEP.
Depends on D117038.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D117039
2022-01-14 11:24:09 +00:00
Nikita Popov
ed30a968b5 [Verifier] Avoid asserting on invalid cleanuppad chain
The invalid undef value already triggers a verifier failure, but
then the upwards scan from the cleanuppad ends up asserting. Make
sure this is handled gacefully instead.
2022-01-14 12:10:41 +01:00
Adrian Kuegel
cc79d603c9 [mlir] Use .empty() instead of checking size() == 0.
Based on a finding by ClangTidy readability-container-size-empty check.
2022-01-14 11:58:52 +01:00
Jay Foad
350bc5683d [llvm-dwp] Simplify FileCheck patterns. NFC.
Take advantage of D117117 to simplify {{\[}}[[ to [[[.
2022-01-14 10:55:01 +00:00
Jay Foad
013116cd70 Use {LITERAL} instead of regex escaping in some lit tests. NFC. 2022-01-14 10:55:00 +00:00
Muhammad Omair Javaid
3dc858f984 [LLDB] Skip TestIOHandlerPythonREPLSigint.py on Arm/Linux
TestIOHandlerPythonREPLSigint.py is failing on Arm/Linux buildbot. I am
marking it as skip for now.
2022-01-14 15:46:54 +05:00
Marek Kurdej
717cd16e85 [clang-format] Fix namespace end comments fixer with anonymous namespaces.
Previously, a strange trailing comment was produced:
```
namespace out { namespace {
}} // namespace out::
```
(mind the "out::").

Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://reviews.llvm.org/D117289
2022-01-14 11:41:14 +01:00
Florian Hahn
1ef9bfa013
[InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.
This doesn't require callers to put the pointer operand and the indices
in a container like a vector when calling the function. This is not
really an issue with the existing callers. But when using it from
IRBuilder the inputs are available as separate pointer value and indices
ArrayRef.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D117038
2022-01-14 09:59:52 +00:00
Caroline Concatto
8e5a5b619d [InstCombine] Fold for masked scatters to a uniform address
When masked scatter intrinsic does a uniform store to a destination
address from a source vector, and in this case, the mask is all one value.
This patch replaces the masked scatter with an extracted element of the
last lane of the source vector and stores it in the destination vector.
This patch also folds when the value in the masked scatter is a splat.
In this case, the mask cannot be all zero, and it folds to a scalar store
of the value in the destination pointer.

Differential Revision: https://reviews.llvm.org/D115724
2022-01-14 09:44:34 +00:00
Nikita Popov
20d9c51dc0 [ConstantFold] Check for uniform value before reinterpret load
The reinterpret load code will convert undef values into zero.
Check the uniform value case before it to produce a better result
for all-undef initializers.

However, the uniform value handling will return the uniform value
even if the access is out of bounds, while the reinterpret load
code will return undef. Add an explicit check to retain the
previous result in this case.
2022-01-14 10:18:02 +01:00
Nikita Popov
e7ce6acc83 [InstSimplify] Add test for load from undef (NFC)
If we're loading from an all-undef value, we sometimes still
return zero rather than undef.
2022-01-14 10:18:02 +01:00
Nikita Popov
be219323a2 [GlobalOpt] Add test for SRA with i8 array type (NFC) 2022-01-14 10:18:02 +01:00
Fangrui Song
8dbc6a23bb [CMake] Do not override user specified CMAKE_{C,CXX}_ARCHIVE_FINISH on Linux
Respect the user choice, e.g. -DCMAKE_CXX_ARCHIVE_FINISH=: (to skip the
(usually) no-op step).
2022-01-14 01:10:24 -08:00
Sam McCall
bba729af3e [clang-check] Adjust argument adjusters for clang-check to strip options blocking the static analyzer
Output generation options (like `-save-temps`) will make the analyzer not executed even `--analyze` option is provided in the driver arguments.
Besides, the original approach of adding `--analyze` option will not work when (more than one) `-fsyntax-only` options are provided in the driver arguments.

This patch fixes these two problems by using the syntax-only adjuster to remove output generation options and manually filter out redundant `-fsyntax-only` options.

In the new implementation, the adjusters added by `ClangTool` will not be removed but used as dependencies for clang-check adjusters for analyzer options.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D116329
2022-01-14 10:05:47 +01:00
Zi Xuan Wu
263d1986e3 [NFC][CSKY] Remove duplicate setOperationAction in CSKYTargetLowering constructor 2022-01-14 17:01:43 +08:00
Kevin Athey
a0458b531c Add -fsanitize-address-param-retval to clang.
With the introduction of this flag, it is no longer necessary to enable noundef analysis with 4 separate flags.
(-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1).
This change only covers the introduction into the compiler.

This is a follow up to: https://reviews.llvm.org/D116855

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D116633
2022-01-14 00:41:28 -08:00
Marek Kurdej
3cf86c3611 Revert unrelated change from: [clang-format] Fix break being added to macro define with ColumnLimit: 0 2022-01-14 08:43:59 +01:00
Armen Khachkinaev
47a9eb2117 [clang-format] Fix break being added to macro define with ColumnLimit: 0
Fix for #[[ https://github.com/llvm/llvm-project/issues/49164 | 49164 ]] issue.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D116859
2022-01-14 08:42:22 +01:00
Chuanqi Xu
4f4340ee2a [NFC] [Coroutines] Refactor implementation in checkFinalSuspendNoThrow
Now when we are checking if the expression `co_await
promise.final_suspend()` is not throw, we would check unconditionally
for its child expressions recursively. It takes unnecessary time. And
the compiler would complains if the implementation in final_suspend()
may throw even if the higher level function signature marked noexcept
already.

This fixes bug48453 too.
2022-01-14 15:37:01 +08:00
Mehdi Amini
8d20d83dd7 Fix a comment in CMake (NFC) 2022-01-14 07:33:06 +00:00
Mehdi Amini
46b1e83716 Do not build llc and mlir-cpu-runner to run MLIR tests with the native target isn't configured (NFC)
The relevant tests are already disabled in this case.
2022-01-14 07:30:34 +00:00
Alexander Belyaev
436d17a8e9 [mlir] Expose a function to get vector::CombiningKind from Operation*.
Differential Revision: https://reviews.llvm.org/D117283
2022-01-14 08:28:18 +01:00
Mehdi Amini
5a68a85d85 Mark some MLIR tests as requiring the native target to be configured
This makes `ninja check-mlir` work without the host targets configured.
2022-01-14 07:23:14 +00:00
Bryce Wilson
28b6e2cb3d
[Attributor] [NFC] Use canonical variable name
Differential Revision: https://reviews.llvm.org/D117241
2022-01-13 23:06:00 -08:00
Amir Ayupov
d914486a9a [BOLT][NFC] Refactor reset-release to move assignment
Summary:
Follow the clang-tidy suggestion to replace reset-release with move assignment.

Move assignment's effect for unique_ptr:
> Effects: Transfers ownership from `u` to `*this` as if by calling `reset(u.release())`
followed by an assignment from `std::forward<D>(u.get_deleter())`.
2022-01-13 22:47:15 -08:00
Amir Ayupov
18bc405a09 [BOLT][NFC] Remove uses of std::vector<bool>
Summary:
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>`
and suggests `llvm::BitVector` as a possible replacement.
2022-01-13 22:46:34 -08:00
Mehdi Amini
dc9f18da86 Partially revert cac7aabbd82: some APIs don't have in-tree users and some build breaks weren't caught 2022-01-14 06:16:38 +00:00
Stella Laurenzo
b93eded7b9 [bazel] Separate capi_deps from deps in mlir_c_api_cc_library.
This is important because *Objects targets need to only depend on other *Objects targets, not on the unsuffixed CAPI rules. Depending on how it is linked in the current setup, it can cause duplicate symbols.

Differential Revision: https://reviews.llvm.org/D117176
2022-01-14 06:08:01 +00:00
jacquesguan
88c0e0806b [RISCV] Improve i64 splat vector lowering in RV32.
We could use vmv.v.i/vmv.v.x whose eew is 32 to lower the i64 splat vector if the i64 constant scalar could be splitted into two same i32 scalar.

Differential Revision: https://reviews.llvm.org/D117079
2022-01-14 14:06:01 +08:00