464673 Commits

Author SHA1 Message Date
Nikolas Klauser
31eeba3f7c [libc++] Introduce __make_uninitialized_buffer and use it instead of get_temporary_buffer
This will also be used in some PSTL backends.

Reviewed By: ldionne, #libc, Mordante

Spies: arichardson, mstorsjo, Mordante, sstefan1, jplehr, libcxx-commits

Differential Revision: https://reviews.llvm.org/D152208
2023-06-16 07:53:56 -07:00
Ingo Müller
0b3841eb97 [mlir] Move symbol loading from mlir-cpu-runner to ExecutionEngine.
Both the mlir-cpu-runner and the execution engine allow to provide a
list of shared libraries that should be loaded into the process such
that the jitted code can use the symbols from those libraries. The
runner had implemented a protocol that allowed libraries to control
which symbols it wants to provide in that context (with a function
called __mlir_runner_init). In absence of that, the runner would rely on
the loading mechanism of the execution engine, which didn't do anything
particular with the symbols, i.e., only symbols with public visibility
were visible to jitted code.

Libraries used a mix of the two mechanisms: while the runner utils and C
runner utils libs (and potentially others) used public visibility, the
async runtime lib (as the only one in the monorepo) used the loading
protocol. As a consequence, the async runtime library could not be used
through the Python bindings of the execution engine.

This patch moves the loading protocol from the runner to the execution
engine. For the runner, this should not change anything: it lets the
execution engine handle the loading which now implements the same
protocol that the runner had implemented before. However, the Python
binding now get to benefit from the loading protocol as well, so the
async runtime library (and potentially other out-of-tree libraries) can
now be used in that context.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D153029
2023-06-16 14:50:14 +00:00
Kazu Hirata
55ed7ba7ab [Driver] Use DenseSet::contains (NFC) 2023-06-16 07:48:20 -07:00
Kazu Hirata
b188f9f597 [BOLT] Use {StringMap,DenseMapBase}::lookup (NFC) 2023-06-16 07:48:19 -07:00
Jay Foad
2124759528 [AMDGPU] Regenerate llvm.amdgcn.s.buffer.load checks 2023-06-16 15:21:17 +01:00
Simon Pilgrim
0342aefa32 [GlobalISel][X86] Add handling of scalar G_UADDO/G_USUBO opcodes
This finally allows x86 globalisel to lower addition/subtraction of illegal types without fallback :)
2023-06-16 15:15:27 +01:00
Saleem Abdulrasool
e944f4c950 Revert "[lit] Avoid os.path.realpath in lit.py due to MAX_PATH limitations on Windows"
This reverts commit c1cf459cbd79cc7d6ca834390649fb9185a4b237.

Reverting to permit time to explore the underlying issue.  This change
regressed the clang-PPC64-AIX and m68k-linux-cross builders.

Differential Revision: https://reviews.llvm.org/D153138
Reviewed By: compnerd
2023-06-16 07:10:35 -07:00
Timm Bäder
1e9ac71787 [clang][Interp] Handle PredefinedExprs
Differential Revision: https://reviews.llvm.org/D148689
2023-06-16 15:52:12 +02:00
Nikita Popov
b7bd3a734c [CGP] Fix infinite loop in icmp operand swapping
Don't swap the operands if they're the same. Fixes the issue reported
at https://reviews.llvm.org/D152541#4427017.
2023-06-16 15:50:12 +02:00
Louis Dionne
5e73fda53c [libc++][NFC] Consistently qualify malloc and free calls with std:: 2023-06-16 09:40:31 -04:00
Louis Dionne
d53cf0fdd1 [libc++] Make libc++ and libc++abi's definitions of operator new be exact copies
This allows mechanically copying any changes made to `operator new`
from libc++ into libc++abi as-is. This is also a step towards
de-duplicating this code entirely.

