Nikolas Klauser [Tue, 9 May 2023 21:44:13 +0000 (14:44 -0700)]
[libc++][PSTL] Move the already implemented functions to the new dispatching scheme
Reviewed By: ldionne, #libc
Spies: arichardson, pcwang-thead, libcxx-commits, miyuki
Differential Revision: https://reviews.llvm.org/D150277
Jeffrey Byrnes [Thu, 4 May 2023 16:57:15 +0000 (09:57 -0700)]
[AMDGPU][GFX908] IndirectCopyToAGPR: Confirm modified register is dst reg of accvgpr_write
IndirectCopyToAGPR should be reworked as to avoid optimizing during copy lowering. However, as it stands, the code is buggy. This patch replaces the call to definesRegister with modifiesRegister, and confirms that the dest reg of the found accvgpr_write is in fact the src reg of our copy.
Differential Revision: https://reviews.llvm.org/D149873
Change-Id: Id8a61659ac15565dcb970069d0624f0925a46e6d
Craig Topper [Fri, 12 May 2023 19:34:07 +0000 (12:34 -0700)]
[RISCV] Move VFMADD_VL DAG combine to a function. NFC
This is preparation for an additional combine.
Alex Langford [Fri, 12 May 2023 19:33:07 +0000 (12:33 -0700)]
[lldb][NFCI] Delete commented out method OptionValueProperties::GetQualifiedName
Fangrui Song [Fri, 12 May 2023 19:23:21 +0000 (12:23 -0700)]
[test] Fix ftime-trace.cpp on Windows
Philip Reames [Fri, 12 May 2023 19:14:51 +0000 (12:14 -0700)]
[RISCVGatherScatterLowering] Support shl in non-recursive matching
We can apply the same logic as for multiply since a left shift is just a multiply by a power of two. Note that since shl is not commutative, we do need to be careful to match sure that the splat is the RHS of the instruction.
Differential Revision: https://reviews.llvm.org/D150471
Florian Hahn [Fri, 12 May 2023 19:20:10 +0000 (20:20 +0100)]
[PowerPC] Adjust tests after
e351b9b66da088.
Those tests were missed when landing
e351b9b66da088.
Alex Langford [Thu, 11 May 2023 21:32:36 +0000 (14:32 -0700)]
[lldb][NFCI] Change return type of DWARFDebugInfoEntry::GetAttributes
The purpose of this method is to get the list of attributes of a
DebugInfoEntry. Prior to this change we were passing in a mutable
reference to a DWARFAttributes object and having the method fill it in
for us while returning the size of the filled out list. But
instead of doing that, we can just return a `DWARFAttributes` object
ourselves since every caller creates a new list before calling
GetAttributes.
Differential Revision: https://reviews.llvm.org/D150402
Philip Reames [Fri, 12 May 2023 19:07:20 +0000 (12:07 -0700)]
[RISCVGatherScatterLowering] Remove restriction that shift must have constant operand
This has been present from the original patch which added the pass, and doesn't appear to be strongly justified. We do need to be careful of commutativity.
Differential Revision: https://reviews.llvm.org/D150468
Alex Langford [Wed, 10 May 2023 20:18:23 +0000 (13:18 -0700)]
[lldb][NFCI] Redefine dw_attr_t typedef with llvm::dwarf::Attribute
Similar to dw_form_t, dw_attr_t is typedef'd to be a uint16_t. LLVM
defines their type `llvm::dwarf::Attribute` as an enum backed by a
uint16_t. Switching to the LLVM type buys us type checking and the
requirement of explicit casts.
Differential Revision: https://reviews.llvm.org/D150299
spupyrev [Fri, 12 May 2023 17:27:12 +0000 (10:27 -0700)]
profilie inference changes for stale profile matching
This diff facilitates a new stale profile matching in BOLT: D144500
This is a no-op for existing usages of profi (CSSPGO).
Reviewed By: hoy
Differential Revision: https://reviews.llvm.org/D150466
Harsh Menon [Fri, 12 May 2023 18:09:40 +0000 (11:09 -0700)]
Add additional criteria for hoisting vector.transfer_reads
Non-subview uses of an alloc outside the current loop
can be safely ignored when considering hoisting vector
transfer_reads. This patch adds a condition to check for that
case and updates the unit test accordingly.
Differential Revision: https://reviews.llvm.org/D150469
ziqingluo-90 [Fri, 12 May 2023 18:45:44 +0000 (11:45 -0700)]
[-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit
The unsafe-buffer analysis requires a complete view of the translation
unit (TU) to be conservative. So the analysis is moved to the end of a
TU.
A summary of changes made: add a new `IssueWarnings` function in
`AnalysisBasedWarnings.cpp` for TU-based analyses. So far
[-Wunsafe-buffer-usage] is the only analysis using it but there could
be more. `Sema` will call the new `IssueWarnings` function at the end
of parsing a TU.
Reviewed by: NoQ (Artem Dergachev)
Differential revision: https://reviews.llvm.org/D146342
Slava Zakharin [Fri, 12 May 2023 02:16:56 +0000 (19:16 -0700)]
[flang][hlfir] Fixed AssociateOp codegen for 0-dim variables.
The codegen tried to fir.convert !fir.box to !fir.ref for this case.
I used BoxAddr under a check for the type mismatch, but I am not sure
if this is the right fix. Maybe it has to be handled in the lowering.
Hui [Tue, 9 May 2023 16:41:15 +0000 (17:41 +0100)]
[libc++][ranges] Fix `iota_view`'s constructor's incorrect constraint
One of the overload of the constructors should check Bound is not unreachable_sentinel_t, instead of the Start
Differential Revision: https://reviews.llvm.org/D150206
Florian Hahn [Fri, 12 May 2023 18:21:03 +0000 (19:21 +0100)]
[EarlyIfCvt] Don't if-convert if condition has only loop-invariant ops.
This patch adds a heuristic to skip if-conversion if the condition has a
high chance of being predictable.
If the condition is in a loop, consider it predictable if the condition
itself or all its operands are loop-invariant. E.g. this considers a load
from a loop-invariant address predictable; we were unable to prove that it
doesn't alias any of the memory-writes in the loop, but it is likely to
read to same value multiple times.
This is a relatively crude heuristic, but it helps to prevent excessive
if-conversion in multiple workloads in practice.
Reviewed By: apostolakis
Differential Revision: https://reviews.llvm.org/D141639
Joseph Huber [Fri, 12 May 2023 17:09:37 +0000 (12:09 -0500)]
[OpenMP] Naturally align internal global variables in the OpenMPIRBuilder
We use this helper to make several internal global variables during
codegen. currently we do not specify any alignment which allows the
alignment to be set incorrectly after some changes in how alignment was
handled. This patch explicitly aligns these variables to the natural
alignment as specified by the data layout
Fixes https://github.com/llvm/llvm-project/issues/62668
Reviewed By: tianshilei1992, gchatelet
Differential Revision: https://reviews.llvm.org/D150461
Joseph Huber [Fri, 12 May 2023 16:34:17 +0000 (11:34 -0500)]
[libc] Check the RPC server once again after the kernel exits
We support asynchronous sends, that means that the kernel can issue a
send, then exit the kernel as we do with the `EXIT` syscall. Because of
the condition it's therefore possible for the kernel to exit and break
from the loop before we check the server again. This can potentially
cause us to ignore an `EXIT` call from the GPU.
Reviewed By: JonChesterfield, lntue
Differential Revision: https://reviews.llvm.org/D150456
Mathieu Fehr [Fri, 12 May 2023 18:45:46 +0000 (19:45 +0100)]
Revert "[mlir][irdl] Add verification of IRDL ops"
This reverts commit
52761cb99164acd4ea76f91fc16a3e40ec94b898.
Fangrui Song [Fri, 12 May 2023 17:46:06 +0000 (10:46 -0700)]
[Driver] -ftime-trace: derive trace file names from -o and -dumpdir
Inspired by D133662.
Close https://github.com/llvm/llvm-project/issues/57285
When -ftime-trace is specified and the driver performs both compilation and
linking phases, the trace files are currently placed in the temporary directory
(/tmp by default on *NIX). A more sensible behavior would be to derive the trace
file names from the -o option, similar to how GCC derives auxiliary and dump
file names. Use -dumpdir (D149193) to implement the -gsplit-dwarf like behavior.
The following script demonstrates the time trace filenames.
```
#!/bin/sh -e
PATH=/tmp/Rel/bin:$PATH # adapt according to your build directory
mkdir -p d e f
echo 'int main() {}' > d/a.c
echo > d/b.c
a() { rm $1 || exit 1; }
clang -ftime-trace d/a.c d/b.c # previously /tmp/[ab]-*.json
a a-a.json; a a-b.json
clang -ftime-trace d/a.c d/b.c -o e/x # previously /tmp/[ab]-*.json
a e/x-a.json; a e/x-b.json
clang -ftime-trace d/a.c d/b.c -o e/x -dumpdir f/
a f/a.json; a f/b.json
clang -ftime-trace=f d/a.c d/b.c -o e/x
a f/a-*.json; a f/b-*.json
clang -c -ftime-trace d/a.c d/b.c
a a.json b.json
clang -c -ftime-trace=f d/a.c d/b.c
a f/a.json f/b.json
clang -c -ftime-trace d/a.c -o e/xa.o
a e/xa.json
clang -c -ftime-trace d/a.c -o e/xa.o -dumpdir f/g
a f/ga.json
```
The driver checks `-ftime-trace` and `-ftime-trace=`, infers the trace file
name, and passes `-ftime-trace=` to cc1. The `-ftime-trace` cc1 option is
removed.
With offloading, previously `-ftime-trace` is passed to all offloading
actions, causing the same trace file to be overwritten by host and
offloading actions. This patch doesn't attempt to support offloading (D133662),
but makes a sensible change (`OffloadingPrefix.empty()`) to ensure we don't
overwrite the trace file.
Minor behavior differences: the trace file is now a result file, which
will be removed upon an error. -ftime-trace-granularity=0, like
-ftime-trace, can now cause a -Wunused-command-line-argument warning.
Reviewed By: Maetveis
Differential Revision: https://reviews.llvm.org/D150282
Aart Bik [Thu, 11 May 2023 20:56:34 +0000 (13:56 -0700)]
[mlir][gpu][sparse] add gpu ops for sparse matrix computations
This revision extends the GPU dialect with ops that can be lowered to
host-oriented sparse matrix library calls (in this case cuSparse focused
although the ops could be generalized to support more GPUs in principle).
This will allow the "sparse compiler pipeline" to accelerate sparse operations
(see follow up revisions with examples of this).
For some background;
https://discourse.llvm.org/t/sparse-compiler-and-gpu-code-generation/69786/2
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D150152
Mathieu Fehr [Wed, 8 Mar 2023 22:16:02 +0000 (23:16 +0100)]
[mlir][irdl] Add verification of IRDL ops
This patch adds verification on registered IRDL operations, types,
and attributes.
This is done through an interface implemented by operations from the
`irdl` dialect, which translate the operations into `Constraint`.
This interface is then use in the `registerDialect` function to
generate verifiers for the entire operation/type/attribute.
Depends on D145733
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D145734
Philip Reames [Fri, 12 May 2023 17:30:05 +0000 (10:30 -0700)]
[RISCVGatherScatterLowering] Minor code cleanup [NFC]
Use a switch to avoid repeat tests on the opcode, and factor out some common code out of another switch. (Not all branches had both common bits, but the one which didn't left the values unchanged and their starting value is the respective operand - so storing it back is a nop.)
Vitaly Buka [Fri, 12 May 2023 17:05:46 +0000 (10:05 -0700)]
[sanitizers] Remove assert from ThreadArgRetval::Finish
Bionic uses pthread_exit to set retval, when GLIBC does not.
This cause double call to Finish. Rather then tracking this difference
on interceptor size, we can just relax precondition. It does not make
a difference.
Jeffrey Tan [Wed, 10 May 2023 21:44:16 +0000 (14:44 -0700)]
Fix libstdc++ data formatter for reference/pointer to std::string
This patch fixes libstdc++ data formatter for reference/pointer to std::string.
The failure testcases are added which succeed with the patch.
Differential Revision: https://reviews.llvm.org/D150313
Leandro Lupori [Fri, 12 May 2023 16:32:50 +0000 (13:32 -0300)]
[lldb-vscode] Skip restart tests on ARM
These tests always time out on ARM buildbot. Disabling them for
now, until https://github.com/llvm/llvm-project/issues/62684 is
fixed.
Michael Maitland [Thu, 27 Apr 2023 01:19:46 +0000 (18:19 -0700)]
[RISCV][llvm-mca] Add mca tests for riscv lmul instruments
Add llvm-mca tests for RISCV LMUL instruments to show that llvm-mca RISCV LMUL
instruments work.
This commit was previously reverted in ad8765a. This commit adds a lit.local.cfg
to make RISCV llvm-mca tests unsupported on non-RISCV configurations.
Differential Revision: https://reviews.llvm.org/D149496
Craig Topper [Fri, 12 May 2023 16:31:04 +0000 (09:31 -0700)]
[RISCV] Fix typo in comment. NFC
Nicolas Vasilache [Fri, 12 May 2023 16:12:28 +0000 (09:12 -0700)]
[mlir][Linalg] NFC - Retire dead tilePadOp
Nicolas Vasilache [Fri, 12 May 2023 15:43:10 +0000 (08:43 -0700)]
[mlir][Linalg] NFC - Retire dead FusionOnTensors.cpp
Michael Maitland [Fri, 12 May 2023 16:22:11 +0000 (09:22 -0700)]
Revert "[RISCV][llvm-mca] Add mca tests for riscv lmul instruments"
This commit passed buildable tests in phabricator, but fails once
committed.
This reverts commit
1dedc96d04c82e29fff18ee3b875505a158ff93c.
Krzysztof Drewniak [Tue, 7 Feb 2023 21:46:11 +0000 (21:46 +0000)]
[GlobalISel] Handle ptr size != index size in IRTranslator, CodeGenPrepare
While the original motivation for this patch (address space 7 on
AMDGPU) has been reworked and is not presently planned to reach IR
translation, the incorrect (by the spec) handling of index offset
width in IR translation and CodeGenPrepare is likely to trip someone
- possibly future AMD, since we have a p7:160:256:256:32 now, so we
convert to the other API now.
Reviewed By: aemerson, arsenm
Differential Revision: https://reviews.llvm.org/D143526
Michael Maitland [Thu, 27 Apr 2023 01:19:46 +0000 (18:19 -0700)]
[RISCV][llvm-mca] Add mca tests for riscv lmul instruments
Add llvm-mca tests for RISCV LMUL instruments to show that llvm-mca RISCV LMUL
instruments work.
Differential Revision: https://reviews.llvm.org/D149496
Aart Bik [Fri, 12 May 2023 01:43:47 +0000 (18:43 -0700)]
[mlir][sparse] minor reorg of sparse tensor tablegen defs
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D150414
Craig Topper [Fri, 12 May 2023 16:06:07 +0000 (09:06 -0700)]
[DAGCombiner][AArch64][VE] Teach BuildUDIV/SDIV to use 2x mul when mulh/mul_lohi are not available.
Correct the legality of i32 mul_lohi on AArch64.
Previously, AArch64 incorrectly reported i32 mul_lohi as Legal.
This allowed BuildUDIV/SDIV to use them. A later DAGCombiner would
replace them with MULHS/MULHU because only the high half was used.
This conversion does not check the legality of MULHS/MULHU under
the assumption that LegalizeDAG can turn it back into MUL_LOHI later.
After they are converted to MULHS/MULHU, DAGCombine ran and saw that
these operations aren't supported but an i64 MUL is. So they get
converted to that plus a shift. Without this, LegalizeDAG would
convert back MUL_LOHI and isel would fail to find a pattern.
This patch teaches BuildUDIV/SDIV to create the wide mul and shift
so that we can report the correct operation legality on AArch64. It
also enables div by constant folding for more cases on VE.
I don't know if VE wants this div by constant optimization or not. If they
don't want it, they can use the isIntDivCheap hook to disable it.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D150333
Felipe de Azevedo Piovezan [Tue, 2 May 2023 18:05:04 +0000 (14:05 -0400)]
[SelectionDAG][DebugInfo] Implement translation of entry_value vars
This commit implements SelectionDAG lowering of dbg.declare intrinsics targeting
swiftasync Arguments, by putting them in the MachineFunction's table of
variables whose location doesn't change throughout the function.
Depends on D149882
Differential Revision: https://reviews.llvm.org/D149883
Krzysztof Drewniak [Fri, 5 May 2023 22:03:40 +0000 (22:03 +0000)]
[AMDGPU] Fix crash with 160-bit p7's by manually defining getPointerTy
While pointers in address space 7 (128 bit rsrc + 32 bit offset)
should be rewritten out of the code before IR translation on AMDGPU,
higher-level analyses may still call MVT getPointerTy() and the like
on the target machine. Currently, since there is no MVT::i160, this
operation ends up causing crashes.
The changes to the data layout that caused such crashes were D149776.
This patch causes getPointerTy() to return the type MVT::v5i32
and getPointerMemTy() to be MVT::v8i32. These are accurate types,
but mean that we can't use vectors of address space 7 pointers during
codegen. This is mostly OK, since vectors of buffers aren't supported
in LPC anyway, but it's a noticable limitation.
Potential alternative solutions include adjusting getPointerTy() to return
an EVT or adding MVT::i160 and MVT::i256, both of which are rather
disruptive to the rest of the compiler.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D150002
Felipe de Azevedo Piovezan [Mon, 1 May 2023 12:18:24 +0000 (08:18 -0400)]
[IRTranslator][DebugInfo] Implement translation of entry_value vars
This commit implements IRTranslator lowering of dbg.declare intrinsics targeting
swiftasync Arguments, by putting them in the MachineFunction's table of
variables whose location doesn't change throughout the function.
Depends on D149881
Differential Revision: https://reviews.llvm.org/D149882
Konstantin Zhuravlyov [Fri, 12 May 2023 15:42:04 +0000 (11:42 -0400)]
AMDGPU: Force sc0 and sc1 on stores for gfx940 and gfx941
Differential Revision: https://reviews.llvm.org/D149986
Mark de Wever [Sat, 6 May 2023 11:28:46 +0000 (13:28 +0200)]
[NFC][libc++][format] Uses uniform member signatures.
The newer formatters for (tuple, vector<bool>::reference) specify the
formatter's parse and format member function. This signature is slightly
different from the signature for existing formatters. Adapt the existing
formatters to the new style.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D150034
Mark de Wever [Sun, 7 May 2023 12:56:52 +0000 (14:56 +0200)]
[clang] Restores some -std=c++2b tests.
These tests should have added -std=c++23 instead of replacing -std=c++2b
in D149553.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D150063
Mark de Wever [Sun, 7 May 2023 12:34:00 +0000 (14:34 +0200)]
[clang][ci] Improves buildkite artifacts.
The financial cost of the network I/O for the Clang install artifacts is
quite significant.
afd3478f37c8 improved this by creating tarballs. This
commit improves the tarball by using xz compression instead of gzip. This
option is the slowest, but gives the smallest size.
size time time
(compression) (decompression)
gzip 51 M 7 s 1.2 s
bz2 44 M 17 s 5.8 s
xz 33 M 76 s 3.1 s
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D150062
Simon Pilgrim [Fri, 12 May 2023 15:41:12 +0000 (16:41 +0100)]
[X86] narrowShuffle - only narrow from legal vector types
Fixes #62653
Benoit Jacob [Thu, 11 May 2023 15:44:12 +0000 (15:44 +0000)]
DestinationPassingStyle: allow additional non-tensor results
Also some simplifications:
* `outputBufferOperands` was unused.
* The condition that the number of operands equals the number of inputs
plus the number of inits seemed vacuously true (?).
Differential Revision: https://reviews.llvm.org/D150376
Jeffrey Byrnes [Fri, 12 May 2023 15:32:47 +0000 (08:32 -0700)]
Precommit test for D149873
Change-Id: I608f14ac3a504cc668f93f130a17dea3950fa554
Oleg Shyshkov [Fri, 12 May 2023 15:14:50 +0000 (17:14 +0200)]
[mlir][memref] Lower copy of memrefs with outer size-1 dims to intrinsic memcpy.
With this change, more `memref.copy` will be lowered to the efficient `memcpy`. For example,
```
memref.copy %subview, %alloc : memref<1x576xf32, strided<[704, 1]>> to memref<1x576xf32>
```
Differential Revision: https://reviews.llvm.org/D150448
Florian Hahn [Fri, 12 May 2023 15:10:47 +0000 (16:10 +0100)]
[ShrinkWrap] Conservatively treat MIs without memory operands.
As pointed out by @jpenix-quic in D149668 post-commit, machine instructions
without memory operands need to be treated conservatively.
Shengchen Kan [Sun, 7 May 2023 14:20:36 +0000 (22:20 +0800)]
[X86][AsmParser] Refactor code and optimize more instructions from VEX3 to VEX2
1. Share code `optimizeInstFromVEX3ToVEX2` with MCInstLower
2. Move the code of optimization for shift/rotate to a separate file
3. Since the function is shared, a side effect is that more encoding
optimizations are done on the Asmparser side. Considering we already
use reverse-encoding for optimization in AsmParser before this patch,
I believe the change is positive and expected.
This is a reland of D150068 with the fix D150440.
Shengchen Kan [Fri, 12 May 2023 14:41:17 +0000 (22:41 +0800)]
Revert "[X86][AsmParser] Refactor code in AsmParser"
This reverts commit
8d657c461a5aa43e882071b3b5e0496961aa44a1.
Reverts it due to the regression reported in D150068.
Kohei Yamaguchi [Fri, 12 May 2023 14:43:31 +0000 (16:43 +0200)]
[mlir][NFC] Fix broken sidebar and improve documentation
- Added missing TensorTransformOps to the Transform doc
- Added missing AMDGPUPasses to the Passes doc
- Place `async dialect` in alphabetical order in the Passes doc
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150341
kon72 [Fri, 12 May 2023 14:42:12 +0000 (16:42 +0200)]
[mlir][linalg] Add channel-first variants of convolution
This change adds the following three operations and unit tests for them:
- conv_3d_ncdhw_fcdhw
- depthwise_conv_1d_ncw_cw
- depthwise_conv_3d_ncdhw_cdhw
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D150054
Florian Hahn [Fri, 12 May 2023 14:38:31 +0000 (15:38 +0100)]
[AArch64] Add shrink-wrapping test with missing memoperands.
The newly added compiler_pop_stack_no_memoperands has no memory operands
on the memory instructions but accesses the same locations as
compiler_pop_stack. At the moment, accesses to the stack are missed by
shrink-wrapping. Test case for the issue pointed out by @jpenix-quic in
D149668 post-commit.
Neumann Hon [Fri, 12 May 2023 13:32:04 +0000 (09:32 -0400)]
[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when call stack frame extension is invoked
When the stack frame extension routine is used, the contents of r3 is overwritten.
However, if r3 is live in the prologue (ie. one of the function's parameters
resides in r3), it needs to be saved. We save r3 in r0 if r0 is available
(ie. r0 is not used as temporary storage for r4), and in the corresponding
stack slot for the third parameter otherwise.
Differential Revision: https://reviews.llvm.org/D150332
Reviewed By: uweigand
Matthias Springer [Fri, 12 May 2023 08:04:13 +0000 (10:04 +0200)]
[mlir][transform] TrackingListener: Allow existing ops as replacements
The TrackingListener was unnecessarily strict. Existing ops are now allowed when updating payload ops mappings due to `replaceOp` in the TrackingListener.
Differential Revision: https://reviews.llvm.org/D150429
Felipe de Azevedo Piovezan [Thu, 11 May 2023 13:14:52 +0000 (09:14 -0400)]
[lldb][nfc] Simplify DebugRanges class
Most of the code changed here dates back to 2010, when LLDB was first
introduced upstream, as such it benefits from a slight cleanup.
The method "dump" is not used anywhere nor is it tested, so this commit removes
it.
The "findRanges" method returns a boolean which is never checked and indicates
whether the method found anything/assigned a range map to the out parameter.
This commit folds the out parameter into the return type of the method.
A handful of typedefs were also never used and therefore removed.
Differential Revision: https://reviews.llvm.org/D150363
Felipe de Azevedo Piovezan [Mon, 1 May 2023 15:19:49 +0000 (11:19 -0400)]
[AsmPrinter] Use EntryValue object info to emit Dwarf
This patch consumes the EntryValueObjects in a MachineFunction's table, using
them to emit the appropriate debug information for these variables.
Depends on D149880
Differential Revision: https://reviews.llvm.org/D149881
Tobias Gysi [Fri, 12 May 2023 11:36:28 +0000 (11:36 +0000)]
[mlir] Add timings to mlir translate.
The revision adds basic timing to the mlir-translate tool.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D150434
Ruiling Song [Wed, 10 May 2023 03:07:00 +0000 (11:07 +0800)]
AMDGPU: Fix issue in shl(or) combine
The code is doing the optimization:
`((a | c1) << c2)` ==> `(a << c2) + (c1 << c2)`
But this is only valid if `a` and `c1` have no common bits being set.
Differential Revision: https://reviews.llvm.org/D150246
Benjamin Kramer [Fri, 12 May 2023 10:26:29 +0000 (12:26 +0200)]
[lldb] Don't write to source directory in test
khei4 [Fri, 12 May 2023 09:41:09 +0000 (18:41 +0900)]
[AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP-indices
Differential Revision: https://reviews.llvm.org/D146622
Fixes https://github.com/llvm/llvm-project/issues/61615
Reviewed By: nikic
Tres Popp [Thu, 11 May 2023 09:10:46 +0000 (11:10 +0200)]
[mlir] Update method cast calls to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.
Context:
* https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
* Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
This follows a previous patch that updated calls
`op.cast<T>()-> cast<T>(op)`. However some cases could not handle an
unprefixed `cast` call due to occurrences of variables named cast, or
occurring inside of class definitions which would resolve to the method.
All C++ files that did not work automatically with `cast<T>()` are
updated here to `llvm::cast` and similar with the intention that they
can be easily updated after the methods are removed through a
find-replace.
See https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
for the clang-tidy check that is used and then update printed
occurrences of the function to include `llvm::` before.
One can then run the following:
```
ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-export-fixes /tmp/cast/casts.yaml mlir/*\
-header-filter=mlir/ -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```
Differential Revision: https://reviews.llvm.org/D150348
Tres Popp [Mon, 8 May 2023 14:33:54 +0000 (16:33 +0200)]
[mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.
Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.
Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
additional check:
https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
them to a pure state.
4. Some changes have been deleted for the following reasons:
- Some files had a variable also named cast
- Some files had not included a header file that defines the cast
functions
- Some files are definitions of the classes that have the casting
methods, so the code still refers to the method instead of the
function without adding a prefix or removing the method declaration
at the same time.
```
ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-header-filter=mlir/ mlir/* -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
mlir/lib/**/IR/\
mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
mlir/test/lib/Dialect/Test/TestTypes.cpp\
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
mlir/test/lib/Dialect/Test/TestAttributes.cpp\
mlir/unittests/TableGen/EnumsGenTest.cpp\
mlir/test/python/lib/PythonTestCAPI.cpp\
mlir/include/mlir/IR/
```
Differential Revision: https://reviews.llvm.org/D150123
Tres Popp [Tue, 9 May 2023 13:56:42 +0000 (15:56 +0200)]
[mlir] Move casting method calls to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change continues the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
This commit attempts to update all occurrences of the casts in .td
files, although it is likely that a couple were missed.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
Unfortunatley, this was not automated, but was handled by mindlessly
going to next occurrences of patterns, selecting the piece of code to
be moved into the function call, and running a vim macro over the span
of around 4 hours.
Differential Revision: https://reviews.llvm.org/D150199
Sander de Smalen [Fri, 12 May 2023 08:22:21 +0000 (08:22 +0000)]
[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for while*
These intrinsics are used to implement the while intrinsics that result
in a predicate-as-counter value, e.g.
__attribute__((arm_streaming))
svcount_t svwhilelt_c8(int64_t rn, int64_t rm, uint64_t vl)
As described in https://github.com/ARM-software/acle/pull/217
Reviewed By: hassnaa-arm
Differential Revision: https://reviews.llvm.org/D150265
Sander de Smalen [Fri, 12 May 2023 08:21:54 +0000 (08:21 +0000)]
[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for ptrue/cntp
These intrinsics are used to implement:
* svptrue_c8(), svptrue_c16(), etc.
* svcntp_c8(svcount_t pnn, uint64_t vl), svcntp_c16(...), etc.
As described in https://github.com/ARM-software/acle/pull/217
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D150263
Qihan Cai [Fri, 12 May 2023 08:29:30 +0000 (18:29 +1000)]
[RISCV][CodeGen] Support Zhinx and Zhinxmin
This patch was split from D122918.
Co-Author: @liaolucy @sunshaoce
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D149811
Nicolas Vasilache [Fri, 12 May 2023 08:11:20 +0000 (01:11 -0700)]
[mlir][Linalg] NFC - fail gracefully instead of asserting in HoistPadding
Balázs Kéri [Fri, 12 May 2023 07:20:35 +0000 (09:20 +0200)]
[clang][analyzer] Cleanup tests of StdCLibraryFunctionsChecker (NFC)
Function declarations are moved into common header that can be reused
to avoid repetitions in different test files.
Some small problems in the tests were found and fixed.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D149158
Yingwei Zheng [Fri, 12 May 2023 07:06:58 +0000 (15:06 +0800)]
[RISCV] Fold (select setcc, setcc, setcc) into and/or instructions
This patch folds `(select setcc, setcc, setcc)` into and/or instructions when truev/falsev is equal to or the inverse of condv.
(select x, x, y) -> x | y https://alive2.llvm.org/ce/z/36Ud3Z
(select !x, x, y) -> x & y https://alive2.llvm.org/ce/z/mYYoGF
(select x, y, x) -> x & y https://alive2.llvm.org/ce/z/MAZ--X
(select !x, y, x) -> x | y https://alive2.llvm.org/ce/z/ct7By5
It is the follow-up improvement of D150177, which optimizes the code of signed truncation check patterns without Zbb.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150286
Vitaly Buka [Fri, 12 May 2023 06:56:41 +0000 (23:56 -0700)]
Revert "[NFC][xray] Initialize XRayFileHeader"
Revert "[xray] Ignore -Wc++20-extensions in xray_records.h [NFC]"
Not needed. The fix is
3826a74fc7ad589e268b267d9323d4d416c5f6e9.
This reverts commit
231c1d4134513e5a97cfdc874e8bda488ad59699.
This reverts commit
7f191e6d2c9ec4af1819c4e80a5453583cd72f08.
Serge Pavlov [Fri, 12 May 2023 06:30:36 +0000 (13:30 +0700)]
[test] Use autogenerated assertions
Chuanqi Xu [Fri, 12 May 2023 02:20:13 +0000 (10:20 +0800)]
[Serialization] Don't try to complete the redeclaration chain in
ASTReader after we start writing
This is intended to mitigate
https://github.com/llvm/llvm-project/issues/61447.
Before the patch, it takes 5s to compile test.cppm in the above
reproducer. After the patch it takes 3s to compile it. Although this
patch didn't solve the problem completely, it should mitigate the
problem for sure. Noted that the behavior of the patch is consistent
with the comment of the originally empty function
ASTReader::finalizeForWriting. So the change should be consistent with
the original design.
Tomasz Kuchta [Fri, 12 May 2023 05:28:53 +0000 (05:28 +0000)]
[DFSAN] Add support for strnlen
This patch adds a support for the libc strnlen() function in DFSAN
Reviewed by: browneee
Differential Revision: https://reviews.llvm.org/D149459
Fangrui Song [Fri, 12 May 2023 06:06:01 +0000 (23:06 -0700)]
[test] Remove Python<3.3 workaround without shlex.quote
Python>=3.6 has been the requirement since D93097 (2020).
Remove old workarounds.
Remove unused imports from compiler-rt/test/memprof/lit.cfg.py
Reviewed By: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D150410
Vitaly Buka [Fri, 12 May 2023 05:56:27 +0000 (22:56 -0700)]
[ASAN][LSAN] Ignore main or uninitialized thead in pthread_exit
Fix crash on CHECK in ThreadArgRetval::Finish().
Vitaly Buka [Fri, 12 May 2023 03:38:08 +0000 (20:38 -0700)]
[NFC][xray] Initialize XRayFileHeader
Avoids reports with msan -fno-inline.
Lang Hames [Fri, 12 May 2023 00:41:30 +0000 (10:41 +1000)]
[lli] Add new testcases for lli.
These are an attempt to more systematically test the features covered by the
MCJIT regression tests (though these tests apply to lli's default mode, which
is now -jit-kind=orc).
This first batch of tests includes a basic smoke test (trivial-return-zero),
tests for single function calls and data references, and alignment handling.
Jessica Paquette [Fri, 12 May 2023 05:24:29 +0000 (22:24 -0700)]
[NFC] SuffixTree: Move advance() into SuffixTree.cpp + more cleanup
Allows us to knock out a couple more includes from the header file.
Also clang-format SuffixTree.cpp while we're here.
Also use SuffixTreeNode::EmptyIdx in a couple more places.
Joshua Cao [Thu, 11 May 2023 05:38:02 +0000 (22:38 -0700)]
[SimpleLoopUnswitch][reland 2] unswitch selects
The old LoopUnswitch pass unswitched selects, but the changes were
never ported to the new SimpleLoopUnswitch.
We unswitch by turning:
``` S = select %cond, %a, %b ```
into:
``` head: br %cond, label %then, label %tail
then: br label %tail
tail: S = phi [ %a, %then ], [ %b, %head ] ```
Unswitch selects are always nontrivial, since the successors do not
exit the loop and the loop body always needs to be cloned.
Unswitch selects always need to freeze the conditional if the
conditional could be poison or undef. Selects don't propagate
poison/undef, and branches on poison/undef causes UB.
Reland 1 - Fix the insertion of freeze instructions. The original
implementation inserts a dead freeze instruction that is not used by the
unswitched branch.
Reland 2 - Include https://reviews.llvm.org/D149560 in the same patch,
which was originally reverted along with this patch. The patch prevents
unswitching of selects with a vector conditional. This could have been
caught in SimpleLoopUnswitch/crash.ll if it included tests for
nontrivial unswitching. This reland also adds a run for the test file
with nontrivial unswitching.
Reviewed By: nikic, kachkov98, vitalybuka
Differential Revision: https://reviews.llvm.org/D138526
Jessica Paquette [Fri, 12 May 2023 05:11:05 +0000 (22:11 -0700)]
SuffixTree: Don't save entire leaf nodes in advance()
All we need is the suffix indices.
Just store those instead.
Also improve code readability a little while we're here.
Jessica Paquette [Fri, 12 May 2023 04:35:26 +0000 (21:35 -0700)]
[NFC] Tidy SuffixTree.h
- Move comment to top of file
- Remove unused vector include
LLVM GN Syncbot [Fri, 12 May 2023 04:34:40 +0000 (04:34 +0000)]
[gn build] Port
6cf993e59bd2
Jessica Paquette [Fri, 12 May 2023 04:32:12 +0000 (21:32 -0700)]
[NFC] SuffixTree: Split out SuffixTreeNodes into their own files
Add:
- SuffixTreeNode.h
- SuffixTreeNode.cpp
The SuffixTree file was getting too long.
Jessica Paquette [Fri, 12 May 2023 03:41:00 +0000 (20:41 -0700)]
[NFC] SuffixTree: Move EmptyIdx into SuffixTreeNode and add a root allocator
This makes it clearer that EmptyIdx is related to the node.
Also add an allocator for the root so that in the main SuffixTree code we don't
see gross stuff like a nullptr parent etc.
Jie Fu [Fri, 12 May 2023 03:10:08 +0000 (11:10 +0800)]
[xray] Ignore -Wc++20-extensions in xray_records.h [NFC]
/data/llvm-project/compiler-rt/lib/xray/../../include/xray/xray_records.h:48:24: error: default member initializer for bit-field is a C++20 extension [
-Werror,-Wc++20-extensions]
bool ConstantTSC : 1 = false;
^
/data/llvm-project/compiler-rt/lib/xray/../../include/xray/xray_records.h:49:23: error: default member initializer for bit-field is a C++20 extension [
-Werror,-Wc++20-extensions]
bool NonstopTSC : 1 = false;
^
2 errors generated.
Kai Sasaki [Fri, 12 May 2023 02:40:00 +0000 (11:40 +0900)]
[mlir][tosa] Fold exp(log) operation into no-op
Element-wise exp(log) can be canonicalized as no-op.
Reviewed By: eric-k256
Differential Revision: https://reviews.llvm.org/D150342
jinge90 [Fri, 12 May 2023 03:12:36 +0000 (11:12 +0800)]
This patch adds doc for __builtin_flt_rounds and __builtin_set_flt_rounds
and also adds description for default fp environment.
Reviewed By:rjmccall, sepavloff
Differential Revision: https://reviews.llvm.org/D146188
John Demme [Fri, 12 May 2023 02:43:29 +0000 (02:43 +0000)]
[MLIR][Memref] Remove unnecessary #include
MemRefMem2Ref was unnecessarily including a header from Complex and not
including it as a cmake dep (causing some builds to fail).
Vitaly Buka [Fri, 12 May 2023 02:42:08 +0000 (19:42 -0700)]
[NFC][LiveDebugValues] Clang-format
b135df08
Vitaly Buka [Fri, 12 May 2023 02:35:12 +0000 (19:35 -0700)]
[LiveDebugValues] Temporarily initialize MLocTracker::CurBB
Looks like code assumes that it will be always set, but it's not true:
https://reviews.llvm.org/D150420. This is temporarily suppression to enabled
stricter msan on a bot.
Neumann Hon [Fri, 12 May 2023 02:32:16 +0000 (22:32 -0400)]
Revert "[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when call stack frame extension is invoked"
This reverts commit
1aec3d15aaa25c39fae026688708d7353d488974.
Weining Lu [Fri, 12 May 2023 02:09:39 +0000 (10:09 +0800)]
[LoongArch] clang-format LoongArchISelLowering.cpp. NFC
Vitaly Buka [Fri, 12 May 2023 02:07:29 +0000 (19:07 -0700)]
[NFC][LLLexer] Consistently initialize *Val fields
LLParser::parseInstruction speculatively getUIntVal()
but uses that only in some branches.
APFloatVal, TyVal and StrVal were already initialized, when
UIntVal and APSIntVal were not.
Jianjian GUAN [Thu, 11 May 2023 09:30:30 +0000 (17:30 +0800)]
[RISCV][NFC] Remove unused class defination.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150350
Vitaly Buka [Fri, 12 May 2023 01:49:39 +0000 (18:49 -0700)]
[NFC][xray] Initialize XRayFileHeader
Avoids reports with msan -fno-inline.
Eli Kobrin [Fri, 12 May 2023 01:33:44 +0000 (18:33 -0700)]
[CMake][fuzzer] Add riscv64 to fuzzer supported arch list
I tried to build libFuzzer for RISC-V and succeeded. All the libFuzzer
targets were successfully built. I tested this on the small hello world code
with a few branches to check the instrumentation; all of them were covered by
libFuzzer on RISC-V arch. So I suppose it makes sense to enable libFuzzer
build for RISC-V.
Reviewed By: phosek, thetruestblue, MaskRay
Differential Revision: https://reviews.llvm.org/D147788
Neumann Hon [Fri, 12 May 2023 01:25:05 +0000 (21:25 -0400)]
[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when call stack frame extension is invoked
When the stack frame extension routine is used, the contents of r3 is
overwritten. However, if r3 is live in the prologue (ie. one of the
function's parameters resides in r3), it needs to be saved. We save
r3 in r0 if r0 is available (ie. r0 is not used as temporary storage
for r4), and in the corresponding stack slot for the third parameter otherwise.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D150332
Jessica Paquette [Thu, 11 May 2023 21:52:53 +0000 (14:52 -0700)]
[NFC] Refactor SuffixTree to use LLVM-style RTTI
Following guidelines in
https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
This allows us to
* Quickly discern between leaf and internal nodes
* Be more idiomatic with the rest of LLVM
* Save some size on node structs
* Reduce the number of allocations (because end indices for internal nodes no
longer need to be pointers to be compatible with leaf nodes)
Also object orientify the code some more. This allows for more asserts and
checks.
This shouldn't impact code size on the MachineOutliner.
- All unit tests pass (outliner lit + llvm-unit)
- No code size changes on CTMark @ -Oz for AArch64
Nico Weber [Fri, 12 May 2023 00:31:52 +0000 (02:31 +0200)]
Akira Hatanaka [Fri, 12 May 2023 00:22:49 +0000 (17:22 -0700)]
Declare _availability_version_check as weak_import instead of looking it
up at runtime using dlsym
Calling dlsym with RTLD_DEFAULT can be very slow as all images in the
process are searched for the symbol.
Differential Revision: https://reviews.llvm.org/D150397