Commit Graph

481704 Commits

Author SHA1 Message Date
Benjamin Maxwell
2170252b44 [CI] Add check-mlir-python to MLIR pre-merge checks (#72847)
PR for: https://discourse.llvm.org/t/add-check-mlir-python-to-the-mlir-pre-commit-tests/74041

It’s easy to forget about the Python bindings and not build/test them
locally. It’s also easy to change something that’ll break the python
binding tests and not find out till after you’ve committed your change.

These tests seem to run quickly and don’t require much extra setup, so
let's add them to the general MLIR pre-merge tests.
2023-11-25 09:55:32 +00:00
David Green
9cee94b81b [GlobalISel] Add identity fold for fadd -0.0 (#73296)
-0.0 acts as the identity element for fadd. This doesn't try to add 0.0
too, which would require nsz fast math flags.
2023-11-25 08:35:26 +00:00
Rik Huijzer
c8f6bb452a [mlir][doc] Remove duplicate syntax formats (#73343)
Some operations defined their syntax both in the documentation and via
`assemblyFormat`. This leads to two `Syntax:` subheadings in the
documentation, see for example the documentation for
[`arith.maximumf`](https://mlir.llvm.org/docs/Dialects/ArithOps/#arithmaximumf-arithmaximumfop).
Since the `assemblyFormat` is used to generate the actual parsers and
printer implementations, this PR suggest to remove the manual syntax
descriptions.
2023-11-25 09:33:38 +01:00
Craig Topper
26cf3aab83 [RISCV][GISel] Add more G_SEXTLOAD instruction selection tests. NFC 2023-11-24 23:58:11 -08:00
Craig Topper
f995afe7f2 [RISCV][GISel] Add G_FRAME_INDEX support to selectAddrRegImm.
We can fold the G_FRAME_INDEX into a load/store address.
2023-11-24 23:57:54 -08:00
Yida Zhang
16dc5572fa [MSP430] Add missed mayStore flag for MSP430 PUSH instructions (#73377) 2023-11-24 23:51:02 -08:00
Daniel Chen
024718313b [Flang] Fix a test case that depends on stderr output of nullptr. (#73349)
This test case depends on the stderr output of a `nullptr` being
"(null)". However, it is empty string on AIX.
This PR is to initialize the `sourceFileName_` to be a specific string
to avoid that.
2023-11-24 22:54:01 -05:00
Youngsuk Kim
5ac5c0e7d1 [llvm][X86WinEHState] Replace calls to 'Type::getPointerTo' (NFC)
Work towards to the TODO item of removing method `Type::getPointerTo`
(as noted in llvm/include/llvm/IR/Type.h).
2023-11-24 19:13:20 -06:00
Youngsuk Kim
2ac6b268da [llvm][Transforms][Utils] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort (NFC).
2023-11-24 18:34:42 -06:00
LLVM GN Syncbot
a0a41d106d [gn build] Port 1a3b14d261 2023-11-25 00:24:03 +00:00
Youngsuk Kim
bc85284273 [clang-linker-wrapper] Re-use type returned from 'PointerType::getUnqual(C)' (NFC) (#73374)
Multiple calls to `PointerType::getUnqual(C)`, and calls to
`Type::getPointerTo(AddrSpace=0)` on them all result in the same type.

Clean them up to re-use the same `PtrTy` variable within function
`createRegisterGlobalsFunction()`.
2023-11-24 19:22:02 -05:00
Craig Topper
1a3b14d261 [RISCV] Add C intrinsics for scalar bitmanip and crypto
This adds riscv_bitmanip and riscv_crypto.h

This is based on the proposed spec here https://github.com/riscv-non-isa/riscv-c-api-doc/pull/44

Tests that previously used builtins directly now use the intrinsics.

Reviewed By: wangpc

Differential Revision: https://reviews.llvm.org/D155647
2023-11-24 16:17:22 -08:00
serge-sans-paille
afe8b93ffd [clang] Avoid memcopy for small structure with padding under -ftrivial-auto-var-init (#71677)
Recommit of 0d2860b795 with extra test
cases fixed.
2023-11-25 00:11:20 +01:00
philnik777
12563ea640 [libc++][NFC] Refactor _LIBCPP_AVAILABILITY_HAS_* macros to always be defined (#71002)
This makes the conditionals quite a bit simpler to understand, since it
avoids double negatives and makes sure we have <__availability>
included. For vendors which use availability macros, it also enforces
that they check when specific features are introduced and define the
macro for their platform appropriately.
2023-11-24 23:45:17 +01:00
Lixi Zhou
a3c0f705db [NFC] fix failed ompt tests on M1 device (#65696)
Fix the 2 failed ompt tests on M1 device found on #63194.

```
libomp :: ompt/synchronization/masked.c
libomp :: ompt/synchronization/master.c
```

For the details of this fix, please check the origin discussion in
https://github.com/llvm/llvm-project/issues/63194#issuecomment-1710494689

Thanks @jprotze for the fix.
2023-11-24 23:40:14 +01:00
Raymond Chang
85b2e9c022 [Clang][OpenMP] Emit unsupported directive error (#70233)
Hello!

This PR fixes #63871. Clang should no longer crash and instead emits an
error message.

Below is an example of the new error message:

```
~/dev/fork-llvm-project omp_dispatch_unimpl
❯ ./install/bin/clang -fopenmp  -c -emit-llvm -Xclang -disable-llvm-passes test.c
test.c:6:5: error: cannot compile this OpenMP dispatch directive yet
    6 |     #pragma omp dispatch
      |     ^~~~~~~~~~~~~~~~~~~~
1 error generated.
```
2023-11-24 16:28:32 -05:00
Stefan Gränitz
b86420c614 [JITLink][AArch32] Add dynamic lookup for relocation fixup infos (#71649)
Specifying relocation fixup constants with name and type facilitates
readability and compile-time checks. The `FixupInfo<EdgeKind>` facade
organizes the information into entries per relocation type and provides
uniform access across Arm and Thumb relocations. Since it uses template
specializations, it doesn't limit potential entries. We cannot access
the entries dynamically though, because `EdgeKind` must be given as a
compile-time constant.

With this patch we populate a static lookup table on-demand and use it
for dynamic access in opcode-checks.
2023-11-24 21:45:50 +01:00
Stefan Gränitz
95dcb8b49d [llvm-jitlink] Support plain AArch32 stubs in jitlink-check's stub_addr() expressions (#73268)
We want to use regular `stub_addr()` expressions in `jitlink-check` lines to test the generation of stubs in AArch32, but we don't want this to require a standardized GOT-based PLT implementation. In terms of performance and binary size it doesn't seem beneficial. And in terms of patching branch targets, we should be able to handle range-extension- and interworking-stubs without a lot of extra logic.

In order to allow such AArch32 stubs we add a separate path for `stub_addr()` expressions in `llvm-jitlink-elf`. The relocations in our stubs are not pointing to the GOT, but to the external symbol directly. Thus, we have to avoid access to the block of the edge target. Instead we only return the symbol name, which is enough to use `stub_addr()` expressions in tests.

The name of the AArch32 stubs section differs from the conventional `$__STUBS` on purpose. It allows to add a regular PLT/GOT implementation as an orthogonal feature in the future. In order to also allow decoding of stub target addresses in the future, we mention the stub flavor in the section name as well.
2023-11-24 21:41:00 +01:00
Florian Hahn
20f634f275 [Thumb] Add test case where the machine-outliner clobbers LR.
Add ad test case where `bl OUTLINED_FUNCTION_0` clobbers LR, which in
turn is used the later call to memcpy to return to the caller.
2023-11-24 20:27:43 +00:00
Jakub Kuderski
d625ea12c7 [mlir][spirv] Split codegen for float min/max reductions and others v2. [NFC] (#73363)
This is https://github.com/llvm/llvm-project/pull/69023 but with
cleanups.
Reduced complexity by avoiding CRTP and preprocessor defines in favor of
free functions

Original description by @unterumarmung:

---

This patch is part of a larger initiative aimed at fixing floating-point
`max` and `min` operations in MLIR:
https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671.

There are two types of min/max operations for floating-point numbers:
`minf`/`maxf` and `minimumf`/`maximumf`. The code generation for these
operations should differ from that of other vector reduction kinds. This
difference arises because CL and GL operations for floating-point min
and max do not have the same semantics when handling NaNs. Therefore, we
must enforce the desired semantics with additional ops.

~~However, since the code generation for floating-point min/max
operations shares the same functionality as extracting values for the
vector, we have decided to refactor the existing code using the CRTP
pattern.~~ This change does not alter the actual behavior of the code
and is necessary for future fixes to the codegen for floating-point
min/max operations.

---------

Co-authored-by: Daniil Dudkin <unterumarmung@yandex.ru>
2023-11-24 15:24:45 -05:00
Aiden Grossman
ddc6ef4641 Revert "[llvm-exegesis] Switch from MCJIT to LLJIT (#72838)"
This reverts commit 12b0ab2c9c.

Currently failing on certain configurations due to a missing
constructor. Pulling out so that I can reproduce the issue and make sure
I fix it before resubmitting.
2023-11-24 12:07:50 -08:00
Aiden Grossman
4233176f9b [SimpleLoopUnswitch] Remove callbacks (#73300)
After the removal of the legacyPM version of simple loop unswitch, there
is no longer a need for the callback mechanism to handle PM specific
tasks. This patch removes the callbacks to help simplify the code now
that they're no longer needed.
2023-11-24 11:36:52 -08:00
Aiden Grossman
12b0ab2c9c [llvm-exegesis] Switch from MCJIT to LLJIT (#72838)
This patch switches from using MCJIT to LLJIT as MCJIT is going to be
deprecated soon.

Fixes #41764.
2023-11-24 11:36:20 -08:00
Jakub Kuderski
6ba60390cc [mlir][spirv] Handle all zero-element memref types (#73351)
Bail out of type conversion instead of crashing.

Fixes: https://github.com/llvm/llvm-project/issues/73289
2023-11-24 14:13:34 -05:00
Stefan Pintilie
d896b1f5a6 [PowerPC] Do not string pool globals that are part of llvm used. (#66848)
The string pooling pass was incorrectly pooling global varables that
were part of llvm.used or llvm.compiler.used. This patch fixes the pass
to prevent that by checking each candidate to make sure that it is not
in either of those lists.
2023-11-24 12:21:28 -05:00
Antonio Frighetto
0ff5281c94 [GlobalISel] Treat shift amounts as unsigned in matchShiftImmedChain
A miscompilation issue in the GISel pre-legalization
phase has been addressed with improved routines.

Fixes: https://github.com/llvm/llvm-project/issues/71440.
2023-11-24 18:14:52 +01:00
Craig Topper
d9962c400f [IR] Add disjoint flag for Or instructions. (#72583)
This flag indicates that every bit is known to be zero in at least one
of the inputs. This allows the Or to be treated as an Add since there is
no possibility of a carry from any bit.

If the flag is present and this property does not hold, the result is
poison.

This makes it easier to reverse the InstCombine transform that turns Add
into Or.

This is inspired by a comment here
https://github.com/llvm/llvm-project/pull/71955#discussion_r1391614578

Discourse thread
https://discourse.llvm.org/t/rfc-add-or-disjoint-flag/75036
2023-11-24 08:49:19 -08:00
Craig Topper
5d501b1091 [GISel][RISCV] Fix several boundary cases in narrow G_SEXT_INREG. (#72719)
This fixes cases when SizeInBits is a multiple of the narrow size.

If SizeBits is equal to NarrowTy size, the first block would create an
illegal G_SEXT_INREG where the the extension size is equal to the type.
I tried to turn it into G_TRUNC+G_SEXT, but that just turned back into
G_SEXT_INREG causing an infinite loop. So punt to the splitting case.

In the for loop we should copy when the part ends on SizeInBits. In that
case there is no G_SEXT_INREG needed for partial. But we should note
that register in PartialExtensionReg for the first full part to use.

If the part starts on SizeInBits then we should do an AShr of
PartialExtensionReg.

We should only get to the G_SEXT_INREG case if the SizeInBits is in the
middle of the part.
2023-11-24 08:39:38 -08:00
Mark de Wever
233e7c5de2 [libc++] Removes codecvt. (#72496)
Implements:
- P2871R3 Remove Deprecated Unicode Conversion Facets from C++26
2023-11-24 17:34:30 +01:00
Mark de Wever
92d9f232dd [libc++] Implements Runtime format strings II. (#72543)
Implements
- P2918R2 Runtime format strings II
2023-11-24 17:30:33 +01:00
Kiran Chandramohan
76c4a6e310 [MLIR][OpenMP] NFC: Remove unused variable 2023-11-24 16:22:00 +00:00
Sebastian Poeplau
7091ca1ae3 [clang] Add missing LinkageSpec case to getCursorKindForDecl (#72401)
The LinkageSpec case was omitted, and there is a declared CXCursor_Kind
for it. Adapt the testsuite drivers to print mangled names for
declarations with extern linkage. Also update the test baseline for the
recursive-cxx-member-calls.cpp test.

Co-authored-by: Matthieu Eyraud <eyraud@adacore.com>
2023-11-24 21:41:17 +05:30
Alexey Bataev
e9fdb965f9 [SLP][NFC]Make collectValuesToDemote member of BoUpSLP to avoid using
Expr container, NFC.

Saves the memory and may improve compile time.
2023-11-24 08:05:19 -08:00
Akash Banerjee
c38dbfd3be [Flang] Add new Integration tests directory to Flang (#73141)
As per the RFC:
[https://discourse.llvm.org/t/rfc-flang-new-directory-for-adding-end-to-end-tests-for-lowering-to-llvm-ir-in-flang/74872/11](https://discourse.llvm.org/t/rfc-flang-new-directory-for-adding-end-to-end-tests-for-lowering-to-llvm-ir-in-flang/74872/11),
this patch adds a new Integration test directory for OpenMP-
`flang/test/Integration/OpenMP` and moves the existing OpenMP
integration tests from `flang/test/Driver/OpenMP` to this directory.

**This directory can be used to add Integration tests involving multiple
stages of the compiler (for eg. from Fortran to LLVM IR). It should not
contain executable tests. We should only add tests here sparingly and
only if there is no other way to test. Repeat this message in each test
that is added to this directory and sub-directories.**
2023-11-24 16:02:39 +00:00
Guillaume Chatelet
ee5749bf78 [libc] Provide compiler version properties (#73344)
This will be used to support conditional compilation based on compiler
version.
We adopt the same convention as
[libc++](https://github.com/llvm/llvm-project/blob/main/libcxx/include/__config)
- thx @legrosbuffle for the suggestion!
Usage:
```
#if defined(LIBC_COMPILER_CLANG_VER)
#  if LIBC_COMPILER_CLANG_VER < 1500
#    warning "Libc only supports Clang 15 and later"
#  endif
#elif defined(LIBC_COMPILER_GCC_VER)
#  if LIBC_COMPILER_GCC_VER < 1500
#    warning "Libc only supports GCC 15 and later"
#  endif
#elif defined(LIBC_COMPILER_MSC_VER)
#  if LIBC_COMPILER_MSC_VER < 1930
#    warning "Libc only supports Visual Studio 2022 RTW (17.0) and later"
#  endif
#endif
```
2023-11-24 17:02:11 +01:00
José Lira Junior
bd8f1068ca [lldb] correct inconsistent order of messages on process launch (#73173)
Fixes [#68035](https://github.com/llvm/llvm-project/issues/68035), where
an inconsistency in the order of "Process launched" and "Process
stopped" messages occurs during `process launch`.

The fix involves adjusting the message output sequence in
`CommandObjectProcessLaunch::DoExecute` within
`source/Commands/CommandObjectProcess.cpp`. This ensures "Process
launched" consistently precedes "Process stopped" when executing
commands with the '-o' flag, i.e., non-interactive mode.

Upon implementing this change, two tests failed:
`lldb/test/Shell/Breakpoint/jit-loader_jitlink_elf.test` and
`lldb/test/Shell/Breakpoint/jit-loader_rtdyld_elf.test`. These failures
were expected as they relied on the previous, now-corrected message
order. Updating these tests to align with the new message sequence is
part of this PR's scope.
2023-11-24 15:48:16 +00:00
Egor Zhdan
18a5ca14d1 [Clang] Fix -Wdocumentation warning (NFC)
```
llvm-project/clang/include/clang/AST/OpenMPClause.h:7762:14: warning: parameter 'Modifier' not found in the function declaration [-Wdocumentation]
  /// \param Modifier The modifier applied to 'order' clause.
             ^~~~~~~~
llvm-project/clang/include/clang/AST/OpenMPClause.h:7762:14: note: did you mean 'M'?
  /// \param Modifier The modifier applied to 'order' clause.
```
2023-11-24 15:41:37 +00:00
Guillaume Chatelet
89a832435d [libc][cmake] Add missing dependencies for type_traits (#73339) 2023-11-24 16:29:29 +01:00
Jeremy Morse
59fab22642 [DebugInfo][RemoveDIs] Support cloning and remapping DPValues (#72546)
This patch adds support for CloneBasicBlock duplicating the DPValues
attached to instructions, and adds facilities to remap them into their new
context. The plumbing to achieve this is fairly straightforwards and
mechanical.

I've also added illustrative uses to LoopUnrollRuntime, SimpleLoopUnswitch
and SimplifyCFG. The former only updates for the epilogue right now so I've
added CHECK lines just for the end of an unrolled loop (further updates
coming later). SimpleLoopUnswitch had no debug-info tests so I've added a
new one. The two modified parts of SimplifyCFG are covered by the two
modified SimplifyCFG tests.

These are scenarios where we have to do extra cloning for copying of
DPValues because they're no longer instructions, and remap them too.
2023-11-24 15:17:32 +00:00
Jeremy Morse
2f7c050e19 [DebugInfo][RemoveDIs] Allow speculative-DPMarker creation
There's good justification for having a function specifying "I need there to be
a marker here, so return the marker there or create a new one". This was going
to come later in the series, but it's starting to become necessary much eariler
alas.

Make use of it in spliceDebugInfo, where we can occasionally splice DPValues
onto the end() iterator of a block while it's been edited.
2023-11-24 15:17:32 +00:00
Guillaume Chatelet
5e5a22caf8 [libc][NFC] Move float macro into its own header / add target os detection (#73311)
Floating point properties are a combination of target OS, target
architecture and compiler support.
 - Adding target OS detection,
 - Moving floating point type detection to its own file.

This is in preparation of adding support for `_Float16` which requires
testing compiler **version** and target architecture.
2023-11-24 16:11:05 +01:00
Nikita Popov
50c298fd17 [CVP] Regenerate test checks (NFC)
Avoid some spurious changes in a future patch.
2023-11-24 15:50:30 +01:00
Nikita Popov
88f7dc17eb [SCEV] Regenerate test checks (NFC)
There have been some minor but pervasive changes to the generated
CHECK lines, so regenerate all of them, to minimize future diffs.
2023-11-24 15:49:28 +01:00
Jinsong Ji
85ee351aa7 [CI] Skip libcxx in non-llvm repo (#73282)
The new libcxx workflow are run and failing in non llvm repo.
Skip it similar to other workflow.
2023-11-24 09:44:49 -05:00
Florian Hahn
820b3583c9 [AArch64] Add artificial clobbers to swift async context test.
Manually add clobbers for various register combinations to tests. This
highlights incorrectly performing shrink-wrapping, with
StoreSwiftAsyncContext expansion clobbering a live register.
2023-11-24 14:14:49 +00:00
Stefan Gränitz
962829bdb3 [JITLink] Fix typos: symobls -> symbols (NFC) 2023-11-24 15:04:00 +01:00
Stefan Gränitz
c8562e81bc [llvm-jitlink] Avoid assertion failure in make_error parameter
If GOTSym is not defined, we cannot call `GOTSym.getBlock()`. It failed with:
```
Assertion failed: (Base->isDefined() && "Not a defined symbol"), function getBlock, file JITLink.h, line 554.
```
2023-11-24 15:04:00 +01:00
Nikita Popov
7eeedc124f [CodeGen] Make some includes explicit (NFC)
Explicitly include some headers or forward-declare types, in
preparation for removing an include that pulls in many transitive
headers.
2023-11-24 14:43:18 +01:00
Timm Baeder
a79a5611bd [clang] Classify vector types in __builtin_classify_type (#73299) 2023-11-24 14:40:58 +01:00
Balázs Kéri
3d8a9105d7 [clang][ASTImporter] Fix import of SubstTemplateTypeParmType in return type of function. (#69724)
Import of a function with `auto` return type that is expanded to a
`SubstTemplateTypeParmType` could fail if the function itself is the
template specialization where the parameter was replaced.
2023-11-24 14:35:10 +01:00