0
0
mirror of https://github.com/llvm/llvm-project.git synced 2025-04-23 04:26:06 +00:00

525746 Commits

Author SHA1 Message Date
Tom Stellard
a69568efe6 Bump version to 20.1.0-rc3 llvmorg-20.1.0-rc3 2025-02-25 18:02:43 -08:00
Tom Stellard
560ac756cb [CMake][Release] Statically link ZSTD on all OSes ()
This will make the binaries more portable.

(cherry picked from commit 09832777d830e0fddff84bf36793ec4e453656b0)
2025-02-25 17:08:20 -08:00
Tom Stellard
a2112e20c7 [CMake][Release] Enable bolt optimization for clang on Linux ()
Also stop buiding the bolt project on other platforms since bolt only
supports ELF.

(cherry picked from commit 148111fdcf0e807fe74274b18fcf65c4cff45d63)
2025-02-25 16:20:35 -08:00
Nikita Popov
b8b7fce446 [PPC][MC] Restore support for case-insensitive register names ()
Lowercase the name before calling MatchRegisterName(), to restore
support for using `%R3` instead of `%r3` and similar, matching the GNU
assembler.

Fixes https://github.com/llvm/llvm-project/issues/126786.

(cherry picked from commit f1252f539ca203a979d61b616186e9be9d612f96)
2025-02-25 16:13:18 -08:00
Amy Kwan
5d3b9e2f92
[PowerPC] Update LLVM 20.1.0 Release Notes ()
This PR adds LLVM 20.1.0 release notes that are related to the PowerPC
target.

---------

Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
2025-02-25 15:01:32 -08:00
Stephen Tozer
addf1c9711 Do not treat llvm.fake.use as a debug instruction ()
The llvm.fake.use intrinsic is used to prevent certain values from being
optimized out for the benefit of debug info; it is not, however, a debug
or pseudo instruction itself and necessarily must not be treated as one,
since its purpose is to act like a normal instruction. In the original
commit that added them, the IR intrinsic however was treated as one in
`getPrevNonDebugInstruction` (but _not_ in `getNextNonDebugInstruction`,
or in the MIR equivalents). This patch correctly treats it as a
non-debug instruction.

(cherry picked from commit af68927a831c45b92248b1f6fc24d445be42dd91)
2025-02-25 11:57:01 -08:00
Ikhlas Ajbar
d18f15fe53 [Hexagon] Add a case to BitTracker for new register class ()
Code in the HexagonBitTracker checks for a specific register class when
processing sub-registers. A crash occurred due to a register class that
was not handled. The register class is
DoubleRegs_with_isub_hi_in_IntRegsLow8RegClassID, which is a class
formed by creating a register pair when one of the sub registers is a
Low8 integer register.
Fixes 
Patch by: Brendon Cahoon

(cherry picked from commit 4f7d8948d9d9a0d366ac737247abab2246834e05)
2025-02-25 11:45:16 -08:00
Alexandre Ganea
c02bd85194 On Windows, remove the UCRT libraries from the release script ()
Since the 19.0 release, the UCRT dlls shouldn't be included anymore in the Windows distribution, as we link the CRT
statically into all distributed binaries.

https://discourse.llvm.org/t/llvm-x86-64-pc-windows-msvc-binaries-no-longer-need-msvc-runtime-dlls-since-19-x/84465
(cherry picked from commit 4ba3ebef642eaa4d46567a972c5ee1badb2ebadf)
2025-02-25 11:40:01 -08:00
Jonas Hahnfeld
83081919e4 [Support] Ensure complete type DelimitedScope ()
`JSONScopedPrinter` has a `std::unique_ptr<DelimitedScope>` member and
defaulted constructor argument, so it needs a complete type. This
resolves one of the many build errors with C++23 using Clang.

