Timm Bäder [Wed, 5 Jul 2023 06:52:08 +0000 (08:52 +0200)]
[clang][Interp][NFC] Fix a doc comment
Timm Bäder [Tue, 4 Jul 2023 18:32:17 +0000 (20:32 +0200)]
[clang][Interp][NFC] Add Descriptor::isCompositeArray()
Unused for now, but will be used in later commits.
Balazs Benics [Wed, 5 Jul 2023 06:56:13 +0000 (08:56 +0200)]
[analyzer][NFC] Move away from using raw-for loops inside StaticAnalyzer
I'm involved with the Static Analyzer for the most part.
I think we should embrace newer language standard features and gradually
move forward.
Differential Revision: https://reviews.llvm.org/D154325
Timm Bäder [Tue, 4 Jul 2023 18:31:07 +0000 (20:31 +0200)]
[clang][NFC] Move two declarations closer to their point of use
Matthias Springer [Wed, 5 Jul 2023 06:34:03 +0000 (08:34 +0200)]
[mlir][linalg] Do not emit FillOp for tensor.pad with zero padding
No need to fill the buffer if no padding is added. I.e., the tensor.pad is packing only.
Differential Revision: https://reviews.llvm.org/D153874
esmeyi [Wed, 5 Jul 2023 05:58:18 +0000 (01:58 -0400)]
[XCOFF] Force recording a relocation for weak symbol label.
Summary: Currently, if there are multiple definitions of the same symbol declared has weak linkage, the linker may choose the wrong one when they are compiled with integrated-as. This patch fixes the issue. If the target symbol is a weak label we must not attempt to resolve the fixup directly. Emit a relocation and leave resolution of the final target address to the linker.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D153839
Tomasz Kamiński [Tue, 4 Jul 2023 14:54:54 +0000 (16:54 +0200)]
[analyzer] Differentiate lifetime extended temporaries
This patch introduces a new `CXXLifetimeExtendedObjectRegion` as a representation
of the memory for the temporary object that is lifetime extended by the reference
to which they are bound.
This separation provides an ability to detect the use of dangling pointers
(either binding or dereference) in a robust manner.
For example, the `ref` is conditionally dangling in the following example:
```
template<typename T>
T const& select(bool cond, T const& t, T const& u) { return cond ? t : u; }
int const& le = Composite{}.x;
auto&& ref = select(cond, le, 10);
```
Before the change, regardless of the value of `cond`, the `select()` call would
have returned a `temp_object` region.
With the proposed change we would produce a (non-dangling) `lifetime_extended_object`
region with lifetime bound to `le` or a `temp_object` region for the dangling case.
We believe that such separation is desired, as such lifetime extended temporaries
are closer to the variables. For example, they may have a static storage duration
(this patch removes a static temporary region, which was an abomination).
We also think that alternative approaches are not viable.
While for some cases it may be possible to determine if the region is lifetime
extended by searching the parents of the initializer expr, this quickly becomes
complex in the presence of the conditions operators like this one:
```
Composite cc;
// Ternary produces prvalue 'int' which is extended, as branches differ in value category
auto&& x = cond ? Composite{}.x : cc.x;
// Ternary produces xvalue, and extends the Composite object
auto&& y = cond ? Composite{}.x : std::move(cc).x;
```
Finally, the lifetime of the `CXXLifetimeExtendedObjectRegion` is tied to the lifetime of
the corresponding variables, however, the "liveness" (or reachability) of the extending
variable does not imply the reachability of all symbols in the region.
In conclusion `CXXLifetimeExtendedObjectRegion`, in contrast to `VarRegions`, does not
need any special handling in `SymReaper`.
RFC: https://discourse.llvm.org/t/rfc-detecting-uses-of-dangling-references/70731
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D151325
Rahul Kayaith [Sun, 7 May 2023 23:28:46 +0000 (19:28 -0400)]
[mlir][TestDialect] Fix invalid custom op printers
This fixes a few custom printers which were printing IR that couldn't be
round-tripped.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D150080
Joseph Huber [Wed, 5 Jul 2023 03:01:03 +0000 (22:01 -0500)]
[Libomptarget][Obvious] Missing comma on enum
Joseph Huber [Wed, 5 Jul 2023 02:55:49 +0000 (21:55 -0500)]
[Libomptarget] Add missing HSA agent info enumeration
Summary:
This was not added to dynamic_hsa.h
Joseph Huber [Tue, 4 Jul 2023 17:31:28 +0000 (12:31 -0500)]
[Libomptarget] Correctly implement `getWTime` on AMDGPU
AMDGPU provides a fixed frequency clock since some generations back.
However, the frequency is variable by card and must be looked up at
runtime. This patch adds a new device environment line for the clock
frequency so that we can use it in the same way as NVPTX. This is the
correct implementation and the version in ASO should be replaced.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D154456
Craig Topper [Wed, 5 Jul 2023 01:58:32 +0000 (18:58 -0700)]
[RISCV] Fix 80 column violations in RISCVInstrInfoXCV.td. NFC
Craig Topper [Wed, 5 Jul 2023 01:52:31 +0000 (18:52 -0700)]
[RISCV] Rename RVInstBitManipRII->CVInstBitManipRII since it belongs to XVendorCV. NFC
This is consistent with the other classes in this file.
It avoids a possible name conflict with standard extensions or
other vendors in the future.
Yeting Kuo [Mon, 12 Jun 2023 13:32:18 +0000 (21:32 +0800)]
[ASAN] Support memeory check for masked.gather/scatter.
The patch handle masked.gather/scatter just like the way D149245 handles
vp.gather/scatter.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151545
Blue Gaston [Mon, 26 Jun 2023 17:28:16 +0000 (10:28 -0700)]
[ASanAbi][Darwin] Build ios stable ABI library
In the initially commit, we limited the static archive to osx.
This patch removes that limitation.
Differential Revision: https://reviews.llvm.org/D153789
Sergei Barannikov [Tue, 4 Jul 2023 21:00:07 +0000 (00:00 +0300)]
[MC/AsmParser] Remove no-op overrides of parseDirective (NFC)
Remove overrides of parseDirective that unconditionally return NoMatch.
This is what the base implementation does.
This is a follow-up to D154101 based on post-commit review feedback.
Thomas Preud'homme [Thu, 29 Jun 2023 21:44:24 +0000 (22:44 +0100)]
[FileCheck, 2/4] NFC: Switch to APInt getter for ExpressionValue
Use an APInt getter as the only interface to getting the value out of an
ExpressionValue. This paves the way to switch ExpressionValue to handle
any integer without causing too big of a patch.
Reviewed By: arichardson
Differential Revision: https://reviews.llvm.org/D154429
Thomas Preud'homme [Wed, 28 Jun 2023 21:53:56 +0000 (22:53 +0100)]
[FileCheck, 1/4] NFC: Switch ExpressionValue to APInt
Use APInt internally to store values represented by ExpressionValue.
This will allow to support any integer values in FileCheck numeric
expression in a subsequent commit.
Reviewed By: arichardson
Differential Revision: https://reviews.llvm.org/D154428
Florian Hahn [Tue, 4 Jul 2023 20:28:02 +0000 (21:28 +0100)]
[LV] Forget SCEVs for exit phis after vectorization.
After vectorization, the exit blocks of the original loop will have additional
predecessors. Invalidate SCEVs for the exit phis in case SE looked through
single-entry phis.
Fixes https://github.com/llvm/llvm-project/issues/63368
Fixes https://github.com/llvm/llvm-project/issues/63669
Sergei Barannikov [Sat, 1 Jul 2023 22:51:17 +0000 (01:51 +0300)]
[RISCV] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154291
Sergei Barannikov [Sun, 2 Jul 2023 01:58:52 +0000 (04:58 +0300)]
[AMDGPU] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: kosarev
Differential Revision: https://reviews.llvm.org/D154293
Sergei Barannikov [Mon, 3 Jul 2023 03:45:13 +0000 (06:45 +0300)]
[LoongArch] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: xen0n
Differential Revision: https://reviews.llvm.org/D154318
Sergei Barannikov [Mon, 3 Jul 2023 03:06:35 +0000 (06:06 +0300)]
[CSKY] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: zixuan-wu
Differential Revision: https://reviews.llvm.org/D154315
Sergei Barannikov [Mon, 3 Jul 2023 04:21:53 +0000 (07:21 +0300)]
[M68k] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: myhsu
Differential Revision: https://reviews.llvm.org/D154320
Lei Huang [Tue, 4 Jul 2023 17:43:52 +0000 (13:43 -0400)]
[PowerPC] Add DFP quantum adjustment instruction definitions and MC tests
Add td definitions and asm/disasm tests for the quantum adjustment
instructions in ISA 3.1 section 5.6.4
Reviewed By: stefanp
Differential Revision: https://reviews.llvm.org/D154369
Sergei Barannikov [Sun, 2 Jul 2023 15:58:26 +0000 (18:58 +0300)]
[MC] Use ParseStatus in generated AsmParser methods
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: kosarev
Differential Revision: https://reviews.llvm.org/D154303
Dmitry Ilvokhin [Tue, 4 Jul 2023 18:58:40 +0000 (20:58 +0200)]
Use hash value checks optimizations consistently
There are couple of optimizations of `__hash_table::find` which are applicable
to other places like `__hash_table::__node_insert_unique_prepare` and
`__hash_table::__emplace_unique_key_args`.
```
for (__nd = __nd->__next_; __nd != nullptr &&
(__nd->__hash() == __hash
// ^^^^^^^^^^^^^^^^^^^^^^
// (1)
|| std::__constrain_hash(__nd->__hash(), __bc) == __chash);
__nd = __nd->__next_)
{
if ((__nd->__hash() == __hash)
// ^^^^^^^^^^^^^^^^^^^^^^^^^^
// (2)
&& key_eq()(__nd->__upcast()->__value_, __k))
return iterator(__nd, this);
}
```
(1): We can avoid expensive modulo operations from `std::__constrain_hash` if
hashes matched. This one is from commit
6a411472e3c4.
(2): We can avoid `key_eq` calls if hashes didn't match. Commit:
318d35a7bca6c4e5.
Both of them are applicable for insert and emplace methods.
Results of unordered_set_operations benchmark:
```
Comparing /tmp/main to /tmp/hashtable-hash-value-optimization
Benchmark Time CPU Time Old Time New CPU Old CPU New
------------------------------------------------------------------------------------------------------------------------------------------------------
BM_Hash/uint32_random_std_hash/1024 -0.0127 -0.0127 1511 1492 1508 1489
BM_Hash/uint32_random_custom_hash/1024 +0.0012 +0.0013 1370 1371 1367 1369
BM_Hash/uint32_top_std_hash/1024 -0.0027 -0.0028 1502 1497 1498 1494
BM_Hash/uint32_top_custom_hash/1024 +0.0033 +0.0032 1368 1373 1365 1370
BM_InsertValue/unordered_set_uint32/1024 +0.0267 +0.0266 36421 37392 36350 37318
BM_InsertValue/unordered_set_uint32_sorted/1024 +0.0230 +0.0229 28247 28897 28193 28837
BM_InsertValue/unordered_set_top_bits_uint32/1024 +0.0492 +0.0491 31012 32539 30952 32472
BM_InsertValueRehash/unordered_set_top_bits_uint32/1024 +0.0523 +0.0520 62905 66197 62780 66043
BM_InsertValue/unordered_set_string/1024 -0.0252 -0.0253 300762 293189 299805 292221
BM_InsertValueRehash/unordered_set_string/1024 -0.0932 -0.0920 332924 301882 331276 300810
BM_InsertValue/unordered_set_prefixed_string/1024 -0.0578 -0.0577 314239 296072 313222 295137
BM_InsertValueRehash/unordered_set_prefixed_string/1024 -0.0986 -0.0985 336091 302950 334982 301995
BM_Find/unordered_set_random_uint64/1024 -0.1416 -0.1417 16075 13798 16041 13769
BM_FindRehash/unordered_set_random_uint64/1024 -0.0105 -0.0105 5900 5838 5889 5827
BM_Find/unordered_set_sorted_uint64/1024 +0.0014 +0.0014 2813 2817 2807 2811
BM_FindRehash/unordered_set_sorted_uint64/1024 -0.0247 -0.0249 5863 5718 5851 5706
BM_Find/unordered_set_sorted_uint128/1024 +0.0113 +0.0112 15570 15746 15539 15713
BM_FindRehash/unordered_set_sorted_uint128/1024 +0.0438 +0.0441 6917 7220 6902 7206
BM_Find/unordered_set_sorted_uint32/1024 -0.0020 -0.0020 3098 3091 3092 3085
BM_FindRehash/unordered_set_sorted_uint32/1024 +0.0570 +0.0569 5377 5684 5368 5673
BM_Find/unordered_set_sorted_large_uint64/1024 +0.0081 +0.0081 3594 3623 3587 3616
BM_FindRehash/unordered_set_sorted_large_uint64/1024 -0.0542 -0.0540 6154 5820 6140 5808
BM_Find/unordered_set_top_bits_uint64/1024 -0.0061 -0.0061 10440 10377 10417 10353
BM_FindRehash/unordered_set_top_bits_uint64/1024 +0.0131 +0.0128 5852 5928 5840 5914
BM_Find/unordered_set_string/1024 -0.0352 -0.0349 189037 182384 188389 181809
BM_FindRehash/unordered_set_string/1024 -0.0309 -0.0311 180718 175142 180141 174532
BM_Find/unordered_set_prefixed_string/1024 -0.0559 -0.0557 190853 180177 190251 179659
BM_FindRehash/unordered_set_prefixed_string/1024 -0.0563 -0.0561 182396 172136 181797 171602
BM_Rehash/unordered_set_string_arg/1024 -0.0244 -0.0241 27052 26393 26989 26339
BM_Rehash/unordered_set_int_arg/1024 -0.0410 -0.0410 19582 18779 19539 18738
BM_InsertDuplicate/unordered_set_int/1024 +0.0023 +0.0025 12168 12196 12142 12173
BM_InsertDuplicate/unordered_set_string/1024 -0.0505 -0.0504 189238 179683 188648 179133
BM_InsertDuplicate/unordered_set_prefixed_string/1024 -0.0989 -0.0987 198893 179222 198263 178702
BM_EmplaceDuplicate/unordered_set_int/1024 -0.0175 -0.0173 12674 12452 12646 12427
BM_EmplaceDuplicate/unordered_set_string/1024 -0.0559 -0.0557 190104 179481 189492 178934
BM_EmplaceDuplicate/unordered_set_prefixed_string/1024 -0.1111 -0.1110 201233 178870 200608 178341
BM_InsertDuplicate/unordered_set_int_insert_arg/1024 -0.0747 -0.0745 12993 12022 12964 11997
BM_InsertDuplicate/unordered_set_string_insert_arg/1024 -0.0584 -0.0583 191489 180311 190864 179731
BM_EmplaceDuplicate/unordered_set_int_insert_arg/1024 -0.0807 -0.0804 35946 33047 35866 32982
BM_EmplaceDuplicate/unordered_set_string_arg/1024 -0.0312 -0.0310 321623 311601 320559 310637
OVERALL_GEOMEAN -0.0276 -0.0275 0 0 0 0
```
Time differences looks more like noise to me. But if we want to have this
optimizations in `find`, we probably want them in `insert` and `emplace` as
well.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D140779
Edoardo Sanguineti [Tue, 4 Jul 2023 18:42:44 +0000 (20:42 +0200)]
[libc++] Use this in lamba capture in <latch>
"&" seemed to be used in a situation where perhaps it's not the best option.
Other libc++ modules make use of [this] when calling functions from the same class.
[this] would be the appropriate lambda capture specifier to use in this situation.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D154358
Piotr Fusik [Tue, 4 Jul 2023 17:37:32 +0000 (19:37 +0200)]
[NFC][libc++] Fix whitespace in sstream
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D154455
Marius Brehler [Tue, 4 Jul 2023 16:25:05 +0000 (18:25 +0200)]
[mlir][emitc][nfc] Update summary of opaque type
With this patch error messages are improved. So far, error messages like
`operand #0 must An opaque type` can be generated.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D154453
Louis Dionne [Mon, 3 Jul 2023 20:55:30 +0000 (16:55 -0400)]
[libc++] Avoid including things that require a filesystem in filesytem_clock.cpp
The filesystem clock implementation should be available regardless of
whether a proper filesystem is available on the platform, so it makes
sense to try and avoid including things that are inherently filesystem-y
in the implementation of filesystem clock.
Differential Revision: https://reviews.llvm.org/D154390
David Green [Tue, 4 Jul 2023 17:13:10 +0000 (18:13 +0100)]
[TTI][AArch64] Add basic vector_reduce_fmaximum/vector_reduce_fminimum costmodelling
This adds some basic handling in TargetTransformInfo to treat
vector_reduce_fminimum/vector_reduce_fmaximum similar to
vector_reduce_fmax/vector_reduce_fmax, getting better costs via
getMinMaxReductionCost.
Differential Revision: https://reviews.llvm.org/D153548
Joseph Huber [Tue, 4 Jul 2023 16:05:17 +0000 (11:05 -0500)]
[libc] Remove flaky static assert from RPC interface
Summary:
This function is intended to only be used on the GPU as a shorthand. The
static assert should only fire if it's called ,but it seems that its
precence can sometimes cause issues and other times not. Simply remove
it as it's causing build problems.
Timm Bäder [Mon, 3 Jul 2023 10:43:20 +0000 (12:43 +0200)]
[clang][Interp][NFC] Move CastFP to Interp.h
It's not a Check* function, so try to stay consistent and move this to
the header.
Timm Bäder [Fri, 30 Jun 2023 06:26:36 +0000 (08:26 +0200)]
[clang][Interp][NFC] Return integer from Boolean::bitWidth()
Timm Bäder [Thu, 11 May 2023 12:44:39 +0000 (14:44 +0200)]
[clang][Interp][NFC] Fix GetFnPtr signature
Louis Dionne [Tue, 4 Jul 2023 15:25:15 +0000 (11:25 -0400)]
[libc++][NFC] Sort list of attribute macros in the .clang-format file
Timm Bäder [Tue, 2 May 2023 09:21:11 +0000 (11:21 +0200)]
[clang][Interp][NFC] Return a const pointer from Pointer::getRecord()
Louis Dionne [Tue, 4 Jul 2023 15:21:21 +0000 (11:21 -0400)]
Add clang-format commit to git blame ignore revs
Louis Dionne [Tue, 4 Jul 2023 15:19:10 +0000 (11:19 -0400)]
[libc++][NFC] clang-format <shared_mutex>
I am about to touch several lines in that file for a patch anyway, so
I might as well clang-format it upfront to avoid mixing styles after
my patch.
Markus Böck [Tue, 4 Jul 2023 15:04:47 +0000 (17:04 +0200)]
[mlir][LLVM] drop `llvm.intr.dbg.value` when promoting in `SROA` or `mem2reg`
This has previously been done for `llvm.intr.dbg.declare`, which is a common occurrence when the debug info points to the variable through the pointer, but may also occur when the `alloca` itself is a local variable in debug info.
Not doing so prevents `SROA` and `mem2reg` from promoting e.g. an `alloca`. We simply drop the value completetly, since there is no meaninful debug info that can be constructed instead as the pointer value is removed.
Differential Revision: https://reviews.llvm.org/D154451
Anna Thomas [Tue, 4 Jul 2023 14:59:02 +0000 (10:59 -0400)]
[MetaRenamer] Rename only unnamed instructions in mode renaming instructions
6f9e743b91ad6ac1f333c introduced a mode which renames only instructions in
the function. This change updates that mode to skip instructions that are already named.
This serves the original purpose of the mode (rename-only-inst) which is:
1. Modify IR without failing verifier with serially ordered number
requirement (%1, %2, %3 required in order).
2. Give meaningful names to instructions.
Amaury Séchet [Tue, 4 Jul 2023 14:22:32 +0000 (14:22 +0000)]
[NFC] Reorder functions in DAGCombiner so all UADDO_CARRY related functions are next to each others.
Matthias Springer [Tue, 4 Jul 2023 14:45:59 +0000 (16:45 +0200)]
[mlir][linalg] Add test case: vectorize tensor.pad and bufferize to allocation
Add a test case that first vectorizes a `tensor.pad` op, then bufferizes it to a new allocation with a specified memory space.
Differential Revision: https://reviews.llvm.org/D154082
Lei Huang [Tue, 4 Jul 2023 14:36:32 +0000 (10:36 -0400)]
[PowerPC] add testcase for vector add and shift
Matthias Springer [Tue, 4 Jul 2023 14:36:00 +0000 (16:36 +0200)]
[mlir][linalg] BufferizeToAllocationOp: Do not copy uninitialized buffers
Tensors/buffers that do not have any defined contents (e.g., `tensor.empty`) are no longer copied.
Differential Revision: https://reviews.llvm.org/D154081
Matthias Springer [Tue, 4 Jul 2023 12:56:40 +0000 (14:56 +0200)]
[mlir][transform] Improve transform.get_closest_isolated_parent
* Rename op to `transform.get_parent_op`
* Match parents by "is isolated from above" and/or op name, or just the direct parent.
* Deduplication of result payload ops is optional.
Differential Revision: https://reviews.llvm.org/D154071
Timm Bäder [Mon, 19 Jun 2023 07:15:04 +0000 (09:15 +0200)]
[clang][Interp][NFC] Return std::nullopt explicitly
Timm Bäder [Mon, 19 Jun 2023 06:57:50 +0000 (08:57 +0200)]
[clang][Interp][NFC] Add some missing const qualifiers
Timm Bäder [Mon, 19 Jun 2023 06:45:07 +0000 (08:45 +0200)]
[clang][Interp][NFC] Merge two if statements
Kadir Cetinkaya [Tue, 4 Jul 2023 13:50:47 +0000 (15:50 +0200)]
[clangd] Downgrade deprecated warnings to hints
This tries to improve adoption of noisy warnings in existing codebases.
Hints have a lot less visual clutter in most of the editors, and DiagnosticTags
already imply a custom decorations per LSP.
Differential Revision: https://reviews.llvm.org/D154443
Christian Ulmann [Tue, 4 Jul 2023 12:45:35 +0000 (12:45 +0000)]
[mlir][LLVM] Stop importing module location for all unknown locs
This commit changes the LLVM IR import to use UnkownLoc for missing
debug locations. This change ensures that we do not accidentially
introduce faulty locations that can influence debugging post export.
This behavior change is not applied to locations of global metadata
operations, as their location will not be exported.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D154416
David Green [Tue, 4 Jul 2023 14:02:30 +0000 (15:02 +0100)]
[CostModel] Use min/max intrinsics for vecreduce.min/max costs
This changes the costmodelling of the vecreduce.min/max nodes to use the costs
of the relevant min/max intrinsics instead of expanding them to compare and
selects. The getMinMaxReductionCost have changed to take a Opcode for the
relevant intrinsic, dropping the IsUnsigned and CondTy parameters as they are
no longer needed.
A follow up patch will add some basic fminimum/fmaximum costmodelling.
Differential Revision: https://reviews.llvm.org/D153547
Stephen Thomas [Tue, 4 Jul 2023 10:43:09 +0000 (11:43 +0100)]
[AMDGPU] Fix incorrect hazard mitigation
GCNHazardRecognizer::fixVcmpxExecWARHazard() mitigates a specific hazard
by inserting a wait on sa_sdst==0 if such a wait isn't already present.
Unfortunately, the check for an existing wait incorrectly checks for one
that doesn't actually care about sa_sdst itself, but requires that no
other counters are waited for.
Once the check is performed correctly, a lit test needs to be updated,
since it is currently testing for the incorrect behaviour.
Differential Revision: https://reviews.llvm.org/D154438
Hans Wennborg [Tue, 4 Jul 2023 08:46:07 +0000 (10:46 +0200)]
[libc++] Disable tree invariant check in asserts mode
This is a follow-up to D153672 which removed the old debug mode and
moved many of those checks to the regular asserts mode.
The tree invariant check is too expensive for the regular asserts mode,
making element removal O(n) instead of O(log n), so disable it until
there is a new debug assert category it can be put in.
Differential revision: https://reviews.llvm.org/D154417
Aleksandr Popov [Mon, 3 Jul 2023 08:07:57 +0000 (10:07 +0200)]
[NFC][IRCE] Extract 'IV vs Limit' parsing to a separate method
Next step of the preparatory refactoring for the upcoming support of new
new range check form to parse.
This change isolates logic of 'IV vs Limit' range check parsing to
simplify adding parsers for new range checks forms.
Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D154160
LLVM GN Syncbot [Tue, 4 Jul 2023 13:10:45 +0000 (13:10 +0000)]
[gn build] Port
7a72ce98224b
Tom Weaver [Tue, 4 Jul 2023 13:05:54 +0000 (14:05 +0100)]
Revert "[dataflow] Add dedicated representation of boolean formulas"
This reverts commit
2fd614efc1bb9c27f1bc6c3096c60a7fe121e274.
Commit caused failures on the following two build bots:
http://45.33.8.238/win/80815/step_7.txt
https://lab.llvm.org/buildbot/#/builders/139/builds/44269
Aleksandr Popov [Mon, 3 Jul 2023 04:48:13 +0000 (06:48 +0200)]
[NFC][IRCE] Check that Index is AddRec in the parseRangeCheckICmp
Next step of the preparatory refactoring for the upcoming support of
new range check form to parse.
Previous one: https://reviews.llvm.org/D154156
With this change we avoid meaningless parsing after realizing that Index
is not AddRec
Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D154158
Florian Hahn [Tue, 4 Jul 2023 13:01:05 +0000 (14:01 +0100)]
[LV] Regenerate check lines to reduced diff.
Regenerate checks to avoid unnecessary changes in D154264.
Joseph Huber [Tue, 4 Jul 2023 12:59:11 +0000 (07:59 -0500)]
[Libomptarget] Fix misused macro name preventing printing of library name
Summary:
This code used `LIBOMPTARGET_DEBUG` which is not the macro name, but the
environment variable. This caused this portion to always be disabled. In
the long run we should aim for this to always be availible as it's
useful for other diagnostic message.
Matthias Springer [Tue, 4 Jul 2023 12:48:56 +0000 (14:48 +0200)]
[mlir][linalg] BufferizeToAllocationOp: Support vector.mask
This op needs special handling because the allocation for the masked op must be placed outside of the mask op.
Differential Revision: https://reviews.llvm.org/D154058
Matthias Springer [Tue, 4 Jul 2023 12:40:49 +0000 (14:40 +0200)]
[mlir][linalg] BufferizeToAllocation: Bufferize non-allocating ops
Until now, only `tensor.pad` ops could be bufferized to an allocation. This revision adds support for all bufferizable ops that do not already bufferize to an allocation. (Those still need special handling.)
Differential Revision: https://reviews.llvm.org/D153971
Martin Braenne [Tue, 4 Jul 2023 12:14:17 +0000 (12:14 +0000)]
[clang][dataflow] Make `runDataflowReturnError()` a non-template function.
It turns out this didn't need to be a template at all.
Likewise, change callers to they're non-template functions.
Also, correct / clarify some comments in RecordOps.h.
This is in response to post-commit comments on https://reviews.llvm.org/D153006.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D154339
Matthias Springer [Tue, 4 Jul 2023 12:34:00 +0000 (14:34 +0200)]
[mlir][linalg] BufferizeToAllocationOp: Bufferize ops, not values
The `bufferize_to_allocation` transform op now operates on payload ops, not payload values. Only ops can be bufferized, not values.
Also remove the `replacement` result from the transform op.
Differential Revision: https://reviews.llvm.org/D153970
Haojian Wu [Tue, 4 Jul 2023 11:16:05 +0000 (13:16 +0200)]
[clang-tidy] Don't emit the whole spelling include header in include-cleaner diagnostic message
To keep the message short and consistent with clangd, and the diagnostics are
attached to the #include line, users have enough context to understand the whole #include.
Differential Revision: https://reviews.llvm.org/D154434
Alex Bradbury [Tue, 4 Jul 2023 12:28:12 +0000 (13:28 +0100)]
[RISCV][NFC] Fix doc comment for RISCVDAGToDAGISel::selectSETCC
The doc comment referred to a boolean parameter that has since been
replaced with an ISD::CondCode.
Matthias Springer [Tue, 4 Jul 2023 12:18:32 +0000 (14:18 +0200)]
[mlir][linalg] Return tensor::PadOp handle from transform op
"transform.structured.pad" now returns all `tensor::PadOp` in addition to the padded ops.
Also add a test case that shows how to force an allocation for "tensor.pad" ops with a custom memory space.
Differential Revision: https://reviews.llvm.org/D153555
Matthias Springer [Tue, 4 Jul 2023 12:03:02 +0000 (14:03 +0200)]
[mlir][NFC] Use `getConstantIntValue` instead of casting to `ConstantIndexOp`
`getConstantIntValue` extracts constant values from all constant-like ops, not just `arith::ConstantIndexOp`.
Differential Revision: https://reviews.llvm.org/D154356
Martin Braenne [Tue, 4 Jul 2023 10:41:05 +0000 (10:41 +0000)]
[clang][dataflow] Add a test for a struct that is directly self-referential through a reference.
The ongoing migration to strict handling of value
categories (see https://discourse.llvm.org/t/70086) will change the way we
handle fields of reference type, and I want to put a test in place that makes
sure we continue to handle this special case correctly.
Depends On D154420
Reviewed By: gribozavr2, xazax.hun
Differential Revision: https://reviews.llvm.org/D154421
Martin Braenne [Tue, 4 Jul 2023 10:40:19 +0000 (10:40 +0000)]
[clang][dataflow] Model variables / fields / funcs used in default initializers.
The newly added test fails without the other changes in this patch.
Reviewed By: sammccall, gribozavr2
Differential Revision: https://reviews.llvm.org/D154420
Quentin Colombet [Mon, 3 Jul 2023 16:19:00 +0000 (18:19 +0200)]
[mlir][arith] Move getNeutralElement from Linalg utils to arith
This consolidates where this kind of implementations lives and
refactor the code to have more code sharing.
NFC
Differential Revision: https://reviews.llvm.org/D154362
Benjamin Kramer [Tue, 4 Jul 2023 11:34:03 +0000 (13:34 +0200)]
Jay Foad [Wed, 21 Jun 2023 20:16:08 +0000 (21:16 +0100)]
[AMDGPU] Do not wait for vscnt on function entry and return
SIInsertWaitcnts inserts waitcnt instructions to resolve data
dependencies. The GFX10+ vscnt (VMEM store count) counter is never used
in this way. It is only used to resolve memory dependencies, and that is
handled by SIMemoryLegalizer. Hence there is no need to conservatively
wait for vscnt to be 0 on function entry and before returns.
Differential Revision: https://reviews.llvm.org/D153537
Alexey Lapshin [Sat, 1 Jul 2023 10:20:50 +0000 (12:20 +0200)]
[DWARFLinker][NFC] Remove RangesTy &getValidAddressRanges().
This patch simplifies line table generation. It removes global
array of all units ranges(RangesTy &getValidAddressRanges()).
The comment says that global array of all units ranges is necessary
to handle corner cases inside line table rows. Removing that
special handling shows that its current usage is handling of
"end of range case" which is already handled correctly
(without special handling). .debug_line tables for clang binary
built with and without this patch are equal.
Differential Revision: https://reviews.llvm.org/D154288
Jan Svoboda [Tue, 4 Jul 2023 10:33:56 +0000 (12:33 +0200)]
[clang][modules] Mark fewer identifiers as out-of-date
In `clang-scan-deps` contexts, the number of interesting identifiers in PCM files is fairly low (only macros), while the number of identifiers in the importing instance is high (builtins). Marking the whole identifier table out-of-date triggers lots of benign and expensive calls to `ASTReader::updateOutOfDateIdentifiers()`. (That unfortunately happens even for unused identifiers due to `SemaRef.IdResolver.begin(II)` line in `ASTWriter::WriteASTCore()`.)
This patch makes the main code path more similar to C++ modules, where the PCM files have `INTERESTING_IDENTIFIERS` section which lists identifiers that get created in the identifier table of the importing instance and marked as out-of-date. The only difference is that the main code path doesn't *create* identifiers in the table and relies on the importing instance calling `ASTReader::get()` when creating new identifier on-demand. It only marks existing identifiers as out-of-date.
This speeds up `clang-scan-deps` by 5-10%.
Reviewed By: Bigcheese, benlangmuir
Differential Revision: https://reviews.llvm.org/D151277
Florian Hahn [Tue, 4 Jul 2023 10:56:50 +0000 (11:56 +0100)]
[LSR] Move normalization check to normalizeForPostIncUse.
Move the logic added in
3a57152d85e1 to normalizeForPostIncUse to catch
additional un-invertable cases. This fixes another mis-compile pointed
out by @peixin in D153004.
LLVM GN Syncbot [Tue, 4 Jul 2023 10:36:15 +0000 (10:36 +0000)]
[gn build] Port
d9d9be63a52d
LLVM GN Syncbot [Tue, 4 Jul 2023 10:36:14 +0000 (10:36 +0000)]
[gn build] Port
2fd614efc1bb
Ivan Kosarev [Tue, 4 Jul 2023 10:16:00 +0000 (11:16 +0100)]
[AMDGPU][AsmParser][NFC] Remove an unused function.
Was added in <https://reviews.llvm.org/D63293>, but never used.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D154331
Florian Hahn [Tue, 4 Jul 2023 10:24:11 +0000 (11:24 +0100)]
[LV] Move getBroadcastInstr to VPTransformState.::get (NFCI).
getBroadcastInstrs is only used in VPTransformState::get. Move it closer
to use to reduce unnecessary interaction with ILV object.
Ties Stuij [Tue, 4 Jul 2023 10:21:05 +0000 (11:21 +0100)]
[ARM] fix typo in large-stack.ll introduced when fixing another typo
Sam McCall [Thu, 15 Jun 2023 13:56:25 +0000 (15:56 +0200)]
[dataflow] Add dedicated representation of boolean formulas
This is the first step in untangling the two current jobs of BoolValue.
=== Desired end-state: ===
- BoolValue will model C++ booleans e.g. held in StorageLocations.
this includes describing uncertainty (e.g. "top" is a Value concern)
- Formula describes analysis-level assertions in terms of SAT atoms.
These can still be linked together: a BoolValue may have a corresponding
SAT atom which is constrained by formulas.
=== Done in this patch: ===
BoolValue is left intact, Formula is just the input type to the
SAT solver, and we build formulas as needed to invoke the solver.
=== Incidental changes to debug string printing: ===
- variables renamed from B0 etc to V0 etc
B0 collides with the names of basic blocks, which is confusing when
debugging flow conditions.
- debug printing of formulas (Formula and Atom) uses operator<<
rather than debugString(), so works with gtest.
Therefore moved out of DebugSupport.h
- Did the same to Solver::Result, and some helper changes to SolverTest,
so that we get useful messages on unit test failures
- formulas are now printed as infix expressions on one line, rather than
wrapped/indented S-exprs. My experience is that this is easier to scan
FCs for small examples, and large ones are unreadable either way.
- most of the several debugString() functions for constraints/results
are unused, so removed them rather than updating tests.
Inlined the one that was actually used into its callsite.
Differential Revision: https://reviews.llvm.org/D153366
Ties Stuij [Tue, 4 Jul 2023 10:09:07 +0000 (11:09 +0100)]
[ARM] fix typo in large-stack.ll test
In llvm/test/CodeGen/ARM/large-stack.ll, the C in FileCheck wasn't
uppercased. This wasn't spotted in development as MacOS's HFS+ fs is apparently
often configured case-insensitive.
David Spickett [Tue, 4 Jul 2023 10:17:37 +0000 (11:17 +0100)]
[lldb][AArch64] Handle different default vector length in SVE testing
This test previously ran on QEMU or A64FX both of which can/do have
512 bit SVE by default.
Graviton 3 has 256 bit SVE so the first part of the test failed.
To fix this, probe the supported vector lengths before starting
the test. The first check will use the default vector length and
the rest use either 256 or 128 bit.
Therefore this test will be skipped on a machine with only 128 bit SVE.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D154208
David Spickett [Tue, 4 Jul 2023 10:15:45 +0000 (11:15 +0100)]
[lldb][AArch64] Fix tagged watch test on Graviton 3
During __do_global_dtors_aux glibc sets a flag that is right
next to the global variable. This is done using a store byte.
On QEMU the watchpoints are handled with a finer granularity
than real hardware, so this wasn't a problem. On Graviton 3
(and Mountain Jade, though this test won't run there) watchpoints
look at larger chunks of memory.
This means that the final continue actually stops in __do_global_dtors_aux
instead of exiting.
We could fix this by padding the global to be away from the flag,
but that is fiddly and it is easier just to remove the watchpoint
before the final continue. We have already verified it worked by that
point.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D154201
David Spickett [Tue, 4 Jul 2023 10:14:45 +0000 (11:14 +0100)]
[lldb][AArch64] Account for extra libc frames in PAC unwind test
Running this on Amazon Ubuntu the final backtrace is:
```
(lldb) thread backtrace
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
* frame #0: 0x0000aaaaaaaa07d0 a.out`func_c at main.c:10:3
frame #1: 0x0000aaaaaaaa07c4 a.out`func_b at main.c:14:3
frame #2: 0x0000aaaaaaaa07b4 a.out`func_a at main.c:18:3
frame #3: 0x0000aaaaaaaa07a4 a.out`main(argc=<unavailable>, argv=<unavailable>) at main.c:22:3
frame #4: 0x0000fffff7b373fc libc.so.6`___lldb_unnamed_symbol2962 + 108
frame #5: 0x0000fffff7b374cc libc.so.6`__libc_start_main + 152
frame #6: 0x0000aaaaaaaa06b0 a.out`_start + 48
```
This causes the test to fail because of the extra ___lldb_unnamed_symbol2962 frame
(an inlined function?).
To fix this, strictly check all the frames in main.c then for the rest
just check we find __libc_start_main and _start in that order regardless
of other frames in between.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D154204
Stephen Thomas [Tue, 4 Jul 2023 09:28:15 +0000 (10:28 +0100)]
[AMDGPU] Add functions for composing and decomposing S_WAIT_DEPCTR operands
Add functions AMDGPU::DepCtr::encodeField*() and AMDGPU::DepCtr::decodeField*()
for each of vm_vsrc, va_vdst and sa_sdst. These are now used in
AMDGPUInsertDelayAlu and GCNHazardRecognizer so as to make working with
S_WAITCNT_DEPCTR operands easier and more readable.
Differential Revision: https://reviews.llvm.org/D154424
Evgeniy Brevnov [Tue, 23 May 2023 11:53:04 +0000 (18:53 +0700)]
[VPlan] Allow sinking of instructions with no defs
We started seeing new failure after D142886. Looks like it enabled new cases and we hit an assert:
assert(Current->getNumDefinedValues() == 1 &&
"only recipes with a single defined value expected");
When we do instruction sinking for the first order recurrence we hit an assert if instruction doesn't have single def. In case instruction doesn't produce any new def there is no new users and nothing to sink.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D151204
Ties Stuij [Tue, 4 Jul 2023 09:50:42 +0000 (10:50 +0100)]
[ARM] make execute only long call test checks more robust
Reviewed By: olista01
Differential Revision: https://reviews.llvm.org/D154355
Harvin Iriawan [Mon, 3 Jul 2023 13:41:50 +0000 (14:41 +0100)]
[AArch64] Update SVE scheduling of some CPUs
* Update cortex-a510 and neoverse-v2 SVE scheduling so that pseudos
have the same instruction latency as original instruction.
Differential Revision: https://reviews.llvm.org/D154084
Harvin Iriawan [Fri, 30 Jun 2023 16:28:19 +0000 (17:28 +0100)]
[AArch64] NFC : Change the way SVE pseudos are appended
* SVE pseudos don't pick up the right latency information during MI
scheduling as the regex do not match with instruction name.
* Move UNDEF, PSEUDO, and ZERO to the end of actual SVE instruction
* Some CPUs *td files will be fixed in the next commit
Differential Revision: https://reviews.llvm.org/D154232
Ties Stuij [Tue, 4 Jul 2023 08:25:58 +0000 (09:25 +0100)]
[ARM] generate correct code for armv6-m XO big stack operations
The ARM backend codebase is dotted with places where armv6-m will generate
constant pools. Now that we can generate execute-only code for armv6-m, we need
to make sure we use the movs/lsls/adds/lsls/adds/lsls/adds pattern instead of
these.
Big stacks is one of the obvious places. In this patch we take care of two
sites:
1. take care of big stacks in prologue/epilogue
2. take care of save/tSTRspi nodes, which implicitly fixes
emitThumbRegPlusImmInReg which is used in several frame lowering fns
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D154233
Tom Eccles [Fri, 30 Jun 2023 16:35:26 +0000 (16:35 +0000)]
[flang][hlfir] fix elemental subroutine calls
genElementalCall can return a null option when lowering elemental
subroutine calls (as there is no return value). Therefore
std::option::value should not be used as it will cause an
assertion failure.
This fixes uses of the mvbits intrinsic with array arguments, as used in
the gfortran test suite.
Differential Revision: https://reviews.llvm.org/D154340
Tom Eccles [Thu, 29 Jun 2023 17:26:35 +0000 (17:26 +0000)]
[flang][hlfir] intrinsic dynamically optional arguments
This adds support for dynamically optional arguments for intrinsics
which do not have their own hlfir operations.
The functions for processing these arguments are mostly the same as the
equivalent functions in ConvertExpr.cpp. I chose not to share
implementations so that HLFIR helpers can be used here. Presumably
ConvertExpr.cpp will go away one day.
Depends on D154236
Differential Revision: https://reviews.llvm.org/D154237
Tom Eccles [Wed, 28 Jun 2023 15:29:27 +0000 (15:29 +0000)]
[flang][hlfir] support optional args for intrinsic ops
This also adds support for allocatable non-optional arguments.
Of the transformational intrinsics which currently have their own hlfir
operations, all of the dynamically optional arguments are lowered as
boxes, so that is all that is implemented for now.
One alternative approach would have been to deal with the dynamically
optional arguments when lowering to FIR runtime calls. I decided not to
do this so that any passes working on the intrinsic operations would not
have to know about and handle the dynamically optional arguments.
Depends on D154235
Differential Revision: https://reviews.llvm.org/D154236
Tom Eccles [Mon, 26 Jun 2023 17:46:15 +0000 (17:46 +0000)]
[flang][hlfir][NFC] refactor transformational intrinsic lowering
The old code had overgrown itself and become difficult to read and
modify. I've rewritten it and moved it into its own translation unit.
I moved PreparedActualArgument to the header file for the
transformational intrinsic lowering. Logically, it belongs in
ConvertCall.h, but putting it there would create a circular dependency
between HlfirIntrinsics and ConvertCall.
Differential Revision: https://reviews.llvm.org/D154235
Igor Kirillov [Tue, 27 Jun 2023 10:43:15 +0000 (10:43 +0000)]
[CodeGen] Precommit tests for D153355
Differential Revision: https://reviews.llvm.org/D153856
Aleksandr Popov [Mon, 3 Jul 2023 01:07:18 +0000 (03:07 +0200)]
[IRCE][NFC] Set Index and End together inside parseRangeCheckICmp
Preparatory refactoring for the upcoming support of new range check form
to parse.
With this change we always set Index and End values together in the same
place.
parseRangeCheckICmp specification updated.
Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D154156
Alexander Belyaev [Tue, 4 Jul 2023 07:40:38 +0000 (09:40 +0200)]
Revert "[mlir][transform] Allow arbitrary indices to be scalable"
This reverts commit
048764f23a380fd6f8cc562a0008dcc6095fb594.
Breaks https://lab.llvm.org/buildbot/#/builders/61/builds/45451