Commit Graph

431499 Commits

Author SHA1 Message Date
Louis Dionne 507125af3d [libc++] Rename __libcpp_assertion_handler to __libcpp_verbose_abort
With the goal of reusing that handler to do other things besides
handling assertions (such as terminating when an exception is thrown
under -fno-exceptions), the name `__libcpp_assertion_handler` doesn't
really make sense anymore.

Furthermore, I didn't want to use the name `__libcpp_abort_handler`,
since that would give the impression that the handler is called
whenever `std::abort()` is called, which is not the case at all.

Differential Revision: https://reviews.llvm.org/D130562
2022-07-29 13:52:42 -04:00
Sunho Kim 4191d661c7 [clang-repl] Disable execution unittests on unsupported platforms.
After the intoduction of global destructor support, there is a possiblity to run invalid instructions in the destructor of Interpreter class. Completely disable tests in platforms with failing test cases.

Differential Revision: https://reviews.llvm.org/D130786
2022-07-30 02:28:03 +09:00
Aaron Ballman d8352abd3a Diagnose use of _Noreturn on a struct/union field
C99 6.7.4p2 clarifies that a function specifier can only be used in the
declaration of a function. _Noreturn is a function specifier, so it is
a constraint violation to write it on a structure or union field, but
we missed that case.

Fixes #56800
2022-07-29 13:18:44 -04:00
Tom Stellard b9a6629193 workflows: Pass phab token to github-automation.py when creating a pull request
The script needs this in order to automatically assign a reviewer.
2022-07-29 09:59:55 -07:00
Nico Weber 2681c9e065 [lld/mac] Comment changes requested on https://reviews.llvm.org/D130725
No behavior change.
2022-07-29 12:55:48 -04:00
Markus Böck 37da2a141c [mlir][LLVM] Rework the API of GEPOp
The implementation and API of GEP Op has gotten a bit convoluted over the time. Issues with it are:
* Misleading naming: `indices` actually only contains the dynamic indices, not all of them. To get the amount of indices you need to query the size of `structIndices`
* Very difficult to iterate over all indices properly: One had to iterate over `structIndices`, check whether it contains the magic constant `kDynamicIndex`, if it does, access the next value in `index` etc.
* Inconvenient to build: One either has create lots of constant ops for every index or have an odd split of passing both a `ValueRange` as well as a `ArrayRef<int32_t>` filled with `kDynamicIndex` at the correct places.
* Implementation doing verification in the build method
and more.

This patch attempts to address all these issues via convenience classes and reworking the way GEP Op works:
* Adds `GEPArg` class which is a sum type of a `int32_t` and `Value` and is used to have a single convenient easy to use `ArrayRef<GEPArg>` in the builders instead of the previous `ValueRange` + `ArrayRef<int32_t>` builders.
* Adds `GEPIndicesAdapter` which is a class used for easy random access and iteration over the indices of a GEP. It is generic and flexible enough to also instead return eg. a corresponding `Attribute` for an operand inside of `fold`.
*  Rename `structIndices` to `rawConstantIndices` and `indices` to `dynamicIndices`: `rawConstantIndices` signifies one shouldn't access it directly as it is encoded, and `dynamicIndices` is more accurate and also frees up the `indices` name.
* Add `getIndices` returning a `GEPIndicesAdapter` to easily iterate over the GEP Ops indices.
* Move the verification/asserts out of the build method and into the `verify` method emitting op error messages.
* Add convenient builder methods making use of `GEPArg`.
* Add canonicalizer turning dynamic indices with constant values into constant indices to have a canonical representation.

The only breaking change is for any users building GEPOps that have so far used the old `ValueRange` + `ArrayRef<int32_t>` builder as well as those using the generic syntax.

Another follow up patch then goes through upstream and makes use of the new `ArrayRef<GEPArg>` builder to remove a lot of code building constants for GEP indices.

Differential Revision: https://reviews.llvm.org/D130730
2022-07-29 18:22:54 +02:00
Alex Brachet 7baf1db392 [ELF] Strip directories for -Map when emitting reproducer rsp
Similarly to -o output directories will not be created so -Map being
copied verbatim will likely cause ld.lld @response.txt to fail.

Differential Revision: https://reviews.llvm.org/D130681
2022-07-29 16:17:33 +00:00
lewuathe 730cb82226 [mlir][complex] Canonicalize complex.add zero
Adding complex value with 0 for real and imaginary part can be ignored.

NOTE: This type of canonicalization can be written in an easy and tidy format using `complex.number` after constant op supports custom attribute.

Differential Revision: https://reviews.llvm.org/D130748
2022-07-29 18:03:45 +02:00
Sanjay Patel b5a9361c90 [InstCombine] canonicalize zext-and-of-bool compare to narrow and
https://alive2.llvm.org/ce/z/3jYbEH