(cherry picked from commit e65d3882af6fcc15342451ad4f9494b1ba6b9b9d)
2025-02-25 11:38:28 -08:00
Matt Arsenault
2cb3798958 Revert "[clang][OpenCL][CodeGen][AMDGPU] Do not use private as the default AS for when generic is available ()"
This reverts commit 6e0b0038cd65ce726ce404305a06e1cf33e36cca.

This breaks the rocm-device-libs build, so it should not ship in
the release.
2025-02-25 08:41:24 -08:00
Yingwei Zheng
c99be91886 [X86][DAGCombiner] Skip x87 fp80 values in combineFMulOrFDivWithIntPow2 ()
f80 is not a valid IEEE floating-point type.
Closes https://github.com/llvm/llvm-project/issues/128528.

(cherry picked from commit 44d1dbd24c20a0ee93063dcf44d68e2b8f0bf77c)
2025-02-25 08:32:18 -08:00
Chuanqi Xu
d6fd6e4d6a [Serialization] Update DECL_LAST
Address post commit review at
https://github.com/llvm/llvm-project/pull/119333#pullrequestreview-2637471908

(cherry picked from commit 366daddfad9aa38ebb7d40055cf65f4ecb7dd6f9)
2025-02-25 08:31:12 -08:00
Younan Zhang
d919b8d97b [Clang] Handle instantiating captures in addInstantiatedCapturesToScope() ()
addInstantiatedCapturesToScope() might be called when transforming a
lambda body. In this situation, it would look into all the lambda's
parents and figure out all the instantiated captures. However, the
instantiated captures are not visible from lambda's class decl until the
lambda is rebuilt (i.e. after the lambda body transform). So this patch
corrects that by also examining the LambdaScopeInfo, serving as a
workaround for not having deferred lambda body instantiation in Clang
20, to avoid regressing some real-world use cases.

Fixes 

(cherry picked from commit ecc7e6ce4cd57a614985e95daf7027918cb8723e)
2025-02-25 08:30:16 -08:00
David Truby
350e0e2b45 [flang] fix AArch64 PCS for struct following pointer ()
Pointers are already handled as taking up a register in the ABI
handling, but the handling for structs was not taking this into account.
This patch changes the struct handling to acknowledge that pointer
arguments take up an integer register.

Fixes 

(cherry picked from commit 449f84fea652e31de418c3087d7e3628809241b4)
2025-02-25 08:27:06 -08:00
Yingwei Zheng
69ee30f9db [DAGCombiner] visitFREEZE: Early exit when N is deleted ()
`N` may get merged with existing nodes inside the loop. Early exit when
it is deleted to avoid the crash.
Alternative solution: use `DAGNodeDeletedListener` to refresh the value
of N.

Closes https://github.com/llvm/llvm-project/issues/128143.

(cherry picked from commit 646e4f2eede9a39e46012dde9430cd289682e83c)
2025-02-25 08:25:08 -08:00
Chuanqi Xu
eb389b1259 [C++20] [Modules] handling selectAny attribute for vardecl
Close https://github.com/llvm/llvm-project/issues/127963

The root cause of the problem seems to be that we didn't realize it
simply.

(cherry picked from commit 24c06a19be7bcf28b37e5eabbe65df95a2c0265a)
2025-02-25 08:15:51 -08:00
Joseph Huber
0bc2eb7458 [OpenMP] Fix misspelled symbol name ()
Summary:
This is supposed to be `__llvm_rpc_client` but I screwed it up and
didn't notice at the time. Will need to be backported.

(cherry picked from commit b35749559ddd9b2d4e044ef71d13d888b8a3d8cb)
2025-02-25 08:09:47 -08:00
Nikita Popov
160e6ace3e [mlir][cmake] Do not export MLIR_MAIN_SRC_DIR and MLIR_INCLUDE_DIR ()
MLIR_MAIN_SRC_DIR and MLIR_INCLUDE_DIR point to the source directory,
which is not installed. As such, the installed MLIRConfig.cmake also
should not reference it.