Differential Revision: https://reviews.llvm.org/D153035
2023-06-16 09:40:08 -04:00
Timm Bäder
459f495f49 [clang][Interp] Check inc/dec family of ops for initialization
Differential Revision: https://reviews.llvm.org/D149846
2023-06-16 15:19:23 +02:00
Alan Hu
dddf66fd65 [OCaml] Rename link_modules' to link_modules
Commit 434e956 renamed link_modules to link_modules' for unclear reasons.
Based on the commit's diff, the author possibly intended to have two
functions, link_modules to bind to LLVMLinkModules and link_modules' to
bind to LLVMLinkModules2. However, there is only one function. link_modules'
appears in LLVM 3.8 onwards.

Differential Revision: https://reviews.llvm.org/D153090
2023-06-16 09:18:26 -04:00
Haojian Wu
b472176829 [clangd] Remove unused includes in IncludeCleaner.cpp, NFC 2023-06-16 15:15:07 +02:00
Nikita Popov
f9f8517e03 [InstCombine][AArch64] Fix phi insertion point
Fix the issue reported at https://reviews.llvm.org/rG724f4a5bac25#inline-9083,
by specifying the correct insertion point for the new phi.
2023-06-16 14:58:33 +02:00
Nikita Popov
f10103ba59 [InstCombine] Regenerate test checks (NFC) 2023-06-16 14:50:16 +02:00
Simon Pilgrim
91afb4b769 [GlobalISel][X86] Add handling of scalar G_USUBE opcodes
Extend the G_UADDE handling to also support G_USUBE
2023-06-16 13:31:50 +01:00
Hans Wennborg
6fa1a2c084 [X86] Fix callee side of receiving byval args on the stack
See the discussion in
https://discourse.llvm.org/t/generic-llvm-ir-windows-x64-argument-passing-issue-in-llvm-11-0-0-and-later/71350

D51842 implemented byval lowering for Win64. D83175 made the call
lowering honor the "from now on treat this as a regular pointer" comment
also when the argument gets passed on the stack. However, it didn't
update the callee side.

Differential revision: https://reviews.llvm.org/D153020
2023-06-16 14:11:21 +02:00
Viktoriia Bakalova
c9888dce44 [clangd] Skip function parameter decls when evaluating variables on hover.
Differential Revision: https://reviews.llvm.org/D153015
2023-06-16 12:09:28 +00:00
Guray Ozen
d0233ccbf8 [mlir][nvvm] Introduce mbarrier.arrive
It introduces `mbarrier.arrive` that are in ptx78.

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D153021
2023-06-16 13:53:03 +02:00
Guray Ozen
4b38d17ff5 [mlir][nvvm] Introduce mbarrier.inval
Introduce support for PTX's `mbarrier.inval` .

Contiunation of D151334

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D151338
2023-06-16 13:39:11 +02:00
Guray Ozen
58950d4add [mlir][nvvm] Implement mbarrier.init
NV GPUs provides split arrive/wait barriers that one can syncronize a subgroup of threads in CTA. It is particularly important for Hopper GPUs and allows tracking engines like TMA. See for more details:
https://docs.nvidia.com/cuda/parallel-thread-execution/#parallel-synchronization-and-communication-instructions-mbarrier

This initial implementation sets the foundation for future enhancements and additions.

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D151334
2023-06-16 13:35:14 +02:00
Jay Foad
da7892f729 [MC] Use regunits instead of MCRegUnitIterator. NFC.
Differential Revision: https://reviews.llvm.org/D153122
2023-06-16 12:21:32 +01:00
Benjamin Kramer
7ae49609fd [bazel][mlir] Port 65305aeab99ad8ea09dd85e28a41c657152a08fb 2023-06-16 13:20:32 +02:00
Nikita Popov
2903a8ab07 [CGTypes] Remove recursion protection
With opaque pointers, it should no longer be necessary to protect
against recursion when converting Clang types to LLVM types, as
recursion can only be introduced via pointer types.