We should choose one of these forms, and the option that uses
the narrow type allows the motivating example from issue #56294
to reduce. In the best case (no 'not' needed and 'trunc' remains),
this does remove an instruction.

Note that there is what looks like a regression because there
is an existing canonicalization that turns trunc into and+icmp.
That is a long-standing transform, and I'm not sure what effect
reversing it would have.
2022-07-29 12:02:54 -04:00
Alex Zinenko 26821f75ed [mlir][NFC] accept plain OpBuidler in folded construction helpers
A group of functions in the Affine dialect provides a mechanism for
buliding folded-by-construction operations. These functions used to
accept a `RewriterBase` reference because they may need to erase the
operations that were folded and notify the rewriter when called from
rewrite patterns. Adopt a different approach: postpone the builder
notification of the op creation until we are certain that the op will
not be folded away. This removes the need to notify the rewriter about
op deletion following op construction in case of successful folding, and
removes a bunch of one-off `IRRewriter` instances in transform code that
may mess up insertion points.

Reviewed By: springerm, mravishankar

Differential Revision: https://reviews.llvm.org/D130616
2022-07-29 16:01:56 +00:00
Corentin Jabot ad16268f13 [Clang] Do not check for underscores in isAllowedInitiallyIDChar
isAllowedInitiallyIDChar is only used with non-ASCII codepoints,
which are handled by isAsciiIdentifierStart.
To make that clearer, remove the check for _ from
isAllowedInitiallyIDChar, and assert on ASCII - to ensure neither
_ or $ are passed to this function.

Reviewed By: tahonermann, aaron.ballman

Differential Revision: https://reviews.llvm.org/D130750
2022-07-29 17:46:38 +02:00
Kirill Okhotnikov a7f55f0805 [libc][math] Added sinhf function.
Differential Revision: https://reviews.llvm.org/D129278
2022-07-29 17:20:53 +02:00
Kirill Okhotnikov fcb9d7e2cf [libc][math] Added coshf function.
Differential Revision: https://reviews.llvm.org/D129275
2022-07-29 16:57:28 +02:00
Matt Devereau a8b726ac65 [AArch64][SVE] Change DupLane128Combine Index comparison to 0
IdxInsert == IdxDupLane is incorrect. IdxInsert is the starting element number,
whereas IdxIndex is the index of a quadword
2022-07-29 14:31:00 +00:00
Sanjay Patel 64fdcfeb1a [InstCombine] add tests for icmp with cast bool logic; NFC 2022-07-29 10:24:58 -04:00
Simon Pilgrim bc2c4f6c85 [X86] combineAndnp - constant fold ANDNP(C,X) -> AND(~C,X) (REAPPLIED)
If the LHS op has a single use then using the more general AND op is likely to allow commutation, load folding, generic folds etc.

Updated version - original version rG057db2002bb3 didn't correctly account for multiple uses of the mask that might be folding "OR(AND(X,C),AND(Y,~C)) -> OR(AND(X,C),ANDNP(C,Y))" in canonicalizeBitSelect
2022-07-29 15:12:26 +01:00
Alex Bradbury 85c6fab8d3 [RISCV][doc] Improve documentation comments on atomics intrinsics
Previously, it was necessary to check the atomics lowering or expansion
code to determine which argument was which.

This patch additionally tweaks the documentation comment in
TargetLowering to clarify the return value of the intrinsic and that the
intrinsic isn't required to mask and shift the result (this is handled
by the target-independent code in AtomicExpandPass).
2022-07-29 15:09:12 +01:00
Nikita Popov 5eaeeed8cb [InstCombine] Avoid ConstantExpr::getFNeg() calls (NFCI)
Instead call the constant folding API, which can fail. For now,
this should be NFC, as we still allow the creation of fneg
constant expressions.
2022-07-29 16:01:46 +02:00
Amaury Séchet 226086230c [DAG] Use recursivelyDeleteUnusedNodes in CommitTargetLoweringOpt.
It simplifies the logic and removes the need for manual bookkeeping.

Differential Revision: https://reviews.llvm.org/D130445
2022-07-29 13:49:03 +00:00
Louis Dionne 79086bf9b2 [libc++] Remove constexpr vector from LLVM 16 release notes
We are shipping it in LLVM 15 via a cherry-pick.
2022-07-29 09:46:21 -04:00
Mirko Brkusanin 6a1aa627fa [AMDGPU] Enable image_gather4h instruction for gfx10 and gfx11
Differential Revision: https://reviews.llvm.org/D130764
2022-07-29 15:42:06 +02:00
Alexey Lapshin ece341f598 [Debuginfo][DWARF][NFC] Add paired methods working with DWARFDebugInfoEntry.
This review is extracted from D96035.