The comment indicates that these are needed for mlir_tablegen(), but I
don't see any related uses.

The motivation for this is the use in flang, where we end up inheriting
a meaningless MLIR_MAIN_SRC_DIR from a previous MLIR build, whose source
directory doesn't exist anymore, and that cannot be overridden with the
correct path, because it's not a cached variable.

Instead do what all the other projects do for LLVM_MAIN_SRC_DIR and
initialize MLIR_MAIN_SRC_DIR to CMAKE_CURRENT_SOURCE_DIR/../mlir.

For MLIR_INCLUDE_DIR there already is an exported MLIR_INCLUDE_DIRS,
which can be used instead.

(cherry picked from commit 82bd148a3f25439d7f52a32422dc1bcd2da03803)
2025-02-25 08:05:37 -08:00
Alexey Bataev
098492a228 [SLP] Check for PHI nodes (potentially cycles!) when checking dependencies
When checking for dependecies for gather nodes with users with the same
last instruction, cannot rely on the index order, if there is (even
potential!) cycle in the graph, which may cause order not work correctly
and cause compiler crash.

Fixes 

(cherry picked from commit ac217ee389d63124432e5e6890851a678f7a676b)
2025-02-24 20:57:52 -08:00
Matt Arsenault
e6d4fd035f AMDGPU: Widen f16 minimum/maximum to v2f16 on gfx950 ()
Unfortunately we only have the vector versions of v2f16 minimum3
and maximum. Widen to v2f16 so we can lower as minimum333(x, y, y).

(cherry picked from commit e729dc759d052de122c8a918fe51b05ac796bb50)
2025-02-21 14:14:20 -08:00
Joseph Huber
e0c4a3397f [Clang] Fix cross-lane scan when given divergent lanes ()
Summary:
The scan operation implemented here only works if there are contiguous
ones in the executation mask that can be used to propagate the result.
There are two solutions to this, one is to enter 'whole-wave-mode' and
forcibly turn them back on, or to do this serially. This implementation
does the latter because it's more portable, but checks to see if the
parallel fast-path is applicable.

Needs to be backported for correct behavior and because it fixes a
failing libc test.

(cherry picked from commit 6cc7ca084a5bbb7ccf606cab12065604453dde59)
2025-02-21 14:10:17 -08:00
Louis Dionne
43a04b1db6 [libc++] Reduce the dependency of the locale base API on the base system from the headers ()
Many parts of the locale base API are only required when building the
shared/static library, but not from the headers. Document those
functions and carve out a few of those that don't work when
_XOPEN_SOURCE is defined to something old.

Fixes 

(cherry picked from commit f00b32e2d0ee666d32f1ddd0c687e269fab95b44)
2025-02-21 14:08:41 -08:00
Louis Dionne
af9d7dda21 [libc++] Fix stray usage of _LIBCPP_HAS_NO_WIDE_CHARACTERS on Windows
(cherry picked from commit bcfd9f81e1bc9954d616ffbb8625099916bebd5b)
2025-02-21 14:08:41 -08:00
Sebastian Jodłowski
b84ffb9f3b [CUDA] Add support for sm101 and sm120 target architectures ()
Add support for sm101 and sm120 target architectures. It requires CUDA
12.8.

---------

Co-authored-by: Sebastian Jodlowski <sjodlowski@nuro.ai>
(cherry picked from commit 0127f169dc8e0b5b6c2a24f74cd42d9d277916f6)
2025-02-21 14:06:54 -08:00
Hans Wennborg
b727a13fec Add Wasm, RISC-V, BPF, and NVPTX targets back to Windows release packaging ()
In  we reduced the targets to those supported by Windows (X86 and
ARM) to avoid running into size limitations of the NSIS compiler.

Since then, people complained about the lack of Wasm [1], RISC-V [2],
BPF [3], and NVPTX [4]. These do seem to fit in the installer (at least
for 20.1.0-rc2), so let's add them back.