Differential Revision: https://reviews.llvm.org/D152999
2023-06-16 13:07:14 +02:00
Jaroslav Sevcik
af35be55c0 [lldb] Remove unused directive from test for D153043 2023-06-16 12:46:21 +02:00
Simon Pilgrim
cad1eefc7d [GlobalISel][X86] Add s8/s16/s64 handling of G_UADDE opcodes 2023-06-16 11:45:43 +01:00
Nikita Popov
835cdcb919 [Clang] Fix compare-record.c test on s390x (NFC)
s390x looks through pointers when determining the "externally
visible vector ABI". For that reason, the test shows different
behavior just on that platform.

Adjust the test in the reverse direction of what I originall did:
Make sure that the type behind the pointer is always queried, by
dereferencing the pointer.
2023-06-16 12:43:58 +02:00
Jay Foad
d065adcb48 [AMDGPU] Regenerate a few checks 2023-06-16 11:39:03 +01:00
Takuya Shimizu
64083172ee [clang][Sema] Provide source range to several Wunused warnings
When the diagnosed function/variable is a template specialization, the source range covers the specialization arguments.
e.g.
```
warning: unused function 'func<int>' [-Wunused-function]
template <> int func<int> () {}
                ^~~~~~~~~
```
This comes in line with the printed text in the warning message. In the above case, `func<int>`

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D152707
2023-06-16 19:26:53 +09:00
LLVM GN Syncbot
6223b1e76d [gn build] Port f873029386dd 2023-06-16 10:20:24 +00:00
Job Noorman
f873029386 [BOLT] Add minimal RISC-V 64-bit support
Just enough features are implemented to process a simple "hello world"
executable and produce something that still runs (including libc calls).
This was mainly a matter of implementing support for various
relocations. Currently, the following are handled:

- R_RISCV_JAL
- R_RISCV_CALL
- R_RISCV_CALL_PLT
- R_RISCV_BRANCH
- R_RISCV_RVC_BRANCH
- R_RISCV_RVC_JUMP
- R_RISCV_GOT_HI20
- R_RISCV_PCREL_HI20
- R_RISCV_PCREL_LO12_I
- R_RISCV_RELAX
- R_RISCV_NONE

Executables linked with linker relaxation will probably fail to be
processed. BOLT relocates .text to a high address while leaving .plt at
its original (low) address. This causes PC-relative PLT calls that were
relaxed to a JAL to not fit their offset in an I-immediate anymore. This
is something that will be addressed in a later patch.

Changes to the BOLT core are relatively minor. Two things were tricky to
implement and needed slightly larger changes. I'll explain those below.

The R_RISCV_CALL(_PLT) relocation is put on the first instruction of a
AUIPC/JALR pair, the second does not get any relocation (unlike other
PCREL pairs). This causes issues with the combinations of the way BOLT
processes binaries and the RISC-V MC-layer handles relocations:
- BOLT reassembles instructions one by one and since the JALR doesn't
  have a relocation, it simply gets copied without modification;
- Even though the MC-layer handles R_RISCV_CALL properly (adjusts both
  the AUIPC and the JALR), it assumes the immediates of both
  instructions are 0 (to be able to or-in a new value). This will most
  likely not be the case for the JALR that got copied over.

To handle this difficulty without resorting to RISC-V-specific hacks in
the BOLT core, a new binary pass was added that searches for
AUIPC/JALR pairs and zeroes-out the immediate of the JALR.

A second difficulty was supporting ABS symbols. As far as I can tell,
ABS symbols were not handled at all, causing __global_pointer$ to break.
RewriteInstance::analyzeRelocation was updated to handle these
generically.

Tests are provided for all supported relocations. Note that in order to
test the correct handling of PLT entries, an ELF file produced by GCC
had to be used. While I tried to strip the YAML representation, it's
still quite large. Any suggestions on how to improve this would be
appreciated.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D145687
2023-06-16 12:19:36 +02:00
Alexey Lapshin
f9f92f13f6 [DWARFLinker][Reland] Handle DW_OP_GNU_push_tls_address while check for variable location.
The D147066 changed the way how DWARF location expressions are handled.
Now expressions are parsed and their operands are analysed. New handling
misses the DW_OP_GNU_push_tls_address extention. This patch adds handling
DW_OP_GNU_push_tls_address while checking for addresses.

