508358 Commits

Author SHA1 Message Date
J. Ryan Stinnett
f807c5e492
[DebugInfo] Add expression decoding for DW_OP_implicit_pointer (#102923)
This allows `llvm-dwarfdump` to decode the DWARF 5 opcode
`DW_OP_implicit_pointer` (0xa0). GCC makes use of this opcode in recent
versions. LLVM contains some (unfinished) support as well. With existing
usage in the ecosystem, adding decoding support here seems reasonable.
2024-08-13 15:34:21 +01:00
xusheng
5dbec8c6ce
[lldb] Claim to support swbreak and hwbreak packets when debugging a gdbremote (#102873)
This fixes https://github.com/llvm/llvm-project/issues/56125 and
https://github.com/vadimcn/codelldb/issues/666, as well as the
downstream issue in our binary ninja debugger:
https://github.com/Vector35/debugger/issues/535

Basically, lldb does not claim to support the `swbreak` packet so the
gdbserver would not use it. As a result, the gdbserver always sends the
unmodified program counter value which, on systems like x86, causes the
program counter to be off-by-one (or otherwise wrong). For reference,
the lldb-server always sends the modified program counter value so it
works perfectly with lldb.

https://sourceware.org/gdb/current/onlinedocs/gdb.html/Stop-Reply-Packets.html#swbreak-stop-reason

No new code is added to add support `swbreak`, since the way lldb works
already expects the remote to have adjusted the program counter. The
change just lets the gdbserver know that lldb supports it, so that it
will send the adjusted program counter.

To test this PR, you can use lldb to connect to a gdbserver running on
e.g., Ubuntu 22.04, and see the program counter is off-by-one without
the patch. With the patch, things work as expected
2024-08-13 15:28:35 +01:00
Amy Kwan
4089763883
[GlobalMerge] Update the GlobalMerge pass to merge private global variables. (#101222)
This patch updates the GlobalMerge pass to be able to handle private
global variables, which is required for a follow-up PowerPC specific
GlobalMerge patch to merge internal and private globals.

A new LIT test is also added to exhibit the ability to merge private
globals.
2024-08-13 10:13:38 -04:00
Louis Dionne
f117f0a746
[libc++] Add a script to synchronize status-tracking CSVs with Github issues (#101704)
This script can be run manually to synchronize the CSV files that we use
to track Standards Conformance with the Github issues that track our
implementation of LWG issues and papers.
2024-08-13 09:57:52 -04:00
Rainer Orth
b53fe2ca8c
[flang][test] Restrict Evaluate/fold-out_of_range.f90 to x86_64 (#102890)
`Flang :: Evaluate/fold-out_of_range.f90` currently `FAIL`s on
Linux/sparc64. This seems to be the same issue that led to disabling the
test on Solaris in 27549ee989d7e0803d41c206cf636f0b689210f1. In fact,
the generic Solaris disablement was over-eager: the test `PASS`es just
fine on Solaris/amd64.

Since the use of `REAL*10` makes the test x86-specific, this patch
actually implements that requirement.

Tested on `sparc64-unknown-linux-gnu`, `sparcv9-sun-solaris2.11`,
`amd64-pc-solaris2.11`, and `x86_64-pc-linux-gnu`.
2024-08-13 15:35:51 +02:00
Han-Kuan Chen
6aad4918e8
[SLP][REVEC] Make MinBWs support vector instructions. (#103049)
If ScalarTy is FixedVectorType, it should remain as FixedVectorType.
2024-08-13 21:35:28 +08:00
Tobias Stadler
5c3a0fa7e5
[GlobalISel] IRTranslator: Use RAIIMFObsDelInstaller (#102379)
Similar to #102156.

runOnMachineFunction() installs the Observer correctly manually.

finishPendingPhis() doesn't install into the MF, but this currently
can't cause issues because DILocationVerifier doesn't care about changed
instructions.

Switch to RAIIMFObsDelInstaller in both places for consistency.
2024-08-13 15:10:59 +02:00
Nikita Popov
adb4cfe0b6 [InstCombine] Use getAllOnesValue()
Split off from https://github.com/llvm/llvm-project/pull/80309.
2024-08-13 15:04:23 +02:00
Nikita Popov
7990a7e58f [IndVars] Use getSigned() in FP transform
This transform is working on signed integer, so this is the
logically correct API.

Split off from https://github.com/llvm/llvm-project/pull/80309.
2024-08-13 15:04:23 +02:00
Nikita Popov
4d97ad59f9 [InstCombine] Use APInt::getSplat()
Split off from https://github.com/llvm/llvm-project/pull/80309.
2024-08-13 15:04:23 +02:00
Nikita Popov
53c41f95db [MemoryBuiltins] Use getAllOnesValue()
Split out from https://github.com/llvm/llvm-project/pull/80309.
2024-08-13 15:04:23 +02:00
Andrzej Warzyński
f0f5afe968
[mlir][vector] Add more tests for ConvertVectorToLLVM (3/n) (#102854)
Adds tests with scalable vectors for the Vector-To-LLVM conversion pass.
Covers the following Ops:
  * vector.extractelement
  * vector.extract

I have also renamed some function names from `@extract_element{}` to
`@extractelement{}` - that's to make a clearer distinction between
tests for `vector.extractelement` (tested by `@extractelement{}`) and
`vector.extract` (tested by `@extract_element{}`).
2024-08-13 13:03:35 +01:00
Jay Foad
b4edfc1920
[LTO] Run ObjCARCContractPass according to the callgraph (#103034)
This matches other IR codegen passes and avoids a Dominator Tree
Construction in AMDGPU O2/O3 builds.
2024-08-13 12:57:13 +01:00
Han-Kuan Chen
2256d00a14
[SLP][REVEC] Use VL.front()->getType() as ScalarTy. (#102437)
VL.front()->getType() may be FixedVectorType when revec is enabled.

Fix "Expected item in MinBWs.".
2024-08-13 19:53:45 +08:00
Paul Walker
4197386dbd
[LLVM][SelectionDAG] Remove scalable vector restriction from poison analysis. (#102504)
The following functions have an early exit for scalable vectors:
  SelectionDAG::canCreateUndefOrPoison
  SelectionDAG:isGuaranteedNotToBeUndefOrPoison
    
The implementations of these don't look to be sensitive to the
vector type other than some uses of demanded elts analysis that
doesn't fully support scalable types.  That said the initial
calculation demands all elements and so I've followed the same
scheme as used by TargetLowering::SimplifyDemandedBits.
2024-08-13 12:53:20 +01:00
Simon Pilgrim
ed7ad0a1a0 [X86] Promote cttz_i32(x) -> cttz_i64((i64)x | (1 << 32)) (#102900) (REAPPLIED)
On 64bit targets we can promote i32 CTTZ nodes to i64 CTTZ_ZERO_UNDEF by setting the 32nd bit.

#57811 also queried about whether we should use BTS instead of MOVABS+OR to avoid a i64 immediate - I'm willing to tweak the DAGToDAG isel peephole for these cases if reviewers think it worthwhile. But most recent CPUs can actually handle MOVABS faster than BTS/C/R.......

Reapplied with missing costmodel changes - the cost tables can probably be improved in a follow up patch.

Fixes #57811
2024-08-13 12:48:27 +01:00
Egor Zhdan
dc8c217db6
[APINotes] Support C++ tag conformances to Swift protocols
This allows adding a Clang attribute
`swift_attr("conforms_to:ModuleName.ProtocolName")` to C++ structs via
API Notes.

The Swift compiler respects this attribute when importing C++ types into
Swift by automatically declaring the C++ type as a conforming type to
the given Swift protocol.

rdar://131388824
2024-08-13 12:47:23 +01:00
Jacek Caban
d550ada5ab
[CodeGen][ARM64EC] Define hybrid_patchable EXP thunk symbol as a function. (#102898)
This is needed for MSVC link.exe to generate redirection metadata for hybrid patchable thunks.
2024-08-13 13:39:42 +02:00
Han-Kuan Chen
875b551de7
[SLP][REVEC] Make computeMinimumValueSizes and collectValuesToDemote support vector instructions. (#103005) 2024-08-13 19:35:25 +08:00
Kadir Cetinkaya
778a1f29fc
[include-cleaner] Fix windows buildbots after 64d9713637ab9 2024-08-13 13:28:07 +02:00
Florian Hahn
103cdd45fc
[Matrix] Add test showing unintended implicit sign conversion warning. 2024-08-13 12:18:38 +01:00
qazwsxedcrfvtg14
b7863d13df
[mlir] Fix misleading comment for type trait (#103041)
We are using `has_initialize` to check the class has `initialize`
function instead of the `getOperationName` function.
2024-08-13 13:00:03 +02:00
kadir çetinkaya
64d9713637
[include-cleaner] Unify symlink handling (#102615)
We were using tryGetRealPathName in certain places, which resolves
symlinks (sometimes). This was resulting in discrepancies in behavior,
depending on how a file was first reached.

This path migrates all usages of tryGetRealPathName to regular getName
instead.

This implies one backward incompatible change for header-filtering. Our
ignore-header option used to filter against suffixes of absolute paths,
whereas now filter can receive working-directory relative paths in some
cases, possibly braking existing filters.
Chances of really braking users is pretty low:
- We'll still filter against absolute paths when header is outside the
  working directory (e.g. /usr/bin/include/some/linux/header.h.)
- Most projects run builds in a working directory that's nested inside
  the repository, hence relative paths still contain all the segments
  relative to repository root and anything else is unlikely to be
  meaningful. e.g. if a header is in
  `$HOME/work/llvm-project/clang-tools-extra/header.h` with builds being
  run in `$home/work/llvm-project/build`, we'll still filter against
  `../clang-tools-extra/header.h` which has all the useful segments as a
  suffix.
- This is also a change in how we handle symlinks, but this is aligned
  with what we do in rest of our tools (clangd, tidy checks etc.). We
  tend to not resolve any symlinks for the file.
2024-08-13 12:51:52 +02:00
Alexis Engelke
8fc3a79747
[IR] Add block number traits to CFG (#102758)
This enables the use of the more efficient dominator tree node access.
2024-08-13 12:46:52 +02:00
Alexis Engelke
2b077ede08
[MC] Avoid useless triple copy (#103026)
Copying a triple is cheap, but not free, so let's not do that if there's
no reason to do so. Trivial cleanup.
2024-08-13 12:15:13 +02:00
deadalnix
3fa946a844
[DI] Have createClassType create a class type. (#102624)
I was wondering why my use of createClassType was generating structure
reccords, and it turns out the code is wrong (or for some reason i don't
understand the intended use of the API).

clang itself does not use that part of the API, so this flew under the
radar.
2024-08-13 12:12:29 +02:00
Benjamin Chetioui
a9636b7f60
[mlir][StorageUniquer] Restore old signature for default implementaion of verifyInvariants. (#103023)
PR #102326 changed the prototype of the default implementation of verify
to include emitErrorFn.

This breaks automatic derivation in consumer attributes, such as
60277ba976/include/tfrt/core_runtime/opdefs/attributes.h (L53).

This PR simply restores the signature to what it was prior to PR
#102326.
2024-08-13 12:05:15 +02:00
Vitaly Buka
5ce47a5813
Reland "[Support] Assert that DomTree nodes share parent" (#102782)
A dominance query of a block that is in a different function is
ill-defined, so assert that getNode() is only called for blocks that are
in the same function.

There are three cases, where this behavior did occur. LoopFuse didn't
explicitly do this, but didn't invalidate the SCEV block dispositions,
leaving dangling pointers to free'ed basic blocks behind, causing
use-after-free. We do, however, want to be able to dereference basic
blocks inside the dominator tree, so that we can refer to them by a
number stored inside the basic block.

Reverts #102780
Reland #101198
Fixes #102784

Co-authored-by: Alexis Engelke <engelke@in.tum.de>
2024-08-13 11:56:02 +02:00
Chuanqi Xu
93f5c61d04
[NFC] [Serialization] Extract the functionality of merging decls from ASTReaderDecl (#103022)
Currently we're merging the decls in ASTReaderDecl. But it is not so
convinient if we want to merge things in ASTReader.

This patch extract the funcitonality of merging decls from ASTReaderDecl
to a new class, ASTReaderMerger. Then it will be easier to merge decls
in ASTReader.

This may help the readability slightly too.
2024-08-13 17:48:38 +08:00
Simon Pilgrim
346a1c5161
Revert "[X86] Promote cttz_i32(x) -> cttz_i64((i64)x | (1 << 32))" (#103030)
Reverts llvm/llvm-project#102900 - missed a analysis cost model test change
2024-08-13 10:30:22 +01:00
Hans
f9b15a96c6
[cmake] Document and suggest LLVM_ENABLE_PDB (#102887)
As suggested in #101533. @rnk added the flag in
b97ff922a9eeea6efbf12deba907848e5002cc76
2024-08-13 11:26:06 +02:00
Simon Pilgrim
71d2de8ecd
[X86] Promote cttz_i32(x) -> cttz_i64((i64)x | (1 << 32)) (#102900)
On 64bit targets we can promote i32 CTTZ nodes to i64 CTTZ_ZERO_UNDEF by setting the 32nd bit.

#57811 also queried about whether we should use BTS instead of MOVABS+OR to avoid a i64 immediate - I'm willing to tweak the DAGToDAG isel peephole for these cases if reviewers think it worthwhile. But most recent CPUs can actually handle MOVABS faster than BTS/C/R.......

Fixes #57811
2024-08-13 10:15:49 +01:00
Jie Fu
b7ebb67b86 [SCEV] Fix -Wrange-loop-construct (NFC)
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:12009:21:
 error: loop variable '[S, Mul]' creates a copy from type 'const value_type' (aka 'const llvm::detail::DenseMapPair<const llvm::SCEV *, int>') [-Werror,-Wrange-loop-construct]
    for (const auto [S, Mul] : Multiplicity) {
                    ^
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:12009:10:
 note: use reference type 'const value_type &' (aka 'const llvm::detail::DenseMapPair<const llvm::SCEV *, int> &') to prevent copying
    for (const auto [S, Mul] : Multiplicity) {
         ^~~~~~~~~~~~~~~~~~~~~
                    &
2024-08-13 17:13:04 +08:00
Lawrence Benson
e0ad56b735
[AArch64] Add lowering for @llvm.experimental.vector.compress (#101015)
This is a follow-up to #92289 that adds custom lowering of the new
`@llvm.experimental.vector.compress` intrinsic on AArch64 with SVE
instructions.

Some vectors have a `compact` instruction that they can be lowered to.
2024-08-13 11:04:17 +02:00
Nikita Popov
306b9c7b48
[SCEV] Handle more add/addrec mixes in computeConstantDifference() (#101999)
computeConstantDifference() can currently look through addrecs with
identical steps, and then through adds with identical operands (apart
from constants).

However, it fails to handle minor variations, such as two nested add
recs, or an outer add with an inner addrec (rather than the other way
around).

This patch supports these cases by adding a loop over the
simplifications, limited to a small number of iterations. The motivation
is the same as in #101339, to make
computeConstantDifference() powerful enough to replace existing uses of
`dyn_cast<SCEVConstant>(getMinusSCEV())` with it. Though as the IR test
diff shows, other callers may also benefit.
2024-08-13 11:01:39 +02:00
Amara Emerson
334a366ba7 [AArch64][Darwin][SME] Don't try to save VG to the stack for unwinding.
On Darwin we don't have any hardware that has SVE support, only SME.
Therefore we don't need to save VG for unwinders and can safely omit it.

This also fixes crashes introduced since this feature landed since Darwin's
compact unwind code can't handle the presence of VG anyway.

rdar://131072344
2024-08-13 01:46:43 -07:00
Matthias Springer
b8bf14eecf
[mlir][LLVMIR] Check number of elements in mlir.constant verifier (#102906)
Check that the number of elements in the result type and the attribute
of an `llvm.mlir.constant` op matches. Also fix a broken test where that
was not the case.
2024-08-13 10:39:49 +02:00
Chuanqi Xu
85b113c381
[Doc] [C++20] [Modules] Clarify the reachability of internal partition units (#102572)
Motivated by https://github.com/llvm/llvm-project/issues/101348

Although I don't want the tool's doc to explain the standard's wording,
the wording itself has some unspecified thing. So I feel it will be
helpful to make it clear. At least it may help us receive less invalid
issue reports.
2024-08-13 16:34:32 +08:00
Florian Hahn
2ab910c08c
[LV] Check pointer user are in loop when checking for uniform pointers.
Widening decisions are not set for users outside the loop. Avoid
crashing by only calling isVectorizedMemAccessUse for users in the loop.

Fixes https://github.com/llvm/llvm-project/issues/102934.
2024-08-13 09:23:44 +01:00
Pablo Antonio Martinez
2913e71865
[mlir][vector] Refactor vector-transfer-unroll.mlir (NFC) (#102593)
Overview of changes:

- All memref input arguments are re-named to %mem.
- All vector input arguments are re-named to %vec.
- LIT variables are update to be consistent with input arguments.
- Renamed all output arguments as %res.
- Unified identation of `FileCheck` commands
- Separated tests (previously there was a big test containing a couple of tests)
2024-08-13 09:09:50 +01:00
Abinaya Saravanan
86ef9ee600
[HEXAGON] Enable Utilize Mask Instruction Pass only if the Arch (#102880)
version is greater than v66

No support for mask instruction before arch version v66
2024-08-13 13:30:20 +05:30
Matthias Springer
7030280329
[mlir][GPU] Improve gpu.module op implementation (#102866)
- Replace hand-written parser/printer with auto-generated assembly
format.
- Remove implicit `gpu.module_end` terminator and use the `NoTerminator`
trait instead. (Same as `builtin.module`.)
- Turn the region into a graph region. (Same as `builtin.module`.)
2024-08-13 09:37:36 +02:00
LLVM GN Syncbot
f5ba3f6740 [gn build] Port 2d53f0aab785 2024-08-13 07:18:54 +00:00
Timm Baeder
2d53f0aab7
[clang][Interp][NFC] Move _Complex compiler code to separate file (#103004) 2024-08-13 09:18:28 +02:00
Kazu Hirata
3b9f183958
[AMDGPU] Use llvm::any_of, llvm::all_of, and llvm::none_of (NFC) (#103007) 2024-08-13 00:07:54 -07:00
Mészáros Gergely
aa03327a46
[X86][AVX] Add missing X86ISD::VBROADCAST(v2i64 -> v4i64) isel pattern for AVX1 targets (#102853)
An internal bug revealed that this form can be formed from existing
combines, and then fail to select. Use the same pattern as v2f64 ->
v4f64 (the instructions are moving bits around the actual type does not
matter here).
2024-08-13 15:05:44 +08:00
Freddy Ye
2c62d08bda
[X86][MC] Add assembly alias for CCMP, CTEST, SETZUCC, CMPCCXADD (#102284) 2024-08-13 14:53:41 +08:00
Kazu Hirata
3c5509d9ad
[flang] Use llvm::is_contained (NFC) (#102999) 2024-08-12 22:53:28 -07:00
Rahul Joshi
b68df879c6
[TableGen] Fix build failure by using int type for NextChar (#103000)
Fixes an issue in https://github.com/llvm/llvm-project/pull/102967, 
which inddvertently changed the type of `NextChar` from int to char,
causing ppc64le build failures.
2024-08-13 07:47:30 +03:00
Timm Baeder
d4dfeb373e
[clang][Interp] Compile field+base destruction into class dtor func (#102871) 2024-08-13 06:39:35 +02:00