[1]
https://discourse.llvm.org/t/llvm-19-x-release-third-party-binaries/80374/26
[2]
https://discourse.llvm.org/t/llvm-19-x-release-third-party-binaries/80374/53
[3] https://github.com/llvm/llvm-project/issues/127120
[4]
https://github.com/llvm/llvm-project/pull/127794#issuecomment-2668677203

(cherry picked from commit 6e047a5ab42698165a4746ef681396fab1698327)
2025-02-21 14:03:27 -08:00
Matt Arsenault
d51f23377a
AMDGPU: Add some release 20 notes () 2025-02-21 11:23:06 -08:00
Sudharsan Veeravalli
3076a68f69 [RISCV] [MachineOutliner] Analyze all candidates ()
 made a change from analyzing all the candidates to analyzing
just the first candidate before deciding to either delete or keep all of
them.

Even though the candidates all have the same instructions, the basic
blocks in which they are present are different and we will need to check
each of them before deciding whether to keep or erase them.
Particularly, `isAvailableAcrossAndOutOfSeq` checks to see if the
register (x5 in this case) is available from the end of the MBB to the
beginning of the candidate and not checking this for each candidate led
to incorrect candidates being outlined resulting in correctness issues
in a few downstream benchmarks.

Similarly, deleting all the candidates if the first one is not viable
will result in missed outlining opportunities.

(cherry picked from commit 6757cf4e6f1c7767d605e579930a24758c0778dc)
2025-02-21 10:56:29 -08:00
Matheus Izvekov
deb63e72d6
[clang] Track function template instantiation from definition () ()
This fixes instantiation of definition for friend function templates,
when the declaration found and the one containing the definition have
different template contexts.

In these cases, the the function declaration corresponding to the
definition is not available; it may not even be instantiated at all.

So this patch adds a bit which tracks which function template
declaration was instantiated from the member template. It's used to find
which primary template serves as a context for the purpose of
obtainining the template arguments needed to instantiate the definition.

Fixes 
2025-02-21 10:49:10 -08:00
Hassnaa Hamdi
720ab3be5f [VPlan] Compute cost for binary op VPInstruction with underlying values.
As exposed by , we are missing cost computation for some
binary VPInstructions we created based on original IR instructions.
Their cost should be considered.
PR: 

Author: Florian Hahn <flo@fhahn.com>

Change-Id: Icf985b3f1cd40898a17faaf47b241e2651f9e8dd
2025-02-21 10:43:48 -08:00
Mariya Podchishchaeva
8e06e0e65f [clang] Fix preprocessor output from #embed ()
When bytes with negative signed char values appear in the data, make
sure to use raw bytes from the data string when preprocessing, not char
values.

Fixes https://github.com/llvm/llvm-project/issues/102798
2025-02-21 10:38:44 -08:00
Alexander Richardson
77195a5edb [CSKY] Default to unsigned char
This matches the ABI document found at
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf

Partially addresses https://github.com/llvm/llvm-project/issues/115957

Reviewed By: zixuan-wu

Pull Request: https://github.com/llvm/llvm-project/pull/115961

(cherry picked from commit d2047242e6d0f0deb7634ff22ab164354c520c79)
2025-02-21 10:36:15 -08:00
Tom Stellard
dc1bd6a8fa [CMake][Release] Statically link clang with stage1 runtimes ()
This change will cause clang and the other tools to statically link
against the runtimes built in stage1. This will make the built binaries
more portable by eliminating dependencies on system libraries like
libgcc and libstdc++.

(cherry picked from commit f5b311e47de044160aeb25221095898c35c4847f)
2025-02-21 09:39:33 -08:00
Matt Arsenault
1504fc57d8
AMDGPU: Stop emitting an error on illegal addrspacecasts () ()
These cannot be static compile errors, and should be treated as
poison. Invalid casts may be introduced which are dynamically dead.