DWARF Debuginfo classes have two representations for DIEs: DWARFDebugInfoEntry
(short) and DWARFDie(extended). Depending on the task, it might be more convenient
to use DWARFDebugInfoEntry or/and DWARFDie. DWARFUnit class already has methods
working with DWARFDie and DWARFDebugInfoEntry. This patch adds more
methods working with DWARFDebugInfoEntry to have paired functionality.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D126059
2022-07-29 16:40:17 +03:00
Adrian Kuegel 7d76da539f [mlir][Complex] Add a convenience getValue() method.
This method returns the value as std::complex<APFloat>

Differential Revision: https://reviews.llvm.org/D130770
2022-07-29 15:35:39 +02:00
Jay Foad 3cfa9b1431 [AMDGPU] user-sgpr-init16-bug does not apply to gfx1103
Differential Revision: https://reviews.llvm.org/D130347
2022-07-29 14:21:13 +01:00
Simon Pilgrim c9737b6f18 [X86] Add regression test case from rG057db2002bb3
When constant folding "ANDNP(C,X) -> AND(~C,X)" we hit cases such as this where we interfered with the "OR(AND(X,C),AND(Y,~C)) -> OR(AND(X,C),ANDNP(C,Y))" fold in canonicalizeBitSelect
2022-07-29 14:20:35 +01:00
Simon Pilgrim af1b7ebcdf [TargetLowering] Move a few hasOneUse() tests later to reduce unnecessary computations. NFC.
Many of these cases, an early-out on the much cheaper getOpcode() check will avoid us needing to call hasOneUse() entirely.
2022-07-29 14:20:35 +01:00
Matt Arsenault ef906f287e AMDGPU: Fix assertion when printing unreachable functions
Since 814a0abcce, this would break if we
had a function in the module that becomes dead in any codegen IR
pass. The function wasn't deleted since it was initially used in dead
code, but is detached from the call graph and doesn't appear in the PO
traversal. Do a second walk over the module to populate the resources
of any functions which weren't already processed.
2022-07-29 08:57:43 -04:00
Matt Arsenault a4834ad068 RegisterCoalescer: Shrink main range after shrinking subranges
If the subregister uses were dead, this would leave the main range
segment pointing to a deleted instruction.

Not sure if this should try to avoid shrinking if we know we don't
have dead components.
2022-07-29 08:57:28 -04:00
Erich Keane b25902736c [NFCI] Propagate MLTAL through more concepts in prep of deferred inst.
In preperation of the deferred instantation progress, this patch
propagates the multi-level template argument lists further through the
API to reduce the size of that patch.
2022-07-29 05:54:04 -07:00
Florian Hahn fbe022f189
[Libcalls] Add tests with maytrap & non-errno for math libcalls. 2022-07-29 13:45:34 +01:00
Alexander Timofeev d7ae1a9097 Revert "[AMDGPU] avoid blind converting to VALU REG_SEQUENCE and PHIs"
This reverts commit 76d9ae924c.
because it causes several VK CTS tests to fail
2022-07-29 14:19:07 +02:00
Adrian Kuegel 6e951b3ec9 [mlir][Complex] Add convenience builder for complex.number attribute.
Differential Revision: https://reviews.llvm.org/D130756
2022-07-29 14:13:44 +02:00
Luís Marques a0f1304616 [compiler-rt][builtins][RISCV] Set COMPILER_RT_HAS_FLOAT16 for RISC-V compiler-rt tests, fixes test__extendhfsf2
Since D92241, compiler-rt/cmake/builtin-config-ix.cmake automatically tests
the host compiler for support of _Float16 and conditionally defines
COMPILER_RT_HAS_FLOAT16. That defines the macro while the compiler-rt
builtins are being built. To also define it during the compiler-rt test
runs requires whitelisting the architecture in
compiler-rt/test/builtins/CMakeLists.txt, as done in this patch. That seems
brittle. Ideally, we'd move to a solution where the target compiler was
automatically tested as well, but I'm not sure how feasible that is with the
current CMake setup.

For now, this patch whitelists RISC-V, fixing errors in test__extendhfsf2.
Alternate solutions that fix the root issue are welcome, though.

