Commit Graph

527837 Commits

Author SHA1 Message Date
Sirraide
888c09986c [Clang] Add release note for #127623 (#127815)
While reviewing #127623, I missed that it didn’t have a release note.
2025-02-19 16:48:38 +01:00
cor3ntin
80ccf01c33 [Clang] Do not try to transform invalid bindings (#125658)
In the presence of an invalid structured binding decomposition, some
binding packs may be invalid and trying to transform them would produce
a recovery expression that does not contains a pack, leading to
assertions in places where we would expect a pack at that stage.

Fixes #125165
2025-02-19 16:47:18 +01:00
c8ef
826af1757c [libc] add LLVM_LIBC_CAST macro. (#127319)
related: #127238

This patch adds a macro called `LLVM_LIBC_CAST`, similar to
`__BIONIC_CAST`, for type conversion in `endian.h`.
2025-02-19 23:28:11 +08:00
Javier Lopez-Gomez
4624087328 [llvm-dwarfdump] Print number of out-of-line functions described by DWARF (#127233)
Some of the functions in `#functions` may have several inlined
instances, but also an out-of-line definition.

Therefore, for complex enough DWARF input, `#functions` - `#inlined
functions` would not give us the number of out-of-line function
definitions.
`llvm-dwarfdump`, however, already keeps track of those; print it as
part of the statistics, as this number is useful in certain scenarios.
2025-02-19 15:27:16 +00:00
Alejandro Álvarez Ayllón
26a8399417 [clang][Sema] Fix initialization of NonTypeTemplateParmDecl... (#121768)
...when there are invalid constraints.

When attaching a `TypeConstraint`, in case of error, the trailing
pointer that is supposed to point to the constraint is left
uninitialized.
Sometimes the uninitialized value will be a `nullptr`, but at other
times it will not. If we traverse the AST (for instance, dumping it, or
when writing the BMI), we may get a crash depending on the value that
was left. The serialization may also contain a bogus value.

In this commit, we always initialize the `PlaceholderTypeConstraint`
with `nullptr`, to avoid accessing this uninitialized memory.

This does not affect only modules, but it causes a segfault more
consistently when they are involved.

The test case was reduced from `mp-units`.

---------

Co-authored-by: Erich Keane <ekeane@nvidia.com>
2025-02-19 07:19:31 -08:00
Fraser Cormack
fb5a87e1a6 [libclc][NFC] Reformat ep_log.cl 2025-02-19 15:18:05 +00:00
lorenzo chelini
0b63dfb066 [MLIR][NFC] Use base alias for constructor inheritance (#127756)
During my previous cleanup (#127403), I did not notice that we defined a
type alias for the base class. This type alias allows us to use the
shorter form Base::Base, and this PR switches to that.
2025-02-19 16:05:25 +01:00
Jean-Didier PAILLEUX
d6c6bde9db [flang] Implement !DIR$ UNROLL_AND_JAM [N] (#125046)
This patch implements support for the UNROLL_AND_JAM directive to enable
or disable unrolling and jamming on a `DO LOOP`.
It must be placed immediately before a `DO LOOP` and applies only to the
loop that follows. N is an integer that specifying the unrolling factor.
This is done by adding an attribute to the branch into the loop in LLVM
to indicate that the loop should unrolled and jammed.
2025-02-19 15:00:09 +00:00
Tom Stellard
2b340c10a6 flang: Fix build with latest libc++ (#127362)
I think this first stopped working with
954836634a. This patch fixes the following
error:


/home/runner/work/llvm-project/llvm-project/flang/runtime/io-api-minimal.cpp:153:11:
error: '__libcpp_verbose_abort' is missing exception specification
'noexcept'
   153 | void std::__libcpp_verbose_abort(char const *format, ...) {
       |           ^
| noexcept
/mnt/build/bin/../include/c++/v1/__verbose_abort:30:28: note: previous
declaration is here
30 | __printf__, 1, 2) void __libcpp_verbose_abort(const char* __format,
...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT;
       |                            ^
1 error generated.
2025-02-19 06:53:30 -08:00
Benjamin Maxwell
d804c83893 [clang] Lower modf builtin using llvm.modf intrinsic (#126750)
This updates the existing `modf[f|l]` builtin to be lowered via the
`llvm.modf.*` intrinsic (rather than directly to a library call).
2025-02-19 14:49:22 +00:00
David Tenty
aa9e519b24 Revert "[PowerPC] Deprecate uses of ISD::ADDC/ISD::ADDE/ISD::SUBC/ISD::SUBE (#116984)"
This reverts commit 7763119c6e (leaving the modifications from 03cb46d248)..
2025-02-19 09:44:39 -05:00
Md Asghar Ahmad Shahid
760ec2c38e [MLIR][Linalg] Introduce Python API for linalg.batch_matmul Ops. (#127614)
As linalg.batch_matmul has been moved into tablegen from OpDSL, its
derived python wrapper no longer exist.This patch adds the required
python wrapper.

Also refactors the BatchmatmulOp printer to make it consistent with its
parser.
2025-02-19 14:15:02 +00:00
Florian Hahn
01d0793a69 [LAA] Make Ptr argument optional in isNoWrap. (#127410)
Update isNoWrap to make the IR Ptr argument optional. This allows using
isNoWrap when dealing with things like pointer-selects, where a select
is translated to multiple pointer SCEV expressions, but there is no IR
value that can be used. We don't try to retrieve pointer values for the
pointer SCEVs and using info from the IR would not be safe. For example,
we cannot use inbounds, because the pointer may never be accessed.

PR: https://github.com/llvm/llvm-project/pull/127410
2025-02-19 14:51:19 +01:00
zhijian lin
1ac0db44fd [NFC] using isUndef() instead of getOpcode() == ISD::UNDEF (#127713)
[NFC] using isUndef() instead of getOpcode() == ISD::UNDEF
2025-02-19 08:42:38 -05:00
A. Jiang
7f69a399df [libc++] Deprecate and remove member types of hash in <variant> (#127758)
These member types were deprecated in C++17 by P0174R2 and removed in
C++20 by P0619R4, but the changes in `<variant>` seem missing.

Drive-by: Replace one `_NOEXCEPT` with `noexcept` as the `hash`
specialization is C++17-and-later only.
2025-02-19 21:31:56 +08:00
Timm Baeder
43e83b9405 [clang][bytecode] Fix allocating primitive arrays of unknown bound (#127788) 2025-02-19 14:29:52 +01:00
Louis Dionne
2c8b124851 [libc++] Guard include of <features.h> with __has_include (#127691)
Some configurations define __AMDGPU__ or __NVPTX__ on platforms that
don't provide <features.h>, such as CUDA on Mac.
2025-02-19 08:21:56 -05:00
Adam Siemieniuk
c6a907ac46 [mlir][dlti] Fix query keys preallocation (#127786)
Fixes upfront space allocation after #126716
2025-02-19 13:28:42 +01:00
Durgadoss R
3ce2e4df5d [NVPTX] Add tcgen05.cp/shift intrinsics (#127669)
This patch adds intrinsics for tcgen05.cp and
tcgen05.shift instructions.

lit tests are added and verified with a
ptxas-12.8 executable.

Docs are updated in the NVPTXUsage.rst file.

Signed-off-by: Durgadoss R <durgadossr@nvidia.com>
2025-02-19 17:55:25 +05:30
Fraser Cormack
73d067977b [libclc] Clean up directory search procedure (#127783)
During a recent change, the build system accidentally dropped the
(theoretical) support for the CLC builtins library to build
target-specific builtins from the 'amdgpu' directory, due to a change in
variable names. This functionality wasn't being used but was spotted
during another code review.

This commit takes the opportunity to clean up and better document the
code that manages the list of directories to search for builtin
implementations.

While fixing this, some references to now-removed SOURCES files were
discovered which have been cleaned up.
2025-02-19 12:21:18 +00:00
Matt Arsenault
0f472e93d5 AMDGPU: Avoid double attribute lookup for register count attributes (#127782) 2025-02-19 19:14:18 +07:00
Daniel
c0a763d3ef [NFC][MLIR] Make file-local cl::opt global variables static (#126714)
This is per style-guide: make file-scope symbol static whenever possible.

Fix #125983.
2025-02-19 13:11:38 +01:00
Pavel Labath
fadbc33b01 [lldb] Add LineTable::{upper,lower}_bound (#127519)
The motivation is #123622 and the fact that is hard to fine the last
line entry in a given range. `FindLineEntryByAddress(range_end-1)` is
the best we have, but it's not ideal because it has a magic -1 and that
it relies on there existing a line entry at that address (generally, it
should be there, but if for some case it isn't, we might end up ignoring
the entries that are there (or -- like my incorrect fix in #123622 did
-- iterating through the entire line table).

What we really want is to get the last entry that exists in the given
range. Or, equivalently (and more STL-like) the first entry after that
range. This is what these functions do. I've used the STL names since
they do pretty much exactly what the standard functions do (the main
head-scratcher comes from the fact that our entries represent ranges
rather than single values).

The functions can also be used to simplify the maze of `if` statements
in `FindLineEntryByAddress`, but I'm keeping that as a separate patch.
For now, I'm just adding some unit testing for that function to gain
more confidence that the patch does not change the function behavior.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-02-19 12:58:55 +01:00
Elvina Yakubova
404f94ac7d [AArch64] Add optional extensions enabled on Grace (#127620)
Enable optional ISA extensions on Grace when mcpu=grace
is used: sve2-sm4, sve2-aes, sve2-sha3.
Grace is no longer an alias, but a separate CPU definition.
2025-02-19 11:27:38 +00:00
Mats Petersson
0de2ccab7b [flang][OpenMP]Improve support for DECLARE REDUCTION (#127088)
Part of the DECLARE REDUCTION was already supported by the parser, but
the semantics to add the reduction identifier wasn't implemented.

The semantics would not accept the name given by the reduction, so a few
lines added to support that.

Some tests were in place but not quite working, so fixed those up too.
Adding new tests for unparsing and parse-tree, as well as checking the
symbolic name being generated.

Lowering of DECLARE REDUCTION is not supported in this patch, and a test
that it hits the relevant TODO is in this patch (most of this was
already existing, but not actually testing the TODO message).
2025-02-19 10:39:43 +00:00
Uday Bondhugula
3c938d0d53 [MLIR][Affine] Fix affine.parallel op verifier (#127611)
Fix affine.parallel op verifier for missing check on zero result lower
or upper bound maps. lb/ub maps should have at least one result.

Fixes: https://github.com/llvm/llvm-project/issues/120186
2025-02-19 15:56:23 +05:30
Fraser Cormack
1509b46ea5 [libclc] Improve nextafter behaviour around zero (#127469)
This commit improves the behaviour of (__clc_)nextafter around zero.
Specifically, the nextafter value of very small negative numbers in the
positive direction is now negative zero. Previously we'd return positive
zero.

This behaviour is not required as far as OpenCL is concerned: at least,
the CTS isn't testing for it. However, this change does bring our
implementation into bit-equivalence with (libstdc++'s implementation of)
std::nextafter, tested on all possible values of 32-bit float towards
both positive and negative INFINITY.

Furthermore, since the implementation of libclc's floating-point 'rtp'
and 'rtz' conversions use __clc_nextafter, the previous behaviour was
resulting in CTS validation issues. For example, when converting float
-0x1.000002p-25 to half, rounding towards zero or positive infinity,
nextafter was returning +0.0, whereas the correct conversion requires us
to return -0.0.

We could work around this issue in the conversion functions, but since
the change to nextafter is small enough and the behaviour around zero
matches libstdc++, the fix feels at home there.

This commit also converts several variables to unsigned types to avoid
undefined behaviour surrounding signed underflow on the subtractions.
It also converts some variables to be kept in floating-point types, using
fabs to get the absolute value rather than by bit-hacking.
2025-02-19 10:24:12 +00:00
Benjamin Maxwell
7781e1040d [clang] Lower non-builtin sincos[f|l] calls to llvm.sincos.* when -fno-math-errno is set (#121763)
This will allow vectorizing these calls (after a few more patches). This
should not change the codegen for targets that enable the use of AA
during the codegen (in `TargetSubtargetInfo::useAA()`). This includes
targets such as AArch64. This notably does not include x86 but can be
worked around by passing `-mllvm -combiner-global-alias-analysis=true`
to clang.

Follow up to #114086.
2025-02-19 10:13:41 +00:00
Thirumalai Shaktivel
160da73b85 [Flang] Check if two ArrayConstructor's are Equal (#121181)
This also includes comparing the two ImpliedDo

Details
- For ArrayConstructor, check if x and y have the same
  elements and type
- For ImpliedDo, check if x and y have the same lower,
  upper, stride and values

Fixes: https://github.com/llvm/llvm-project/issues/104526
2025-02-19 15:21:31 +05:30
Fabian Ritter
c442b39770 [AMDGPU][docs][NFC] Replace gfx940 with gfx942 in the gfx940 ISA doc (#126906)
gfx940 and gfx941 are no longer supported. This is the last one of a
series of PRs to remove them from the code base.

The ISA documentation still contains a lot of links and file names with
the "gfx940" identifier. Changing them to "gfx942" is probably not worth
the cost of breaking all URLs to these pages that users might have saved
in the past.

For SWDEV-512631
2025-02-19 10:37:48 +01:00
Simon Pilgrim
0607f94280 [X86] getFauxShuffleMask - add support for vXi64/vXf64 concat_vectors decoding (#127630)
Similar to insert_subvector - limit this to vXi64 vector cases to make the most of cross lane shuffles (for now).
2025-02-19 09:34:15 +00:00
Fabian Ritter
db597084c5 [AMDGPU][docs] Replace gfx940 and gfx941 with gfx942 in llvm/docs (#126887)
gfx940 and gfx941 are no longer supported. This is one of a series of
PRs to remove them from the code base.

This PR removes all documentation occurrences of gfx940/gfx941 except
for the gfx940 ISA description, which will be the subject of a separate
PR.

For SWDEV-512631
2025-02-19 10:31:47 +01:00
Fabian Ritter
2260d59257 [AMDGPU] Remove FeatureForceStoreSC0SC1 (#126878)
This was only used for gfx940 and gfx941, which have since been removed.

For SWDEV-512631
2025-02-19 10:26:09 +01:00
Timm Baeder
1760289340 [clang][bytecode] Fix three-way unordered non-pointer comparisions (#127759)
This _can_ happen with non-pointers, but we shouldn't diagnose it in
that case.
2025-02-19 10:22:37 +01:00
Fabian Ritter
8615f9aaff [AMDGPU] Replace gfx940 and gfx941 with gfx942 in llvm (#126763)
gfx940 and gfx941 are no longer supported. This is one of a series of
PRs to remove them from the code base.

This PR removes all non-documentation occurrences of gfx940/gfx941 from
the llvm directory, and the remaining occurrences in clang.

Documentation changes will follow.

For SWDEV-512631
2025-02-19 10:20:48 +01:00
Nikita Popov
cc539138ac [CodeGen] Use __extendhfsf2 and __truncsfhf2 by default (#126880)
The standard libcalls for half to float and float to half conversion are
__extendhfsf2 and __truncsfhf2. However, LLVM currently uses
__gnu_h2f_ieee and __gnu_f2h_ieee instead. As far as I can tell, these
libcalls are an ARM-ism and only provided by libgcc on that platform.
compiler-rt always provides both libcalls.

Use the standard libcalls by default, and only use the __gnu libcalls on
ARM.
2025-02-19 10:16:57 +01:00
Pedro Lobo
4af8c5382e [BitcodeReader] Use poison instead of undef to represent unsupported constexprs in metadata (#127665)
Metadata that references unsupported constant expressions can be
represented with `poison` metadata instead of `undef` metadata.
2025-02-19 10:13:37 +01:00
Fabian Ritter
029c8e783d [AMDGPU][clang] Replace gfx940 and gfx941 with gfx942 in clang (#126762)
gfx940 and gfx941 are no longer supported. This is one of a series of
PRs to remove them from the code base.

This PR removes all occurrences of gfx940/gfx941 from clang that can be
removed without changes in the llvm directory. The
target-invalid-cpu-note/amdgcn.c test is not included here since it
tests a list of targets that is defined in
llvm/lib/TargetParser/TargetParser.cpp.

For SWDEV-512631
2025-02-19 10:11:48 +01:00
Simon Pilgrim
f3f4afe43f [X86] matchUnaryShuffle - add support for matching 512-bit extension patterns. (#127643)
Handles both BWI and non-BWI cases (skips PMOV*XBW without BWI).

The vector-interleaved-store-i8-stride-8.ll VPTERNLOG diffs are due to
better value tracking now recognizing the zero-extension patterns where
before it was any-extension
2025-02-19 09:07:49 +00:00
Fabian Ritter
8900e412ae [AMDGPU][MLIR] Replace gfx940 and gfx941 with gfx942 in MLIR (#125836)
gfx940 and gfx941 are no longer supported. This is one of a series of
PRs to remove them from the code base.

For SWDEV-512631
2025-02-19 10:05:45 +01:00
Matthias Springer
d4cb75ef8b [mlir][bufferization] Module bufferization: Delete obsolete code (#127455)
Delete `equivalenceAnalysis`, which has been incorporated into the
`getAliasingValues` API. Also add an additional test case to ensure that
equivalence is properly propagated across function boundaries.
2025-02-19 10:00:06 +01:00
Fabian Ritter
55fb793dc9 [AMDGPU] Add missing gfx architectures to AddFlangOffloadRuntime.cmake (#125827) 2025-02-19 09:58:56 +01:00
Fabian Ritter
a2f9ae1421 [AMDGPU] Replace gfx940 and gfx941 with gfx942 in offload and libclc (#125826)
gfx940 and gfx941 are no longer supported. This is one of a series of
PRs to remove them from the code base.

For SWDEV-512631 and SWDEV-512633
2025-02-19 09:56:04 +01:00
Thirumalai Shaktivel
99aea2176b [Flang][OpenMP] Skip threadprivate HostAssoc symbols for default privatization (#127754)
Issue: Compilation abnormally terminates in parallel default(private)

Documentation reference:
A threadprivate variable must not appear as the base variable of a list
item in any clause except for the copyin and copyprivate clauses

Explanation:
From the reference, the threadprivate symbols cannot be used in the DSA
clauses, which in turn means, the symbol can be skipped for default 
privatization

Fixes #123535
2025-02-19 14:17:20 +05:30
Vladislav Belov
b9a1e58b2c [RISCVISel] Compute leading zeros for RISCVISD::VCPOP_VL node (#127705)
This patch adds handling of the RISCVISD::VCPOP_VL node in
RISCVTargetLowering::computeKnownBitsForTargetNode. It eliminates
redundant zero-extension instructions.
2025-02-19 11:39:55 +03:00
Petr Hosek
a2b4d4e756 Revert "[libc] Add strftime_l" (#127766)
Reverts llvm/llvm-project#127708
2025-02-19 00:39:33 -08:00
Nikita Popov
850062cf49 [AA] Consider extractvalue and extractelement as escape sources (#127640)
CaptureTracking considers insertions into aggregates and vectors as
captures. As such, extractions from aggregates and vectors are escape
sources. A non-escaping identified local cannot alias with the result of
an extractvalue/extractelement.

Fixes https://github.com/llvm/llvm-project/issues/126670.
2025-02-19 09:16:56 +01:00
Petr Hosek
9072ba71ca [libc] Add strftime_l (#127708)
This is a (no-op) locale version of strftime.
2025-02-18 23:54:45 -08:00
Matthias Gehre
c4f8da94a1 [MLIR][emitc]: Remove unused functions (NFC) 2025-02-19 08:46:53 +01:00
Kazu Hirata
8f41d28d89 [c-index-test] Fix warnings
This patch fixes:

  clang/tools/c-index-test/c-index-test.c:1240:15: error: mixing
  declarations and code is a C99 extension
  [-Werror,-Wdeclaration-after-statement]

  clang/tools/c-index-test/c-index-test.c:1367:14: error: mixing
  declarations and code is a C99 extension
  [-Werror,-Wdeclaration-after-statement]

  clang/tools/c-index-test/c-index-test.c:1468:14: error: mixing
  declarations and code is a C99 extension
  [-Werror,-Wdeclaration-after-statement]
2025-02-18 23:18:08 -08:00