For example:

```
  void foo(volatile generic int* x) {
    __builtin_assume(is_shared(x));
    *x = 4;
  }

  void bar() {
    private int y;
    foo(&y); // violation, wrong address space
  }
```

This could produce a compile time backend error or not depending on
the optimization level. Similarly, the new test demonstrates a failure
on a lowered atomicrmw which required inserting runtime address
space checks. The invalid cases are dynamically dead, we should not
error, and the AtomicExpand pass shouldn't have to consider the details
of the incoming pointer to produce valid IR.

This should go to the release branch. This fixes broken -O0 compiles
with 64-bit atomics which would have started failing in
1d03708.

(cherry picked from commit 18ea6c9)
2025-02-21 09:35:52 -08:00
Louis Dionne
d420bf8a29 [libc++] Guard include of <features.h> with __has_include ()
Some configurations define __AMDGPU__ or __NVPTX__ on platforms that
don't provide <features.h>, such as CUDA on Mac.

(cherry picked from commit 2c8b1248513624e89b510397224f0f405116f3d3)
2025-02-20 15:26:07 -08:00
Matheus Izvekov
9189ca8722 Backport: [clang] fix P3310 overload resolution flag propagation ()
Class templates might be only instantiated when they are required to be
complete, but checking the template args against the primary template is
immediate.

This result is cached so that later when the class is instantiated,
checking against the primary template is not repeated.

The 'MatchedPackOnParmToNonPackOnArg' flag is also produced upon
checking against the primary template, so it needs to be cached in the
specialziation as well.

This fixes a bug which has not been in any release, so there are no
release notes.

Fixes 
2025-02-20 15:18:47 -08:00
Zixu Wang
99947c59de Revert "[C++20][Modules][Serialization] Delay marking pending incompl… ()
…ete decl chains until the end of `finishPendingActions`. ()"

This reverts commit a9e249f64e800fbb20a3b26c0cfb68c1a1aee5e1.

Reverting this change because of issue .

(cherry picked from commit 912b154f3a3f8c3cebf5cc5731fd8b0749762da5)
2025-02-20 15:11:16 -08:00
Younan Zhang
3007684f86
release/20.x: [Clang] Remove the PackExpansion restrictions for rewrite substitution ()
This backports c08b80eb525a6e6a34d74634bf5181f11ed12984 with a release
note towards 20 so that we could resolve some pains in CTAD.
2025-02-20 15:08:46 -08:00
David Green
6dcece4147 [GlobalISel][AArch64] Fix fptoi.sat lowering. ()
The SDAG version uses fminnum/fmaxnum, in converting it to fcmp+select
it appears the order of the operands was chosen badly. This switches the
conditions used to keep the constant on the RHS.

(cherry picked from commit 70ed381b1693697dec3efcaed161d3626d16cff1)
2025-02-20 13:08:59 -08:00
A. Jiang
05cce88ab9 [libc++] Set feature-test macro __cpp_lib_atomic_float ()
The corresponding feature was implemented in LLVM 18 (by ), but
this FTM wasn't added before.

(cherry picked from commit 2207e3e32549306bf563c6987f790cabe8d4ea78)
2025-02-20 13:05:05 -08:00
Tom Stellard
6ea0367372 workflows/release-binaries: Disable Flang on x86_64 macOS ()
The flang build was taking 2-3 hours and causing the entire job to
timeout, so we need to disable it.

(cherry picked from commit 3e5ae5777d92b6f8c647c3f6969fbca0f0f769ff)
2025-02-20 13:01:43 -08:00
Mark de Wever
e7e2c16cac [libc++][TZDB] Fixes mapping of nonexisting time. ()
All non-existing local times in a contiguous range should map to the
same time point. This fixes a bug, were the times inside the range were
mapped to the wrong time.