Differential Revision: https://reviews.llvm.org/D129432
2022-07-29 13:27:44 +02:00
Luís Marques 5bc19fe8f6 Revert "[compiler-rt][builtins][RISCV] Set COMPILER_RT_HAS_FLOAT16 for RISC-V compiler-rt tests, fixes test__extendhfsf2"
This reverts commit 55920d9282.
2022-07-29 13:25:53 +02:00
Luís Marques 55920d9282 [compiler-rt][builtins][RISCV] Set COMPILER_RT_HAS_FLOAT16 for RISC-V compiler-rt tests, fixes test__extendhfsf2
Since D92241, compiler-rt/cmake/builtin-config-ix.cmake automatically tests
the host compiler for support of _Float16 and conditionally defines
COMPILER_RT_HAS_FLOAT16. That defines the macro while the compiler-rt
builtins are being built. To also define it during the compiler-rt test
runs requires whitelisting the architecture in
compiler-rt/test/builtins/CMakeLists.txt, as done in this patch. That seems
brittle. Ideally, we'd move to a solution where the target compiler was
automatically tested as well, but I'm not sure how feasible that is with the
current CMake setup.

For now, this patch whitelists RISC-V, fixing errors in test__extendhfsf2.
Alternate solutions that fix the root issue are welcome, though.

Differential Revision: https://reviews.llvm.org/D129432
2022-07-29 13:24:29 +02:00
Kadir Cetinkaya 3b8fb471cb
[clangd][NFCI] Store TUPath inside ParsedAST
Lots of features built on top of ASTs require getting back to the path
of the TU and they used lossy conversion from file ids using sourcemanager.
This patch preserves the file path passed by the caller inside ParsedAST for
later use.

Differential Revision: https://reviews.llvm.org/D130690
2022-07-29 13:23:42 +02:00
Simon Pilgrim 63bdff3eb8 VirtualFileSystem.h - don't use \param in general description - use \p instead to fix Wdocumentation warnings. 2022-07-29 12:21:44 +01:00
Simon Pilgrim 9f68bb1da5 Fix unknown parameter Wdocumentation warning. NFC. 2022-07-29 12:17:30 +01:00
Simon Pilgrim 641dba9e28 [DAG] Move a few hasOneUse() tests later to reduce unnecessary computations. NFC.
Many of these cases, an early-out on the much cheaper getOpcode() check will avoid us needing to call hasOneUse() entirely.
2022-07-29 11:34:39 +01:00
Guillaume Chatelet 0c3037dfc5 [libc] Fix prototype_test_gen 2022-07-29 10:18:54 +00:00
Guillaume Chatelet e5e0e7963c [libc] Fix prototype_test_gen 2022-07-29 10:07:34 +00:00
Simon Pilgrim 9082c13106 [Support] Add KnownBits::concat method
Add a method for the various cases where we need to concatenate 2 KnownBits together (BUILD_PAIR and SHIFT_PARTS in particular) - uses the existing APInt::concat 'HiBits.concat(LoBits)' convention

Differential Revision: https://reviews.llvm.org/D130557
2022-07-29 11:06:39 +01:00
Guillaume Chatelet 039fb3e5a1 Fix typo in FPUtil/aarch64/FMA.h 2022-07-29 10:04:11 +00:00
Guillaume Chatelet f72261508a [libc][NFC] Use STL case for type_traits
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion. Starting with the type_traits header.

Differential Revision: https://reviews.llvm.org/D130727
2022-07-29 09:57:03 +00:00
Jay Foad d03110155b [IR] Simplify Intrinsic::getDeclaration. NFC. 2022-07-29 10:45:22 +01:00
wanglei 56ab2f4ccd [LoongArch] Offset folding for frameindex
This patch is for frameindex calculations.

Differential Revision: https://reviews.llvm.org/D130248
2022-07-29 17:27:34 +08:00
wanglei fd6545322c [LoongArch] Refactor insertDivByZeroTrap
Ensure non-terminators don't follow terminators.
This patch fixes the `sdiv-udiv-srem-urem.ll` test failure with
expensive check.

Differential Revision: https://reviews.llvm.org/D130247
2022-07-29 17:06:49 +08:00
David Sherwood 487fa6f8c3 [AArch64][DAGCombine] Add performBuildVectorCombine 'extract_elt ~> anyext'
A build vector of two extracted elements is equivalent to an extract
subvector where the inner vector is any-extended to the
extract_vector_elt VT, because extract_vector_elt has the effect of an
any-extend.

  (build_vector (extract_elt_i16_to_i32 vec Idx+0) (extract_elt_i16_to_i32 vec Idx+1))
  => (extract_subvector (anyext_i16_to_i32 vec) Idx)

Depends on D130697

Differential Revision: https://reviews.llvm.org/D130698
2022-07-29 09:51:09 +01:00
Nuno Lopes 210769f773 fix test function attribute [NFC] 2022-07-29 09:42:44 +01:00
David Sherwood 6953e754c7 [NFC][AArch64] Precommit vector-fcvt tests
Add tests which show code quality of uitofp and sitofp.

Differential Revision: https://reviews.llvm.org/D130697
2022-07-29 09:29:15 +01:00