Differential Revision: https://reviews.llvm.org/D153010
2023-06-16 12:02:52 +02:00
Cullen Rhodes
65305aeab9 [mlir][ArmSME] Insert intrinsics to enable/disable ZA
This patch adds two LLVM intrinsics to the ArmSME dialect:

  * llvm.aarch64.sme.za.enable
  * llvm.aarch64.sme.za.disable

for enabling the ZA storage array [1], as well as patterns for inserting
them during legalization to LLVM at the start and end of functions if
the function has the 'arm_za' attribute (D152695).

In the future ZA should probably be automatically enabled/disabled when
lowering from vector to SME, but this should be sufficient for now at
least until we have patterns lowering to SME instructions that use ZA.

N.B. The backend function attribute 'aarch64_pstate_za_new' can be used
manage ZA state (as was originally tried in D152694), but it emits calls
to the following SME support routines [2] for the lazy-save mechanism
[3]:

  * __arm_tpidr2_restore
  * __arm_tpidr2_save

These will soon be added to compiler-rt but there's currently no public
implementation, and using this attribute would introduce an MLIR
dependency on compiler-rt. Furthermore, this mechanism is for routines
with ZA enabled calling other routines with it also enabled. We can
choose not to enable ZA in the compiler when this is case.

Depends on D152695

[1] https://developer.arm.com/documentation/ddi0616/aa
[2] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#sme-support-routines
[3] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#the-za-lazy-saving-scheme

Reviewed By: awarzynski, dcaballe

Differential Revision: https://reviews.llvm.org/D153050
2023-06-16 09:40:48 +00:00
Alexey Lapshin
f8e67c4d0e Revert "[DWARFLinker] Handle DW_OP_GNU_push_tls_address while check for variable location."
This reverts commit e89738451a3830d80fcf23554fd0b297bca60266.
2023-06-16 11:37:11 +02:00
Ivan Kosarev
41717fdee1 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 15.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152908
2023-06-16 10:31:35 +01:00
Cullen Rhodes
e947e76058 [mlir][ArmSME] Extend streaming-mode pass to support enabling ZA
This patch extends the 'enable-arm-streaming' pass with a new option to
enable the ZA storage array by adding the 'arm_za' attribute to
'func.func' ops.

A later patch will insert `llvm.aarch64.sme.za.enable` at the beginning
of 'func.func' ops and `llvm.aarch64.sme.za.disable` before
`func.return` statements when lowering to LLVM dialect.

Currently the pass only supports enabling ZA with streaming-mode on but
the SME LDR, STR and ZERO instructions can access ZA when not in
streaming-mode (section B1.1.1, IDGNQM [1]), so it may be worth making
these options independent in the future.

N.B. This patch is generally useful in the context of SME enablement in
MLIR, but it will help enable writing an integration test for rewrite
pattern that lowers `vector.transfer_write` -> `zero {za}` (D152508).

[1] https://developer.arm.com/documentation/ddi0616/aa

Reviewed By: awarzynski, dcaballe