Fixes: 
(cherry picked from commit 941f7cbf5a3e7aa9f36b002dc22cfdb4ff50fea8)
2025-02-20 12:56:22 -08:00
Kerry McLaughlin
239faf0b9d [LLVM][AArch64] Remove aliases of LSUI instructions ()
Removes MnemonicAliases added for instructions available with
the LSUI feature (e.g. CAS -> CAST) which are not equivalent.
The aliases stt[add|clr|set]a & stt[add|clr|set]al are also removed.

(cherry picked from commit d44d806faa879dfb7a7ceb58beeb57cf8d5af430)
2025-02-20 12:49:54 -08:00
Tom Stellard
2b70b17d30 flang: Fix build with latest libc++ ()
I think this first stopped working with
954836634abb446f18719b14120c386a929a42d1. 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.

(cherry picked from commit 2b340c10a611d929fee25e6222909c8915e3d6b6)
2025-02-19 14:59:21 +00:00
Louis Dionne
876a5c9e59 [libc++] Avoid including <features.h> on arbitrary platforms ()
This partially reverts commit 5f2389d4. That commit started checking
whether <features.h> was a valid include unconditionally, however codebases
are free to have such a header on their search path, which breaks compilation.
LLVM libc now provides a more standard way of getting configuration macros
like __LLVM_LIBC__.

After this patch, we only include <features.h> when we're on Linux or
when we're compiling for GPUs.

(cherry picked from commit cffc1ac3491c891ef4f80bcbfa685710e477eeac)
2025-02-19 06:26:51 -08:00
Nikolas Klauser
04295354b0 Revert "[libc++] Reduce std::conjunction overhead ()"
It turns out that the new implementation takes significantly more stack
memory for some reason.

This reverts commit 2696e4fb9567d23ce065a067e7f4909b310daf50.

(cherry picked from commit 0227396417d4625bc93affdd8957ff8d90c76299)
2025-02-18 21:56:43 -08:00
Vigneshwar Jayakumar
e503227bc5 AMDGPU: Handle gfx950 XDL Write-VGPR-VALU-WAW wait state change ()
There are additional wait states for XDL write VALU WAW hazard in gfx950
compared to gfx940.

(cherry picked from commit 1188b1ff7b956cb65d8ddda5f1e56c432f1a57c7)
2025-02-18 21:54:57 -08:00
Haojian Wu
6b57839efb [clang] Fix false positive regression for lifetime analysis warning. ()
This fixes a false positive caused by .

For `GSLPointer*` types, it's less clear whether the lifetime issue is
about the GSLPointer object itself or the owner it points to. To avoid
false positives, we take a conservative approach in our heuristic.

Fixes 

(This will be backported to release 20).

(cherry picked from commit 9c49b188b8e1434eb774ee8422124ad3e8870dce)
2025-02-18 15:20:07 -08:00
Fraser Cormack
f567c03221 [libclc] Disable external-calls testing for clspv targets ()
These targets don't include all OpenCL builtins, so there will always be
external calls in the final bytecode module.

Fixes .

(cherry picked from commit 9fec0a0942f5a11f4dcfec20aa485a8513661720)
2025-02-18 15:14:35 -08:00
Owen Pan
34f5f905f7 [clang-format] Fix a bug in annotating StartOfName ()
Also ensure we can break before ClassHeadName like StartOfName.

Fixes 

(cherry picked from commit 13de15c9c49068db850368c45ffed8f7bbf07f20)
2025-02-18 15:12:11 -08:00
Brian Cain
3dedc9985a [Hexagon] Explicitly truncate constant in UAddSubO ()
After  landed, this code would assert "Value is not an N-bit
unsigned value" in getConstant(), from a test case in zig.

Co-authored-by:  Craig Topper <craig.topper@sifive.com>
Fixes 

(cherry picked from commit 788cb725d8b92a82e41e64540dccca97c9086a58)
2025-02-18 15:10:27 -08:00