500240 Commits

Author SHA1 Message Date
Stephen Tozer
2705c605da
[RemoveDIs] Update syntax highlighting to include debug records (#93660)
This patch updates the emacs, vim, and vscode syntax highlighters to
recognize debug records.
2024-05-30 12:17:37 +01:00
Shengchen Kan
22c572eae0 [X86][CodeGen] Support memory folding for NDD -> RMW 2024-05-30 19:06:22 +08:00
Sander de Smalen
8eb0945373 [Clang][AArch64] NFC: Simplify checkArmStreamingBuiltin.
Changing this into if -> else if -> else if > else is NFC, because
the values of FnType are mutually exclusive.
2024-05-30 10:26:14 +00:00
Sander de Smalen
1d57594d3d [Clang][AArch64] NFC: Remove -DTEST_SME from RUN lines
We can do this in favour of checking the feature macro that is set
when compiling for '+sme', like we do in other tests.
2024-05-30 10:25:27 +00:00
Andrzej Warzyński
fecf5c7492
[llvm][nfc] Rename tests (#93794)
Renames asm-constraint-jR.ll and asm-constraint-jR.ll - on
case-insensitive files systems those are treated as one file. Originally
introduced in #92338.
2024-05-30 11:07:45 +01:00
Ramkumar Ramachandra
43100766f2
LV: generalize profitability criterion over TC (#93300)
Generalize LoopVectorizationPlanner::isMoreProfitable smoothly across
the fixed-vector and scalable-vector cases, taking the trip-count into
account, and fixing logical pitfalls that arise from a lack of
generality.
2024-05-30 10:54:32 +01:00
Stefan Gränitz
4310988991 [clang-repl] Even more tests create the Interpreter and must check host JIT support 2 (#84758) 2024-05-30 11:52:15 +02:00
Nikita Popov
b2bd024384 [CGExprAgg] Don't create zero index GEP
With opaque pointers, we no longer need a zero-index GEP to get
the first element.
2024-05-30 11:47:07 +02:00
Sergei Barannikov
3fee8b3469
[GISel] LegalizationArtifactCombiner: Elide redundant G_SEXT_INREG (#93687)
This is similar to 373c343a, but for targets with zero-or-negative-one
booleans.
The difference in tests is mostly due to G_SEXT_INREG being illegal for
some targets, in which case it gets expanded into G_SHL/G_ASHR pair,
which is not currently optimized by the combiner.
2024-05-30 12:40:42 +03:00
Tom Eccles
7e9b949a8d
[flang][OpenMP] Adapt OMPMapInfoFinalization to run on all top level ops (#93545)
This is generally just for consistency with the rest of the pipeline.

The assertion for the insertion point is because I am not sure if
omp::PrivateClauseOp is supported by FirOpBuilder::getAllocaBlock. I
didn't try to fix it because I don't see why we would generate IR like
that.

See RFC:
https://discourse.llvm.org/t/rfc-add-an-interface-for-top-level-container-operations
2024-05-30 10:24:51 +01:00
jeanPerier
fd8b2d2046
[flang] lower RANK intrinsic (#93694)
First commit is reviewed in
https://github.com/llvm/llvm-project/pull/93682.

Lower RANK using fir.box_rank. This patches updates fir.box_rank to
accept box reference, this avoids the need of generating an assumed-rank
fir.load just for the sake of reading ALLOCATABLE/POINTER rank. The
fir.load would generate a "dynamic" memcpy that is hard to optimize
without further knowledge. A read effect is conditionally given to the
operation.
2024-05-30 11:02:09 +02:00
Vlad Serebrennikov
32b91ec395 [cmake] Fix -fno-lifetime-dse not being passed to GCC
A follow-up to #92953. This should fix unexpected performance gains when Clang is built with GCC, and fix downstream LTO crashes reported in 4feae05c6a (r142466703)
2024-05-30 12:00:24 +03:00
Mubashar Ahmad
bc946f5287
[mlir][vector] Add 1D vector.deinterleave lowering (#93042)
This patch implements the lowering of vector.deinterleave 
for 1D vectors.

For fixed vector types, the operation is lowered to two
llvm shufflevector operations. One for even indexed
elements and the other for odd indexed elements. A poison
operation is used to satisfy the parameters of the
shufflevector parameters.
    
For scalable vectors, the llvm vector.deinterleave2
intrinsic is used for lowering. As such the results
found by extraction and used to form the result
struct for the intrinsic.
2024-05-30 09:42:35 +01:00
Nikita Popov
cd9a02e2c7 [CodeGen] Remove useless zero-index constant GEPs (NFCI)
Remove zero-index constant expression GEPs, which are not needed
with opaque pointers and will get folded away.
2024-05-30 10:24:57 +02:00
Him188
8bce40b1eb
[AArch64][GISel] Support SVE with 128-bit min-size for G_LOAD and G_STORE (#92130)
This patch adds basic support for scalable vector types in load & store
instructions for AArch64 with GISel.

Only scalable vector types with a 128-bit base size are supported, e.g.
`<vscale x 4 x i32>`, `<vscale x 16 x i8>`.

This patch adapted some ideas from a similar abandoned patch
[https://github.com/llvm/llvm-project/pull/72976](https://github.com/llvm/llvm-project/pull/72976).
2024-05-30 09:10:43 +01:00
Oleksandr "Alex" Zinenko
67897d77ed
[mlir][py] invalidate nested operations when parent is deleted (#93339)
When an operation is erased in Python, its children may still be in the
"live" list inside Python bindings. After this, if some of the newly
allocated operations happen to reuse the same pointer address, this will
trigger an assertion in the bindings. This assertion would be incorrect
because the operations aren't actually live. Make sure we remove the
children operations from the "live" list when erasing the parent.

This also concentrates responsibility over the removal from the "live"
list and invalidation in a single place.

Note that this requires the IR to be sufficiently structurally valid so
a walk through it can succeed. If this invariant was broken by, e.g, C++
pass called from Python, there isn't much we can do.
2024-05-30 10:06:02 +02:00
Pavel Labath
540a36ad7e
[lldb/DWARF] Follow DW_AT_signature when computing type contexts (#93675)
This is necessary to correctly resolve the context within types, as the
name of the type is only present in the type unit.
2024-05-30 09:57:51 +02:00
Pavel Labath
d554f2379b
[lldb] Fix module name tab completion (#93458)
Module names can be matched either by a full path or just their
basename. The completion machinery tried to do both, but had several
bugs:
- it always inserted the basename as a completion candidate, even if the
string being completed was a full path
- due to FileSpec canonicalization, it lost information about trailing
slashes (it treated "lib/<TAB>" as "lib<TAB>", even though it's clear
the former was trying to complete a directory name)
- due to both of the previous issues, the completion candidates could
end up being shorter than the string being completed, which caused
crashes (string out of range errors) when attempting to substitute the
results.

This patch rewrites to logic to remove these kinds of issues:
- basename and full path completion are handled separately
- full path completion is attempted always, basename only if the input
string does not contain a slash
- the code remembers both the canonical and original spelling or the
completed argument. The canonical arg is used for matching, while the
original spelling is used for completion. This way "/foo///.//b<TAB>"
can still match "/foo/bar", but it will complete to "/foo///.//bar".
2024-05-30 09:57:13 +02:00
Pavel Labath
f38ebec710
[lldb-dap] Don't call GetNumChildren on non-indexed synthetic variables (#93534)
A synthetic child provider might need to do considerable amount of work
to compute the number of children. lldb-dap is currently calling that
for all synthethic variables, but it's only actually using the value for
values which it deems to be "indexed" (which is determined by looking at
the name of the first child). This patch reverses the logic so that
GetNumChildren is only called for variables with a suitable first child.
2024-05-30 09:54:13 +02:00
Matheus Izvekov
3cabbf6039
[clang] text ast-dumper: dump TemplateName for TST and DTST (#93766)
Implement AST text dumping of the TemplateName for
TemplateSpecializationType and DeducedTemplateSpecializationType.
2024-05-30 04:48:45 -03:00
AtariDreams
1034b4d38d
[InstCombine] lshr (mul (X, 2^N + 1)), N -> X when X is half-width (#93677)
Alive2 Proof:
https://alive2.llvm.org/ce/z/Yd2CKF
2024-05-30 09:39:32 +02:00
Matheus Izvekov
0eb4bf2faf
[clang] CWG150: add tests and change to unreleased (#93758) 2024-05-30 04:39:21 -03:00
jeanPerier
74faa402cc
[flang] lower allocatable assumed-rank specification parts (#93682)
Lower allocatable and pointers specification parts. Nothing special is
required to allocate the descriptor given they are required to be dummy
arguments, however, care must be taken with INTENT(OUT) to use the
runtime to deallocate them (inlined fir.embox + store is not possible).
2024-05-30 09:31:18 +02:00
jeanPerier
e398383f9a
[flang][fir] add codegen for fir.load of assumed-rank fir.box (#93569)
- Update LLVM type conversion of assumed-rank fir.box/class to generate
the type of the maximum ranked descriptor. That way, alloca for assumed
rank descriptor copies are always big enough. This is needed in the
fir.load case that generates a new storage for the value
- Add a "computeBoxSize" helper to compute the dynamic size of a
descriptor.
- Use that size to generate an llvm.memcpy intrinsic to copy the input
descriptor into the new storage.

Looking at https://reviews.llvm.org/D108221?id=404635, it seems valid to
add the TBAA node on the memcpy, which I did.

In a further patch, I think we should likely always use a memcpy since
LLVM seems to have a better time optimizing it than fir.load/fir.store
patterns.
2024-05-30 09:30:27 +02:00
Freddy Ye
6f2794afeb
Fix build warning for '[X86] Support EGPR for inline assembly. (#92338)' (#93777) 2024-05-30 15:25:08 +08:00
Pavel Labath
c7acca1cb0 [lldb] Fix collisions between two breakpad tests
symtab-sorted-by-size.test was using the same output file name as
symtab.test.
2024-05-30 07:16:22 +00:00
Shengchen Kan
7f524f7ef2 [X86][CodeGen] Simplify the code in foldMemoryOperandImpl, NFCI
In preparation for the coming NDD -> RMW fold.
2024-05-30 14:57:38 +08:00
Freddy Ye
73f4c2547d
[X86] Support EGPR for inline assembly. (#92338)
"jR": explicitly enables EGPR
"r", "l", "q": enables/disables EGPR w/wo -mapx-inline-asm-use-gpr32
"jr": explicitly enables GPR with -mapx-inline-asm-use-gpr32
-mapx-inline-asm-use-gpr32 will also define a new macro:
`__APX_INLINE_ASM_USE_GPR32__`

GCC patches:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631183.html
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631186.html
[[PATCH v2] x86: Define _APX_INLINE_ASM_USE_GPR32_
(gnu.org)](https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649003.html)

Reference: https://gcc.godbolt.org/z/nPPvbY6r4
2024-05-30 14:47:47 +08:00
Matheus Izvekov
1ac592c4e7
[clang] fix merging of UsingShadowDecl (#80245)
[clang] fix merging of UsingShadowDecl

Previously, when deciding if two UsingShadowDecls where mergeable,
we would incorrectly only look for both pointing to the exact redecla
ration, whereas the correct thing is to look for declarations to the
same entity.

This problem has existed as far back as 2013, introduced in commit
fd8634a09de71.

This problem could manifest itself as ODR check false positives when
importing modules.

Fixes: #80252
2024-05-30 03:43:27 -03:00
Nikita Popov
d10b76552f
[ConstantFold] Remove notional over-indexing fold (#93697)
The data-layout independent constant folding currently has some rather
gnarly code for canonicalizing GEP indices to reduce "notional
overindexing", and then infers inbounds based on that canonicalization.

Now that we canonicalize to i8 GEPs, this canonicalization is
essentially useless, as we'll discard it as soon as the GEP hits the
data-layout aware constant folder anyway. As such, I'd like to remove
this code entirely.

This shouldn't have any impact on optimization capabilities.
2024-05-30 08:36:44 +02:00
Guy David
4bce270157
[mlir][llvm] Implement ConstantLike for ZeroOp, UndefOp, PoisonOp (#93690)
These act as constants and should be propagated whenever possible. It is
safe to do so for mlir.undef and mlir.poison because they remain "dirty"
through out their lifetime and can be duplicated, merged, etc. per the
LangRef.

Signed-off-by: Guy David <guy.david@nextsilicon.com>
2024-05-30 08:21:08 +02:00
Christian Ulmann
6a3982f8b7
[MLIR][LLVM] Relax the LLVM dialect's inliner assuming UCF (#93514)
This commit changes the LLVM dialect's inliner interface to stop
assuming that the inlined function only contained unstructured control
flow. This is not necessarily true, and it lead to not properly
propagating the noalias information.
2024-05-30 07:58:13 +02:00
Matheus Izvekov
498da62088
[NFC] [clang] add tests for merging of UsingShadowDecl 2024-05-30 02:56:57 -03:00
Pavel Labath
3e023d87d8
[lldb] Remove DWARFDebugInfo DIERef footguns (#92894)
DWARFDebugInfo doesn't know how to resolve the "file_index" component of
a DIERef. This patch removes GetUnit (in favor of existing
GetUnitContainingDIEOffset) and changes GetDIE to take only the
components it actually uses.
2024-05-30 07:48:59 +02:00
Mehdi Amini
e6821dd8c8
Revert "[MLIR][Python] add ctype python binding support for bf16" (#93771)
Reverts llvm/llvm-project#92489

This broke the bots.
2024-05-29 23:21:04 -06:00
Mehdi Amini
49ef21d767 Remove debug print from CI generation script (NFC) 2024-05-29 22:02:30 -07:00
Bimo
89801c74c3
[MLIR][Python] add ctype python binding support for bf16 (#92489)
Since bf16 is supported by mlir, similar to
complex128/complex64/float16, we need an implementation of bf16 ctype in
Python binding. Furthermore, to resolve the absence of bf16 support in
NumPy, a third-party package [ml_dtypes
](https://github.com/jax-ml/ml_dtypes) is introduced to add bf16
extension, and the same approach was used in `torch-mlir` project.

See motivation and discussion in:
https://discourse.llvm.org/t/how-to-run-executionengine-with-bf16-dtype-in-mlir-python-bindings/79025
2024-05-29 22:01:40 -07:00
Mehdi Amini
7d4a45d982 Revert "Add option to generate additional debug info for expression dereferencing pointer to pointers. (#81545)"
This reverts commit aeccfee348c717165541d8d895b9b0cdfe31415c, and dependents:

Revert "[NFC] Fix PPC buildbot failure https://lab.llvm.org/buildbot/#/builders/230/builds/29066"
This reverts commit 2b1d1c51f6e321267cc86e9db7808298c59caf0e.

Revert "Fix test - remove unnecessary/incorrect `-S`, in favor of `-emit-llvm`"
This reverts commit ea1ecb50fa831583241fc531153bd2c072955d29.

The test is failing on MacOs and Windows
2024-05-29 21:56:59 -07:00
Helena Kotas
8890209ead
[HLSL] Default and Relaxed Availability Diagnostics (#92704)
Implements HLSL availability diagnostics' default and relaxed mode.

HLSL availability diagnostics emits errors or warning when unavailable
shader APIs are used. Unavailable shader APIs are APIs that are exposed
in HLSL code but are not available in the target shader stage or shader
model version.

In the default mode the compiler emits an error when an unavailable API
is found in a code that is reachable from the shader entry point
function. In the future this check will also extended to exported
library functions (#92073). The relaxed diagnostic mode is the same
except the compiler emits a warning. This mode is enabled by
``-Wno-error=hlsl-availability``.

See HLSL Availability Diagnostics design doc
[here](https://github.com/llvm/llvm-project/blob/main/clang/docs/HLSL/AvailabilityDiagnostics.rst)
for more details.

Fixes #90095
2024-05-29 21:52:20 -07:00
Mehdi Amini
02c6845c76
Revert "[DebugInfo] Add flag to only emit referenced member functions" (#93767)
Reverts llvm/llvm-project#87018

MacOS and Windows bots are broken.
2024-05-29 22:48:15 -06:00
Pavel Samolysov
32f1f5ee39
[PGO] Add tests for modules with only globals and function declarations (#93764)
When a module contains globals and/or function declarations only, the
'__llvm_profile_raw_version' variable should not be generated because
the module was not instrumented at all.

NFC
2024-05-30 07:10:26 +03:00
Owen Pan
3db1f3110e
[clang-format] Fix a regression in annotating class decl braces (#93657)
Fixes #93604.
2024-05-29 21:05:32 -07:00
Florian Hahn
1794046536
[VPlan] Move verifier to class to reduce need to pass via args. (NFC)
Move VPlan verification functions to avoid the need to pass VPDT across
multiple calls. This also allows easier extensions in the future.
2024-05-29 21:01:28 -07:00
Mark Rowe
815250b219
[compiler-rt] Don't rely on automatic codesigning with Apple's linker (#91681)
In https://github.com/llvm/llvm-project/pull/88323, I changed the logic
within `add_compiler_rt_runtime` to only explicitly code sign the
resulting library if an older version of Apple's ld64 was in use. This
was based on the assumption that newer versions of ld64 and the new
Apple linker always ad-hoc sign their output binaries. This is true in
most cases, but not when using Apple's new linker with the
`-darwin-target-variant` flag to build Mac binaries that are compatible
with Catalyst.

Rather than adding increasingly complicated logic to detect the exact
scenarios that require explicit code signing, I've opted to always
explicitly code sign when using any Apple linker. We instead detect and
use the 'linker-signed' codesigning option when possible to match the
signatures that the linker would otherwise create. This avoids having
non-'linker-signed' ad-hoc signatures which was the underlying problem
that https://github.com/llvm/llvm-project/pull/88323 was intended to
address.

Co-authored-by: Mark Rowe <markrowe@chromium.org>
2024-05-29 20:56:05 -07:00
Mehdi Amini
d38d0a0d1b Revert "[ELF] Simplify getSectionRank"
This reverts commit f639b57f7993cadb82ee9c36f04703ae4430ed85.

The premerge bot is still broken with failing bolt test.
2024-05-29 20:32:34 -07:00
Fangrui Song
f639b57f79 [ELF] Simplify getSectionRank
Follow-up to a previous simplification
2473b1af085ad54e89666cedf684fdf10a84f058.

The xor difference between a SHT_NOTE and a read-only SHT_PROGBITS
(previously >=NOT_SPECIAL) should be smaller than RF_EXEC. Otherwise,
for the following section layout, `findOrphanPos` would place .text
before note.

```
// simplified from linkerscript/custom-section-type.s
non orphans:
progbits 0x8060c00 NOT_SPECIAL
note     0x8040003

orphan:
.text    0x8061000 NOT_SPECIAL
```

---

Identical to 2e0cfe69d0d705e9c5d5f217625bf7e3a0e90871.
The revert 30c10fda2ba539e70bff4f05625ec6358c0f7502 is wrong.
2024-05-29 20:08:05 -07:00
Pavel Samolysov
8c33b3380b
[PGO] Add a unit test for the PGOInstrumentationGen pass (#93636)
The patch introduces the gmock-based unittest infrastructure for PGO
Instrumentation and adds some test cases to check whether the
instrumentation has taken place. The testing infrastructure for analysis
modules was borrowed from the LoopPassManagerTest unittest and
simplified a bit to handle module analysis passes only. Actually, we are
testing whether the result of a trivial analysis pass was invalidated by
the PGOInstrumentGen one: we exploit the fact the pass invalidates all
the analysis results after a module was instrumented.

NFC.
2024-05-30 05:51:29 +03:00
csstormq
96d2dc7210
[SCEVAA] Enhance SCEVAAResult::alias() to handle two pointers with different pointer bases (#91453)
This patch enhances the SCEVAAResult::alias() interface to handle two
pointers with different pointer bases.

Before calling getMinusSCEV(), we firstly try to explicitly convert
these two pointers into ptrtoint expressions to do that.

Either both pointers are used with ptrtoint or neither, so we can't
end up with a ptr + int mix.
2024-05-30 10:50:32 +08:00
Mehdi Amini
30c10fda2b Revert "[ELF] Simplify getSectionRank"
This reverts commit 2e0cfe69d0d705e9c5d5f217625bf7e3a0e90871.

Buildbots are broken.
2024-05-29 19:04:08 -07:00
Chen Zheng
2b1d1c51f6 [NFC] Fix PPC buildbot failure https://lab.llvm.org/buildbot/#/builders/230/builds/29066
Failure was introduced in https://github.com/llvm/llvm-project/pull/81545

On 64-bit targets for i32 return type, there will be extension in the function
prototype.
2024-05-29 21:52:55 -04:00