Differential Revision: https://reviews.llvm.org/D152695
2023-06-16 09:26:42 +00:00
Ivan Kosarev
7a12fbc05f [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 11.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152904
2023-06-16 10:08:32 +01:00
Jianjian GUAN
8846cd3a30 [RISCV][NFC] Simplify code.
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D153095
2023-06-16 17:02:05 +08:00
Alexey Lapshin
e89738451a [DWARFLinker] Handle DW_OP_GNU_push_tls_address while check for variable location.
The D147066 changed the way how DWARF location expressions are handled.
Now expressions are parsed and their operands are analysed. New handling
misses the DW_OP_GNU_push_tls_address extention. This patch adds handling
DW_OP_GNU_push_tls_address while checking for addresses.

Differential Revision: https://reviews.llvm.org/D153010
2023-06-16 10:57:57 +02:00
Théo Degioanni
3bd85cf7c2 [mlir][llvm] Add memcpy support for mem2reg/sroa.
This revision introduces SROA and mem2reg support for the family of
memcpy-like intrinsics (memcpy, memcpy.inline and memmove).

The mem2reg implementation transforms memcpys of full types into loads
and store. Memcpy between two promotable slots always disappear.

The SROA implementation transforms memcpys of *entire* aggregate types
into memcpys of all of their fields.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D152898
2023-06-16 08:35:20 +00:00
Weining Lu
40241935e9 [LoongArch] Some cleanup and readability improvements to LoongArchISelLowering.cpp, NFC 2023-06-16 16:31:48 +08:00
Haojian Wu
3b59842a72 [include-cleaner] Reorder SymbolReference fields to avoid padding space, NFC
This will bring down the size from 40 bytes to 32 bytes.

Differential Revision: https://reviews.llvm.org/D153018
2023-06-16 10:21:44 +02:00
Timm Bäder
461f91b1e4 [clang][Interp] Handle LambdaExprs
Differential Revision: https://reviews.llvm.org/D146030
2023-06-16 10:05:33 +02:00
Pavel Kosov
27f37db76a [llvm-exegesis] Use MCJIT only for execution
Initially, llvm-exegesis was generating the benchmark code for the
host CPU to execute it inside its own process. Thus, MCJIT was reused
for fetching function's bytes to fill the assembled_snippet field in
the benchmark report.

Later, the --mtriple and --benchmark-phase command line options were
introduced that are handy for testing snippet generation even if
snippet execution is not possible. In that setup, MCJIT is asked to
parse an object file for a foreign CPU or operating system that is
probably not guaranteed to succeed and was actually observed to fail
in https://reviews.llvm.org/D145763.

This commit implements a much simplified function's code fetching,
assuming the benchmark function is the only function in the object file
and it spans across the entire text section (note that MCJIT-based code
has more or less the same assumption - see TrackingSectionMemoryManager
class).

~~~

Huawei RRI, OS Lab

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D148921
2023-06-16 10:38:52 +03:00
Kadir Cetinkaya
4d0cfa6d09
[clang] Don't create import decls without -fmodules
When modules are disabled, there's no loaded module for these import
decls to point at. This results in crashes when there are modulemap
files but no -fmodules flag (this configuration is used for layering
check violations).

This patch makes sure import declarations are introduced only when
modules are enabled, which makes this case similar to textual headers
(no import decls are created for #include of textual headers from a
modulemap).

Differential Revision: https://reviews.llvm.org/D152274
2023-06-16 09:26:45 +02:00
Craig Topper
be37d17f1c [RISCV] Fix spelling Compess->Compress. Fix 80 columns. NFC 2023-06-16 00:25:04 -07:00
Jonas Hahnfeld
ce8ff3facc Remove clang/ModuleInfo.txt
The script build-for-llvm-top.sh and LLVM's ModuleInfo.txt are gone
since a long time (commit d20ea7dc59 in November 2011), and llvm-top
itself has even been removed from llvm-archive (it can be found here:
cab7f8f160/llvm-top
) so delete Clang's ModuleInfo.txt as well.

Differential Revision: https://reviews.llvm.org/D152995
2023-06-16 09:11:11 +02:00
Pavel Labath
afe8f20bb8 Revert "[lldb] Rate limit progress reports -- different approach [WIP-ish]"
This reverts commit c30853460da7446f92bc1e516f9cbe2c5df6e136, which I
pushed accidentally -- sorry.
2023-06-16 09:09:56 +02:00
Pavel Labath
244fcecb90 [lldb] Fix MainLoopTest for changes in D152712 2023-06-16 09:05:27 +02:00