Luke Lau [Wed, 21 Jun 2023 12:13:40 +0000 (13:13 +0100)]
[RISCV] Custom lower fixed vector undef to scalable undef
This avoids undefs from being expanded to a build vector of zeroes.
As noted by @craig.topper in D153399
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D153411
Joseph Huber [Wed, 21 Jun 2023 16:10:11 +0000 (11:10 -0500)]
[libc][NFC] Cleanup the RPC server implementation prior to installing
This does some simple cleanup prior to landing the patch to install
these.
Differential Revision: https://reviews.llvm.org/D153439
Petr Hosek [Tue, 20 Jun 2023 21:49:22 +0000 (21:49 +0000)]
[libcxx] Include <sys/time.h> in posix_compat.h
posix_compat.h uses struct timeval which is defined in <sys/time.h>
but it doesn't include it. On most POSIX platforms like Linux or macOS,
that headers is transitively included by other headers like <sys/stat.h>,
but there are other platforms where this is not the case.
Differential Revision: https://reviews.llvm.org/D153384
Craig Topper [Wed, 21 Jun 2023 15:57:46 +0000 (08:57 -0700)]
[RISCV] Use a build_vector instead of a chain insert_vector_elts for vXi1 build_vector lowreing.
A build_vector is the canonical representation rather than multiple
insert_vector_elts.
Unfortunately, this regresses quite a few tests now primarily due to not
having a vmv.s.x special case, but I hope we can improve this with future
patches.
Stress testing in our downstream found an infinite loop in DAG combine.
This patch breaks the infinite loop.
The insert_vector_element chain starts with a fixed vector undef.
Fixed vector undef is currently expanded to a build_vector of 0s
which gets lowered to a vmv.v.i. The insert chain overwrites all
elements so SimplifyDemandedVectorElts turns the vmv.v.i back into
undef and the cycle repeats.
We probably should custom lower fixed vector undef to scalable
vector undef. I think that would also fix the infinite loop, but
I didn't test that.
Reviewed By: luke
Differential Revision: https://reviews.llvm.org/D153399
Fangrui Song [Wed, 21 Jun 2023 15:52:53 +0000 (08:52 -0700)]
[llvm-objdump][test] Add 2 symbols to adjust-vma.test
They will demonstrate some symbol that --adjust-vma= should not adjust.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D153401
Craig Topper [Wed, 21 Jun 2023 15:52:28 +0000 (08:52 -0700)]
[RISCV] Stop isInterleaveShuffle from producing illegal extract_subvectors.
The definition for ISD::EXTRACT_SUBVECTOR says the index must be
aligned to the known minimum elements of the extracted type. We mostly
got away with this but it turns out there are places that depend on this.
For example, this code in getNode for ISD::EXTRACT_SUBVECTOR
```
// EXTRACT_SUBVECTOR of CONCAT_VECTOR can be simplified if the pieces of
// the concat have the same type as the extract.
if (N1.getOpcode() == ISD::CONCAT_VECTORS && N1.getNumOperands() > 0 &&
VT == N1.getOperand(0).getValueType()) {
unsigned Factor = VT.getVectorMinNumElements();
return N1.getOperand(N2C->getZExtValue() / Factor);
}
```
This depends on N2C->getZExtValue() being evenly divisible by Factor.
Reviewed By: luke
Differential Revision: https://reviews.llvm.org/D153380
Lang Hames [Wed, 21 Jun 2023 15:50:14 +0000 (08:50 -0700)]
[tutorials] Add missing ExecutorSymbolDef header.
Similar to
c118d05f9ed, but applied to the base Kaleidoscope series.
Mehdi Amini [Wed, 21 Jun 2023 15:50:18 +0000 (17:50 +0200)]
Revert "[mlir][CRunnerUtils] Use explicit execution engine symbol registration."
This reverts commit
9119325a5666e557a19f38a05525578b556c215b.
A buildbot is broken, probably because of this change breaking the
SHARED_LIBS=ON build more.
Alexander Kornienko [Wed, 21 Jun 2023 14:41:05 +0000 (16:41 +0200)]
Revert "[LoopSink] Allow sinking to PHI-use"
This reverts commit
54711a6a5872d5f97da4c0a1bd7e58d0546ca701.
The commit is causing a clang crash: https://reviews.llvm.org/D152772#4437254
Lang Hames [Wed, 21 Jun 2023 15:31:49 +0000 (08:31 -0700)]
[tutorials][BuildingAJIT] Add missing ExecutorSymbolDef header.
Jannik Silvanus [Tue, 20 Jun 2023 13:22:32 +0000 (15:22 +0200)]
[clang-format] vim integration: Mention python3 variant of bindings
The instructions in the documentation only mentioned how to include
bindings for clang-format into vim using python2. Add the instructions
for python3 which were already present in the source comments.
Differential Revision: https://reviews.llvm.org/D153338
Change-Id: I25fdbd36f0c7e745061908be8e26f68cb31c7dd5
luxufan [Wed, 21 Jun 2023 15:03:56 +0000 (23:03 +0800)]
[InstCombine] Add !noundef to match behavior of violating assume
The behaviors of violating assume instruction or !nonnull metadata is
different. The former is immediate undefined behavior, but the latter is
returning poison value. This patch adds !noundef to trigger immediate
undefined behavior if !nonnull is violated.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153400
Luke Lau [Mon, 15 May 2023 15:56:48 +0000 (16:56 +0100)]
[IR] Add getAccessType to Instruction
There are multiple places in the code where the type of memory being accessed from an instruction needs to be obtained, including an upcoming patch to improve GEP cost modeling. This deduplicates the logic between them. It's not strictly NFC as EarlyCSE/LoopStrengthReduce may catch more intrinsics now.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D150583
Amilendra Kodithuwakku [Wed, 21 Jun 2023 15:10:08 +0000 (16:10 +0100)]
Revert "[LLD][ELF] Cortex-M Security Extensions (CMSE) Support"
This reverts commit
c4fea3905617af89d1ad87319893e250f5b72dd6.
I am reverting this for now until I figure out how to fix
the build bot errors and warnings.
Errors:
llvm-project/lld/ELF/Arch/ARM.cpp:1300:29: error: expected primary-expression before ‘>’ token
osec->writeHeaderTo<ELFT>(++sHdrs);
Warnings:
llvm-project/lld/ELF/Arch/ARM.cpp:1306:31: warning: left operand of comma operator has no effect [-Wunused-value]
Nikita Popov [Wed, 21 Jun 2023 15:12:39 +0000 (17:12 +0200)]
[X86] Add test for PR63430 (NFC)
Matt Arsenault [Wed, 21 Jun 2023 15:05:03 +0000 (11:05 -0400)]
RISCV: Update test
Qihan Cai [Wed, 21 Jun 2023 14:59:30 +0000 (22:59 +0800)]
[RISCV] Add support for XCVmac extension in CV32E40P
Implement XCVmac intrinsics for CV32E40P according to the specification.
This is the first commit of a patch-set to upstream the 7 vendor specific extensions of CV32E40P.
The patch-set aims at upstreaming the extensions on MC. The following will be on CodeGen, and the final patch-set will be on builtins if possible. The implemented version is on [0].
Contributors: @CharKeaney, Serkan Muhcu, @jeremybennett, @lewis-revill, @liaolucy, @simoncook, @xmj
Spec: https://github.com/openhwgroup/cv32e40p/blob/
62bec66b36182215e18c9cf10f723567e23878e9/docs/source/instruction_set_extensions.rst
[0] https://github.com/openhwgroup/corev-llvm-project
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152821
luxufan [Wed, 21 Jun 2023 14:36:42 +0000 (22:36 +0800)]
[CVP] Don't process sext or ashr if value state including undef
similar to D152773
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152774
Joseph Huber [Wed, 21 Jun 2023 14:50:04 +0000 (09:50 -0500)]
[libc][NFC] Move `__has_builtin` to `LIBC_HAS_BUILTIN`
Summary:
These should use the common `LIBC_HAS_BUILTIN` even if we will only
compile this with `clang`.
Matt Arsenault [Wed, 21 Jun 2023 14:40:10 +0000 (10:40 -0400)]
X86: Fix asserts only test
This test should really check the MIR result rather than rely on the
debug output.
Matt Arsenault [Wed, 21 Jun 2023 14:20:20 +0000 (10:20 -0400)]
RegisterCoalescer: Fix name of pass
I finally snapped and fixed this inconsistency.
Amilendra Kodithuwakku [Wed, 21 Jun 2023 11:48:33 +0000 (12:48 +0100)]
[LLD][ELF] Cortex-M Security Extensions (CMSE) Support
This commit provides linker support for Cortex-M Security Extensions (CMSE).
The specification for this feature can be found in ARM v8-M Security Extensions:
Requirements on Development Tools.
The linker synthesizes a security gateway veneer in a special section;
`.gnu.sgstubs`, when it finds non-local symbols `__acle_se_<entry>` and `<entry>`,
defined relative to the same text section and having the same address. The
address of `<entry>` is retargeted to the starting address of the
linker-synthesized security gateway veneer in section `.gnu.sgstubs`.
In summary, the linker translates input:
```
.text
entry:
__acle_se_entry:
[entry_code]
```
into:
```
.section .gnu.sgstubs
entry:
SG
B.W __acle_se_entry
.text
__acle_se_entry:
[entry_code]
```
If addresses of `__acle_se_<entry>` and `<entry>` are not equal, the linker
considers that `<entry>` already defines a secure gateway veneer so does not
synthesize one.
If `--out-implib=<out.lib>` is specified, the linker writes the list of secure
gateway veneers into a CMSE import library `<out.lib>`. The CMSE import library
will have 3 sections: `.symtab`, `.strtab`, `.shstrtab`. For every secure gateway
veneer <entry> at address `<addr>`, `.symtab` contains a `SHN_ABS` symbol `<entry>` with
value `<addr>`.
If `--in-implib=<in.lib>` is specified, the linker reads the existing CMSE import
library `<in.lib>` and preserves the entry function addresses in the resulting
executable and new import library.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/D139092
Louis Dionne [Wed, 14 Jun 2023 22:31:20 +0000 (15:31 -0700)]
[libc++] Get rid of _LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS
Whether we include operator new and delete into libc++ has always
been a build time setting, and piggy-backing on a macro like
_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is inconsistent with how
we handle similar cases for e.g. LIBCXX_ENABLE_RANDOM_DEVICE. Instead,
simply avoid including new.cpp in the sources of the library when we
do not wish to include these operators in the build.
This also makes us much closer to being able to share the definitions
between libc++ and libc++abi, since we could technically build those
definitions into a standalone static library and decide whether we link
it into libc++abi.dylib or libc++.dylib.
Differential Revision: https://reviews.llvm.org/D153272
Jay Foad [Wed, 21 Jun 2023 12:55:43 +0000 (13:55 +0100)]
[AMDGPU] Add some positive tests for merging S_LOAD instructions
Kai Nacke [Tue, 20 Jun 2023 14:26:57 +0000 (14:26 +0000)]
[SystemZ] Fix regression in test macro-prefix-map-lambda.cpp
The failing test comes from https://reviews.llvm.org/D152570.
Root cause of the failure is that a string constant on SystemZ
has an alignment of 2, not 1. The CSKY target has a similar problem.
The solution is to replace the fixed number with a regex.
Reviewed By: uweigand, tuliom, Zibi
Differential Revision: https://reviews.llvm.org/D153352
Guillaume Chatelet [Wed, 21 Jun 2023 12:25:22 +0000 (12:25 +0000)]
Revert D148717 "[libc] Improve memcmp latency and codegen"
Once integrated in our codebase the patch triggered a bunch of failing
tests. We do not yet understand where the bug is but we revert it to
move forward with integration.
This reverts commit
5e32765c15ab8df3d2635a2bb5078c5b1d5714d5.
Louis Dionne [Mon, 19 Jun 2023 18:44:21 +0000 (14:44 -0400)]
[libc++] Guard terminate_successful with TEST_HAS_NO_EXCEPTIONS
This one is a bit twisted. Some platforms don't have support for
exiting in a clean manner, so they don't provide std::exit(). As
a result, defining `terminate_successful()` on those platforms won't
work, and the PSTL tests that rely on `terminate_successful()` also
won't work.
However, we don't have a notion of "no clean termination" in libc++,
so we can't properly guard this. Since embedded platforms that don't
support clean termination usually also don't enable exceptions, we
don't need to be able to run those `terminate_successful` PSTL tests,
and guarding the definition of `terminate_successful` with
TEST_HAS_NO_EXCEPTIONS works pretty well.
This is kind of a hack for the lack of having a concept of "no clean
termination" in the library and in the test suite.
Differential Revision: https://reviews.llvm.org/D153302
Christian Sigg [Wed, 21 Jun 2023 12:29:44 +0000 (14:29 +0200)]
Revert "[Bazel][mlir] Fix ODR violation introduced in 7ab749c."
This reverts commit
e83c8c36005f0068841e628612e9e5bce7e2ac9e.
Depending only on the support header files is not sufficient.
Pravin Jagtap [Wed, 21 Jun 2023 12:02:43 +0000 (08:02 -0400)]
[AMDGPU] Preserve dom-tree analysis in atomic optimizer.
AMDGPUAtomicOptimizer updates the dominator tree whenever
it modified the control flow. Therefore preserving the
analysis similar to legacy PM.
Reviewed By: arsenm, yassingh, #amdgpu
Differential Revision: https://reviews.llvm.org/D153349
Kiran Chandramohan [Wed, 21 Jun 2023 09:28:14 +0000 (10:28 +0100)]
[Flang][Debug] NFC: Correct the REQUIRES line to use system-linux
Reviewed By: kkwli0
Differential Revision: https://reviews.llvm.org/D153126
Jay Foad [Wed, 21 Jun 2023 11:04:29 +0000 (12:04 +0100)]
[AMDGPU] Minor refactoring in SILoadStoreOptimizer::offsetsCanBeCombined
Antonio Frighetto [Wed, 21 Jun 2023 10:52:02 +0000 (12:52 +0200)]
[ConstraintSystem] Fix mislabeling in unittests (NFC)
Possible misleading comment has been addressed.
David Spickett [Mon, 5 Jun 2023 17:41:32 +0000 (17:41 +0000)]
[lldb] Add release note for "register info" command
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D152919
David Spickett [Mon, 5 Jun 2023 17:02:46 +0000 (17:02 +0000)]
[lldb] Add register field tables to the "register info" command
This teaches DumpRegisterInfo to generate a table from the register
flags type. It just calls a method on RegisterFlags.
As such, the extra tests are minimal and only show that the intergration
works. Exhaustive formatting tests are done with RegisterFlags itself.
Example:
```
(lldb) register info cpsr
Name: cpsr
Size: 4 bytes (32 bits)
In sets: general (index 0)
| 31 | 30 | 29 | 28 | 27-26 | 25 | 24 | 23 | 22 | 21 | 20 | 19-13 | 12 | 11-10 | 9 | 8 | 7 | 6 | 5 | 4 | 3-2 | 1 | 0 |
|----|----|----|----|-------|-----|-----|-----|-----|----|----|-------|------|-------|---|---|---|---|---|-----|-----|---|----|
| N | Z | C | V | | TCO | DIT | UAO | PAN | SS | IL | | SSBS | | D | A | I | F | | nRW | EL | | SP |
```
LLDB limits the max terminal width to 80 chars by default.
So to get that full width output you will need to change the "term-width"
setting to something higher.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D152918
Nikita Popov [Wed, 21 Jun 2023 10:40:23 +0000 (12:40 +0200)]
[RewriteStatepointsForGC] Convert tests to opaque pointers (NFC)
Felipe de Azevedo Piovezan [Thu, 15 Jun 2023 12:18:51 +0000 (08:18 -0400)]
[AppleTables] Implement iterator over all entries in table
This commit adds functionality to the Apple Accelerator table allowing iteration
over all elements in the table.
Our iterators look like streaming iterators: when we increment the iterator we
check if there is still enough data in the "stream" (in our case, the blob of
data of the accelerator table) and extract the next entry. If any failures
occur, we immediately set the iterator to be the end iterator.
Since the ultimate user of this functionality is LLDB, there are roughly two
iteration methods we want support: one that also loads the name of each entry,
and one which does not. Loading names is measurably slower (one order the
magnitude) than only loading DIEs, so we used some template metaprograming to
implement both iteration methods.
Depends on D153066
Differential Revision: https://reviews.llvm.org/D153066
Jolanta Jensen [Wed, 17 May 2023 09:21:40 +0000 (09:21 +0000)]
[SVE ACLE] Implement IR combines to convert intrinsics used for _m C/C++ builtins
This patch implements IR combines to convert intrinsics used for _m C/C++ builtins
which take an all active predicate to their equivalent _u intrinsic.
Differential Revision: https://reviews.llvm.org/D152005
Kishan Parmar [Wed, 21 Jun 2023 10:16:43 +0000 (10:16 +0000)]
PowerPC/SPE: Add phony registers for high halves of SPE SuperRegs
The intent of this patch is to make upper halves of SPE SuperRegs(s0,..,s31)
as artificial regs, similar to how X86 has done it.
And emit store /reload instructions for the required halves.
PR : https://github.com/llvm/llvm-project/issues/57307
Reviewed By: jhibbits
Differential Revision: https://reviews.llvm.org/D152437
Alexey Lapshin [Fri, 16 Jun 2023 21:13:47 +0000 (23:13 +0200)]
[DWARFLinker][DWARFv5] change emitSLEB128IntValue with emitULEB128IntValue for ranges.
This patch changes emitSLEB128IntValue with emitULEB128IntValue
for length part of address range of DW_RLE_start_length kind. DWARFv5
standard:
DW_RLE_start_length
This is a form of bounded range entry that has one target address operand
value and an unsigned LEB128 integer length operand value.
Differential Revision: https://reviews.llvm.org/D153334
Takuya Shimizu [Wed, 21 Jun 2023 10:03:01 +0000 (19:03 +0900)]
[Clang][Interp] Diagnose uninitialized ctor of global record arrays
This patch adds a check for uninitialized subobjects of global variables that are record arrays.
e.g. `constexpr Foo f[2];`
Reviewed By: tbaeder
Differential Revision: https://reviews.llvm.org/D152548
Ingo Müller [Tue, 20 Jun 2023 14:36:33 +0000 (14:36 +0000)]
[mlir][CRunnerUtils] Use explicit execution engine symbol registration.
As a follow up of https://reviews.llvm.org/D153250, this path uses the
explicit symbol registration mechanism of the execution engine in the
CRunnerUtils library.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D153354
David Spickett [Wed, 21 Jun 2023 09:33:35 +0000 (09:33 +0000)]
[lldb] Correct spelling in RegisterFlags comments
I missed these review comments on https://reviews.llvm.org/D152917
before landing it.
Nikita Popov [Wed, 21 Jun 2023 09:27:49 +0000 (11:27 +0200)]
[Inline] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 21 Jun 2023 09:27:30 +0000 (11:27 +0200)]
[Inline] Regenerate test checks (NFC)
David Spickett [Mon, 5 Jun 2023 17:02:09 +0000 (17:02 +0000)]
[LLDB] Add table formatting for register fields
This will be used by the "register info" command to show
the layout of register contents. For example if we have
these fields coming in from XML:
```
<field name="D" start="0" end="7"/>
<field name="C" start="8" end="15"/>
<field name="B" start="16" end="23"/>
<field name="A" start="24" end="31"/>
```
We get:
```
| 31-24 | 23-16 | 15-8 | 7-0 |
|-------|-------|------|-----|
| A | B | C | D |
```
Note that this is only the layout, not the values.
For values, use "register read".
The tables' columns are center padded (left bias
if there's an odd padding) and will wrap if the terminal width
is too low.
```
| 31-24 | 23-16 |
|-------|-------|
| A | B |
| 15-8 | 7-0 |
|------|-----|
| C | D |
```
This means we match the horizontal format seen in many architecture
manuals but don't spam the user with lots of misaligned text when the
output gets very long.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D152917
Nikita Popov [Wed, 21 Jun 2023 09:20:15 +0000 (11:20 +0200)]
[ConstantHoisting] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 21 Jun 2023 09:19:58 +0000 (11:19 +0200)]
[ConstantHoisting] Regenerate test checks (NFC)
Christian Sigg [Wed, 21 Jun 2023 09:15:09 +0000 (11:15 +0200)]
[Bazel][mlir] Fix ODR violation introduced in 7ab749c.
Chuanqi Xu [Wed, 21 Jun 2023 08:57:27 +0000 (16:57 +0800)]
[C++20] [Modules] Use the canonical decl when getting associated constraints
Close https://github.com/llvm/llvm-project/issues/62943.
The root cause for the issue is that we think the associated constraints
from the 'same' declaration in different module units are different
incorrectly. Since the constraints doesn't know anything about decls and
modules, we should fix the problem by getting the associated constraints
from the exactly the same declarations from different modules.
LLVM GN Syncbot [Wed, 21 Jun 2023 08:50:28 +0000 (08:50 +0000)]
[gn build] Port
ba85f206fe6f
David Spickett [Wed, 1 Mar 2023 11:03:01 +0000 (11:03 +0000)]
[lldb] Add "register info" command
This adds a new command that will show all the information lldb
knows about a register.
```
(lldb) register info s0
Name: s0
Size: 4 bytes (32 bits)
Invalidates: v0, d0
Read from: v0
In sets: Floating Point Registers (index 1)
```
Currently it only allows a single register, and we get the
information from the RegisterInfo structure.
For those of us who know the architecture well, this information
is all pretty obvious. For those who don't, it's nice to have it
at a glance without leaving the debugger.
I hope to have more in depth information to show here in the future,
which will be of wider use.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D152916
Aiden Grossman [Wed, 21 Jun 2023 08:42:36 +0000 (08:42 +0000)]
Revert "[llvm-exegesis] Introduce SubprocessMemory Utility Class"
This reverts commit
1b9b78fd481a13b54afaf4804ee4ad18fcf006fd.
There are spurious test failures on the ml-* bots and some of the ARM
builders are complaining about shm_open being missing. Pulling this
commit so that I can investigate after I sleep.
WANG Xuerui [Wed, 21 Jun 2023 08:04:57 +0000 (16:04 +0800)]
[LoongArch] Support CodeModel::Large codegen
This is intended to behave like GCC's `-mcmodel=extreme`.
Technically the true GCC equivalent would be `-mcmodel=large` which is
not yet implemented there, and we probably do not want to take the
"Large" name until things settle in GCC side, but:
* LLVM does not have a `CodeModel::Extreme`, and it seems too early to
have such a variant added just for enabling LoongArch; and
* `CodeModel::Small` is already being used for GCC `-mcmodel=normal`
which is already a case of divergent naming.
Regarding the codegen, loads/stores immediately after a PC-relative
large address load (that ends with something like `add.d $addr, $addr,
$tmp`) should get merged with the addition into corresponding `ldx/stx`
ops, but is currently not done. This is because pseudo-instructions are
expanded after instruction selection, and is best fixed with a separate
change.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D150522
Dávid Bolvanský [Wed, 21 Jun 2023 08:24:06 +0000 (10:24 +0200)]
ReleaseNotes: __builtin_unpredictable is now handled by X86 Backend
Job Noorman [Wed, 21 Jun 2023 08:20:27 +0000 (10:20 +0200)]
[BOLT][RISCV] Fix implementation of getTargetSymbol
- Correctly handle OpNum == 0 (auto select operand)
- Implement MCExpr overload
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D153343
Job Noorman [Wed, 21 Jun 2023 08:20:14 +0000 (10:20 +0200)]
[BOLT][RISCV] Implement branch reversal
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D153344
Job Noorman [Wed, 21 Jun 2023 08:20:04 +0000 (10:20 +0200)]
[BOLT][RISCV] Implement return/unconditional branch creation
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D153342
Aiden Grossman [Sat, 20 May 2023 09:50:43 +0000 (09:50 +0000)]
[llvm-exegesis] Introduce SubprocessMemory Utility Class
This patch introduces the SubprocessMemory class to llvm-exegesis. This
class contains several utilities that are needed for managing memory to
set up an execution environment for memory annotations.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D151022
Christian Sigg [Wed, 21 Jun 2023 08:11:46 +0000 (10:11 +0200)]
[mlir] #include CRunnerUtils.h instead of RunnerUtils.h in SPIRV-runner
This avoids bazel builds failing after commit
bba2b656110209a3d9863b92c060082479b06ab1 because libmlir_test_spirv_cpu_runner_c_wrappers.so registers the same runner functions twice.
More precisely, this problem only shows up internally at Google because the bazel build does not have that target.
Either way though, it's better to IWYU.
Aiden Grossman [Sat, 20 May 2023 09:23:27 +0000 (09:23 +0000)]
[llvm-exegesis] Introduce Subprocess Executor Mode
This patch introduces the subprocess executor mode. Currently, this new
mode doesn't do anything fancy, just executing the same code that the
inprocess executor would do, but within a subprocess. This sets up the
ability to add in many more memory-related features in the future.
LLVM GN Syncbot [Wed, 21 Jun 2023 07:42:21 +0000 (07:42 +0000)]
[gn build] Port
c9e08fa60666
WuXinlong [Wed, 21 Jun 2023 07:40:33 +0000 (15:40 +0800)]
[RISCV] Add a pass to merge moving parameter registers instructions for Zcmp
This patch adds a pass to generate `cm.mvsa01` & `cm.mva01s`.
RISCVMoveOptimizer.cpp which combines two mv inst into one cm.mva01s or cm.mva01s.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150415
Matthias Springer [Wed, 21 Jun 2023 07:17:32 +0000 (09:17 +0200)]
[mlir][linalg][NFC] Add test case for memref vectorization
Add test cases for vectorizing linalg.matmul and linalg.copy on tensors.
Differential Revision: https://reviews.llvm.org/D153357
Matthias Springer [Wed, 21 Jun 2023 07:10:45 +0000 (09:10 +0200)]
[mlir][linalg] TileToForallOp: Support memref ops
Support tiling of ops with memref semantics.
Differential Revision: https://reviews.llvm.org/D153353
Petr Hosek [Fri, 9 Jun 2023 07:12:58 +0000 (07:12 +0000)]
[libc] Support for riscv32
This change adds basic support for baremetal riscv32 configuration.
Differential Revision: https://reviews.llvm.org/D152563
Craig Topper [Wed, 21 Jun 2023 07:10:37 +0000 (00:10 -0700)]
[RISCV] Add errors for mixing Zcmp with C/Zcd and D.
We already had an error for Zcmt though it appears to be untested
Add similar one for Zcmp along with tests for both.
Factor the code to share the strings as much as possible.
Reviewed By: VincentWu
Differential Revision: https://reviews.llvm.org/D153159
Matthias Springer [Wed, 21 Jun 2023 06:51:24 +0000 (08:51 +0200)]
[mlir][Interfaces] TilingInterface: Add test case for linalg.copy on memrefs
Differential Revision: https://reviews.llvm.org/D153347
Matthias Springer [Wed, 21 Jun 2023 06:47:06 +0000 (08:47 +0200)]
[mlir][tensor][NFC] TilingInterface: Use Attribute instead of Value
Minor cleanup to take full advantage of OpFoldResult.
Differential Revision: https://reviews.llvm.org/D153341
Matthias Springer [Tue, 20 Jun 2023 15:53:44 +0000 (17:53 +0200)]
[mlir][bufferization] Allow to_memref ops in One-Shot Analysis
bufferization.to_memref ops are allowed in One-Shot Bufferize, but they are treated conservatively: in the absence of a memref analysis, we have to assume that the result buffer is read and written.
Note: to_memref cannot introduce any future aliases that would have to be considered during One-Shot Bufferize, because only to_tensor ops with the `restrict` attribute are supported. Such tensors are guaranteed to not alias with any other buffer after bufferization.
Differential Revision: https://reviews.llvm.org/D153365
tianleli [Wed, 21 Jun 2023 03:05:46 +0000 (11:05 +0800)]
[DAG] Unroll and expand illegal result of LDEXP and POWI instead of widen.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D153104
Mark de Wever [Sun, 16 Apr 2023 10:21:38 +0000 (12:21 +0200)]
[libc++][format] Adds formattable-with concept.
This change has a few additional effects:
- Abstract classes are now formattable.
- Volatile objects are no longer formattable.
Implements
- LWG3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout
- LWG3925 Concept formattable's definition is incorrect
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D152092
Fangrui Song [Wed, 21 Jun 2023 05:40:56 +0000 (22:40 -0700)]
[XRay] Make xray_fn_idx entries PC-relative
As mentioned by commit
c5d38924dc6688c15b3fa133abeb3626e8f0767c (Apr 2020),
PC-relative entries avoid dynamic relocations and can therefore make the
section read-only.
This is similar to D78082 and D78590. We cannot commit to support
compiler/runtime built at different versions, so just don't play with versions.
For Mach-O support (incomplete yet), we use non-temporary `lxray_fn_idx[0-9]+`
symbols. Label differences are represented as a pair of UNSIGNED and SUBTRACTOR
relocations. The SUBTRACTOR external relocation requires r_extern==1 (needs to
reference a symbol table entry) which can be satisfied by `lxray_fn_idx[0-9]+`.
A `lxray_fn_idx[0-9]+` symbol also serves as the atom for this dead-strippable
section (follow-up to commit
b9a134aa629de23a1dcf4be32e946e4e308fc64d).
Differential Revision: https://reviews.llvm.org/D152661
Siva Chandra Reddy [Tue, 20 Jun 2023 21:36:53 +0000 (21:36 +0000)]
[libc] Make close function of the internal File class cleanup the file object.
Before this change, a separate static method named cleanup was used to
cleanup the file. Instead, now the close method cleans up the full file
object using the platform's close function.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D153377
Craig Topper [Wed, 21 Jun 2023 04:52:14 +0000 (21:52 -0700)]
[RISCV] Reduce some duplicate code in lowerBUILD_VECTOR. NFC
The code at the beginning of the loop body and after the loop are
identifical. Move it to the end of the loop body by making a few
adjustments.
Craig Topper [Wed, 21 Jun 2023 03:45:28 +0000 (20:45 -0700)]
[docs][TableGen][Target] Improve the documentation of the attribute value for SubtargetFeature.
The value "true" and "false" are treated specially and other values are treated as integers.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D153180
Fangrui Song [Wed, 21 Jun 2023 03:50:06 +0000 (20:50 -0700)]
[lld-macho][test] Make reloc-subtractor.s robust
The test requires that LLVM integreated assembler generates
SUBTRACTOR/UNSIGNED relocations for `.long _minuend_1 - _subtrahend_1`.
This currently works by luck because:
* `_minuend_1` and `_subtrahend_1` are in different fragments (separated by a MCFillFragment)
* and the result is known to be negative at parsing time.
D153096 will change the assembler to fold `.long _minuend_1 - _subtrahend_1` to
a constant, giving ld -order_file no chance to change the result.
To fix the test, move the referenced labels after the label differences to block
constant folding.
Note: you may think the model is somewhat broken and it is. The
.subsections_via_symbols mechanism does not block such constant folding. In
reality SUBTRACTOR/UNSIGNED is for references to another section, which does not
have the problem.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D153382
Oleksii Lozovskyi [Wed, 21 Jun 2023 03:47:32 +0000 (20:47 -0700)]
[Driver] Allow XRay on Apple Silicon
Codegen can handle XRay for AArch64, tell the driver to allow it.
Differential Revision: https://reviews.llvm.org/D145849
Amir Ayupov [Wed, 21 Jun 2023 03:43:53 +0000 (20:43 -0700)]
[BOLT] Set IsRelro section attribute based on PT_GNU_RELRO segment
Handle PT_GNU_RELRO segment in accordance with Linux Standard Base spec
chapter 12:
> PT_GNU_RELRO
> The array element specifies the location and size of a segment which may
> be made *read-only* after relocations have been processed.
Perform a readelf-style mapping check between this segment and sections,
set `IsRelro` section attribute.
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D152944
Fangrui Song [Wed, 21 Jun 2023 03:41:54 +0000 (20:41 -0700)]
[Driver] Allow XRay for more architectures on ELF systems
Codegen OS-agnostic for ELF and the runtime is mostly OS-agnostic. It
seems unnecessary to make restriction.
While here, rewrite test/Driver/XRay/xray-instrument*.c to be more conventional:
specify --target= explicitly instead of relying on the configured default target
(which needs `REQUIRES:`).
I am not sure enumerating every supported architecture is useful, so we just test a few.
Aiden Grossman [Wed, 21 Jun 2023 02:28:35 +0000 (02:28 +0000)]
Revert "[llvm-exegesis] Introduce Subprocess Executor Mode"
This reverts commit
0d4ef4ff01addbb40b9122a00d6b2f23104cbb3b.
This was causing build failures on certain platforms when built with
-Werror due to unused variable warnings in addition to causing build
failures on Linux systems with older kernel versions as kernels prior to
v5.15 don't support sys_pidfd_getpid. Reverting as I need to setup a
system to properly test the rest of the patches in this series.
Also reverts
8c6668fa42dba59ddc286ba256d71c1b9c5228b8 which fixed the
first issue so that the patch can actually be reverted.
Jie Fu [Wed, 21 Jun 2023 02:19:56 +0000 (10:19 +0800)]
[llvm-exegesis] Fix -Wunused-variable in BenchmarkRunner.cpp (NFC)
/data/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:275:9: error: unused variable 'ParentPIDFD' [-Werror,-Wunused-variable]
int ParentPIDFD = syscall(SYS_pidfd_open, ParentPID, 0);
^
1 error generated.
Stella Laurenzo [Wed, 21 Jun 2023 01:38:45 +0000 (18:38 -0700)]
Convert MLIR IndentedOstream to header only.
This class has been causing me no end of grief for a long time, and the way it is used by mlir-tblgen is technically an ODR violation in certain situations.
Due to the way that the build is layered, it is important that the MLIR tablegen libraries only depend on the LLVM tablegen libraries, not on anything else (like MLIRSupport). It has to be this way because these libraries/binaries are special and must pre-exist the full shared libraries. Therefore, the dependency chain must be clean (and static).
At some point, someone pulled out a separate build target for just IndendedOstream in an attempt to satisfy the constraint. But because it is weird in different ways, this target was never installed properly as part of distributions, etc -- this causes problems for downstreams seeking to build a tblggen binary that doesn't itself have ODR/shared library problems.
I was attempting to fix the distribution stuff but just opted to collapse this into a header-only library and not try to solve this with build layering. I think this is the safest and the least bad thing for such a dep. This also makes for a clean comment that actually explains the constraint (which I was having trouble verbalizing with the weird subset dependency).
Differential Revision: https://reviews.llvm.org/D153393
Aiden Grossman [Sat, 20 May 2023 09:23:27 +0000 (09:23 +0000)]
[llvm-exegesis] Introduce Subprocess Executor Mode
This patch introduces the subprocess executor mode. Currently, this new
mode doesn't do anything fancy, just executing the same code that the
inprocess executor would do, but within a subprocess. This sets up the
ability to add in many more memory-related features in the future.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D151021
Matt Arsenault [Tue, 25 Apr 2023 23:03:18 +0000 (19:03 -0400)]
ValueTracking: Ignore -0 for nsz sqrt with UseInstrInfo in computeKnownFPClass
This avoids a regression when SignBitMustBeZero is moved to computeKnownFPClass.
Arthur Eubanks [Wed, 21 Jun 2023 01:18:59 +0000 (18:18 -0700)]
[test] Regenerate test checks
Aiden Grossman [Sat, 20 May 2023 08:55:47 +0000 (08:55 +0000)]
[llvm-exegesis] Add ability to assign perf counters to specific PID
This patch gives the ability to assign performance counters within
llvm-exegesis to a specific process by passing its PID. This is needed
later on for implementing a subprocess executor. Defaults to zero, the
current process, for the InProcessFunctionExecutorImpl.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D151020
Amy Huang [Mon, 7 Nov 2022 23:29:27 +0000 (15:29 -0800)]
Try to implement lambdas with inalloca parameters by forwarding without use of inallocas.
Differential Revision: https://reviews.llvm.org/D137872
Aiden Grossman [Wed, 21 Jun 2023 00:04:48 +0000 (00:04 +0000)]
[llvm-exegesis] Refactor FunctionExecutorImpl and create factory
In order to better support adding in new implementations of
FunctionExecutor, this patch makes some small changes so that it is
easier to add new ones in. FunctionExecutorImpl is renamed to
InProcessFunctionExecutorImpl to better reflect how it will be placed
relative to the soon-to-be introduced subprocess executor and a new
function is created to create executors so selection can be done more
easily. In addition, a new CLI flag, -execution-mode, which can be used
to select between the different executors.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D151019
Kazuki Sakamoto [Wed, 14 Jun 2023 16:03:35 +0000 (09:03 -0700)]
[lldb][Android] Add platform.plugin.remote-android.package-name
When LLDB fails to pull file from a package directory due to security
constraint, user needs to set the package name to
'platform.plugin.remote-android.package-name' property to run shell commands
as the package user. (e.g. to get file with 'cat' and 'dd').
https://cs.android.com/android/platform/superproject/+/master:
system/core/run-as/run-as.cpp;l=39-61;
drc=
4a77a84a55522a3b122f9c63ef0d0b8a6a131627
Differential Revision: https://reviews.llvm.org/D152933
Kazuki Sakamoto [Tue, 13 Jun 2023 20:51:25 +0000 (13:51 -0700)]
[lldb][Android] Add PlatformAndroidTest
To test D152759 [lldb][Android] Support zip .so file
introduce PlatformAndroidTest with the capability of mocking adb client.
Differential Revision: https://reviews.llvm.org/D152855
Aart Bik [Tue, 20 Jun 2023 19:27:09 +0000 (12:27 -0700)]
[mlir][sparse][gpu] extend SDDMM gpu test
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D153378
Leonard Grey [Thu, 15 Jun 2023 22:31:27 +0000 (18:31 -0400)]
[lsan] Remove use_tls=0 from a few tests
The Objective-C runtime now stashes some state in TLS so any
test that indirectly initializes an Objective-C object will
have false positive leaks unless use_tls=1 as is the default.
Differential Revision: https://reviews.llvm.org/D153081
Alexey Karyakin [Tue, 20 Jun 2023 22:32:42 +0000 (15:32 -0700)]
[llvm-objcopy] -O binary: do not align physical addresses
llvm-objcopy should not insert padding before a section if its
physical addresses is not aligned to section's alignment. This
behavior will match GNU objcopy and is important for embedded images
where the physical address is used to store the initial data image.
The loader typically will copy this image using a start symbol
created by the linker. If llvm-objcopy inserts padding before such a
section, the symbol address will not match the location in the image.
This commit refines the change in https://reviews.llvm.org/D128961
which intended to align sections which type changed from NOBITS and
their offset may not be aligned. However, it affected all sections.
Fix https://github.com/llvm/llvm-project/issues/62636
Reviewed By: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D150276
LLVM GN Syncbot [Tue, 20 Jun 2023 22:42:05 +0000 (22:42 +0000)]
[gn build] Port
12dee9d3cd76
Kazuki Sakamoto [Mon, 12 Jun 2023 17:49:54 +0000 (10:49 -0700)]
[lldb][Android] Support zip .so file
In Android API level 23 and above, dynamic loader is able to load .so file
directly from APK, which is zip file.
https://android.googlesource.com/platform/bionic/+/master/
android-changes-for-ndk-developers.md#
opening-shared-libraries-directly-from-an-apk
The .so file is page aligned and uncompressed, so
ObjectFileELF::GetModuleSpecifications works with .so file offset and size
directly from zip file without extracting it. (D152757)
GDBRemoteCommunicationServerCommon::GetModuleInfo returns a module spec to LLDB
with "zip_path!/so_path" file spec, which is passed through from Android
dynamic loader, and the .so file offset and size.
PlatformAndroid::DownloadModuleSlice uses 'shell dd' to download the .so file
slice from the zip file with the .so file offset and size.
Differential Revision: https://reviews.llvm.org/D152759
Amir Ayupov [Tue, 20 Jun 2023 22:17:44 +0000 (15:17 -0700)]
[BOLT] Sort CallSiteInfo targets by symbol name in YAMLWriter
Align YAML and fdata profiles by sorting CallSiteInfo targets by symbol name,
aligning it to fdata. By default, YAML CallSiteInfo is sorted by function id,
which is the order of function in the binary.
Follow-up to D152731, aligning yaml vs fdata, and in turn all three between to
each other.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D152733
Kazuki Sakamoto [Mon, 12 Jun 2023 16:07:53 +0000 (09:07 -0700)]
[lldb][ObjectFileELF] Set ModuleSpec file offset and size
In Android API level 23 and above, dynamic loader is able to load .so file
directly from APK.
https://android.googlesource.com/platform/bionic/+/master/
android-changes-for-ndk-developers.md#
opening-shared-libraries-directly-from-an-apk
ObjectFileELF::GetModuleSpecifications will load a .so file, which is page
aligned and uncompressed, directly from a zip file. However it does not
set the .so file offset and size to the ModuleSpec. Also crc32 calculation
uses more data than the .so file size.
Set the .so file offset and size to the ModuleSpec, and set the size to
MapFileData length argument. For normal file, file_offset should be zero,
and length should be the size of the file.
Differential Revision: https://reviews.llvm.org/D152757
Krzysztof Parzyszek [Tue, 20 Jun 2023 21:45:40 +0000 (14:45 -0700)]
Revert "[llvm-objcopy] -O binary: do not align physical addresses"
This reverts commit
eb1442d0f73c76cfb5051d133f858fe760d189cf.
The test tools/llvm-objcopy/ELF/binary-paddr.test fails on
ppc64be-clang-test-suite:
https://lab.llvm.org/buildbot#builders/231/builds/13120
Reverting at author's request.
Kazu Hirata [Tue, 20 Jun 2023 21:15:51 +0000 (14:15 -0700)]
[SelectionDAG] Remove isNullValue and isAllOnesValue
These functions have been deprecated since:
commit
f271e5d9d44e833ef2264e5b0e9aa5f8383c173d
Author: Kazu Hirata <kazu@google.com>
Date: Sun Mar 12 18:25:07 2023 -0700
Differential Revision: https://reviews.llvm.org/D153317
Stella Laurenzo [Tue, 20 Jun 2023 20:03:46 +0000 (13:03 -0700)]
Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var.
It looks like MLIR is using the more modern CMAKE_LIBRARY_OUTPUT_DIRECTORY, but AddLLVM still uses this older LLVM specific alias.
In the specific case I was running into, the empty variable was causing `-Wl,-rpath-link,` on the command line, causing the following argument to be swallowed. This was maddening, because the following argument was the .o file containing `main` and I was getting `main` undefined errors when it was clearly there. This is egregious enough that I chose to guard it.
Differential Revision: https://reviews.llvm.org/D153373