Commit Graph

573091 Commits

Author SHA1 Message Date
paperchalice
55b271ddc1 [Support] Add option to use Windows vendored ICU (#186371)
Windows 10 provided [ICU C
API](https://learn.microsoft.com/en-us/windows/win32/intl/international-components-for-unicode--icu-)
since 1703, this PR adds support for it.
2026-03-17 08:00:30 +08:00
Wenju He
1c04e7fada [libclc] fix compiler check with --target=spirv64 and -disable-llvm-passes (#185376)
Fix "unknown target triple" errors when LLVM_TARGETS_TO_BUILD is empty.

Adding -disable-llvm-passes reduces this to a very basic sanity check
of Clang frontend. This allows the test to pass even if SPIR-V backend
is not enabled, as the frontend can still generate IR for the target.
2026-03-17 07:59:14 +08:00
Adrian Prantl
6527a3a23e [LLDB] Replace file+filecheck with test in test (NFC) (#186875)
The "file" utility may not be installed:
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-ubuntu-aarch64/job/main/109/consoleText
2026-03-16 16:53:53 -07:00
Craig Topper
ded656b467 [TargetLowering][X86] Directly emit FSHR from expandDIVREMByConstant when Legal. (#186863) 2026-03-16 16:48:34 -07:00
Maksim Levental
e3d7bf290d [MLIR][LLVM] add metadata attrs and llvm.named_metadata op (#186703)
This PR adds some LLVM metadata attributes and an `llvm.named_metadata`
container op (similar to `llvm.module_flags`) for those attributes.

Summary:

- Add MLIR attributes modeling LLVM IR metadata: `#llvm.md_string`,
`#llvm.md_const`, `#llvm.md_func`, and `#llvm.md_node`;
- Add `llvm.named_metadata` container op for module-level named metadata
nodes;
  - Add MLIR-to-LLVM-IR translation for the new attributes and op;
- Add C API functions (`mlirLLVMMDStringAttrGet`,
`mlirLLVMMDNodeAttrGet`, etc.);
- Add Python bindings (`llvm.MDStringAttr`, `llvm.MDConstantAttr`,
`llvm.MDFuncAttr`, `llvm.MDNodeAttr`, `llvm.FunctionType`).
2026-03-16 16:33:53 -07:00
Pedro Lobo
57568c288d [Reland][IR] Add initial support for the byte type (#186888)
This patch relands https://github.com/llvm/llvm-project/pull/178666. The
original version caused CI failures due to the missing target triple in
`llvm/test/CodeGen/X86/byte-constants.ll`. CI should be green now.
2026-03-16 23:32:24 +00:00
James Y Knight
1c4e03cf78 [bazel] Update lldb/BUILD.bazel for c5e5d5b (#186911) 2026-03-16 19:29:00 -04:00
Ayush Kumar Gaur
e2def10675 Avoid assert in substqualifier (#182707)
What’s the problem:
Clang diagnoses the invalid static data member in a local class, but the
later out-of-line definition can still be instantiated and hit an
assertion.

What this PR does:
Mark the enclosing local class invalid when diagnosing the ill-formed
static
data member, so the invalid definition no longer survives to the
assertion path.

Fixes #176152
2026-03-16 16:22:12 -07:00
Balázs Benics
c1c4a5a870 [clang][ssaf] Workaround gcc-7 NRVO bug (#186897)
Addresses:
https://github.com/llvm/llvm-project/pull/186156#issuecomment-4070258854
2026-03-16 23:20:29 +00:00
Austin Kerbow
7f77ca0dbd [AMDGPU] Include TRANS instructions in WMMA coexecution hazard checking (#186269) 2026-03-16 16:10:58 -07:00
Chi-Chun, Chen
4c63b28bb9 [Clang][OpenMP] Move declare simd codegen into OMPIRBuilder (#186030)
Refactor declare simd codegen by moving logic that does not depend on
Clang declarations into OpenMPIRBuilder.
2026-03-16 18:08:43 -05:00
James Y Knight
53cae83824 [bazel] Add libraries, binaries, and tests for ScalableStaticAnalysisFramework. (#186905) 2026-03-16 19:00:38 -04:00
Julian Oppermann
c7c7afd5fe [MLIR][Linalg] Add matchers to specialize more unary ops (#183259)
Add missing matchers to the `linalg.generic` specialization patterns to
handle the remaining named unary elementwise ops.
2026-03-17 12:00:09 +13:00
Craig Topper
59e01a1e2c [TableGen] Add new line to end of TreePatternNode::dump. (#186865) 2026-03-16 15:59:32 -07:00
Matt Arsenault
253a33ae30 AMDGPU: Annotate grid_dims ABI load with range metadata (#185610)
Also substitute with a constant for the reqd_work_group_size case.
2026-03-16 23:31:32 +01:00
Abhijeet
d2f89e20fb [clang] Fixed 'implicitly deleted' diagnostic for explicitly deleted candidate function (#186634)
When an explicit function template specialization is deleted, the
overload candidate `Fn` may be a non-canonical `FunctionDecl` where
`IsDeleted` is not set, even though the canonical decl has it set.
`isDeletedAsWritten()` reads `this` while `isDeleted()` reads
`getCanonicalDecl()`, causing the mismatch. Fix by using
`getCanonicalDecl()` consistently in the diagnostic.
Fixes #185693
2026-03-16 23:31:30 +01:00
Florian Mayer
6a785bf069 Revert "[AArch64] Allocate two emergency spill slots for MTE to fix register …" (#186900)
Reverts llvm/llvm-project#186505

Breaks buildbot
2026-03-16 15:25:14 -07:00
Krystian Stasiowski
e363764395 [Clang][Sema] Fix crash in CheckNonTypeTemplateParameterType with invalid type (#186200)
When a non-type template parameter has a type containing an undeduced
placeholder type that is invalid (e.g., a function returning a
function), `SubstAutoTypeSourceInfoDependent` can return null if the
type is invalid. `CheckNonTypeTemplateParameterType` was not handling
this case and would dereference the null pointer.

Fixes #177545
2026-03-16 18:18:13 -04:00
Matthew Maurer
9e4dddcc12 [SimplifyCFG] Allow phi folding for boolean logic over non-equality (#185124)
Phi folding is suppressed over binary operation inputs in order to avoid
interfering with switch formation.

After #183692, code (for example, Rust's ASCII character classification)
may get an `or` hoisted up into it, which suppresses
`foldTwoEntryPHINode`. This then produces branching code where
previously we generated straightline code.

To maintain switch formation while preventing any binops from breaking
phi folding, restrict the scenario in which Phi folding is suppressed to
binops of *equality* ops. This should mesh with switch statements, which
require an explicit list of values, while not breaking optimization over
> / < etc. which would never have been promoted to switches in the first
place.

Fixes: rust-lang/rust#153504
2026-03-16 15:02:00 -07:00
Zhen Wang
51937fc996 Revert "[flang][OpenMP] Use cuf.alloc for privatization of CUDA Fortr… (#186891)
…an device arrays (#185984)"

This reverts commit fb18d570b0.

This PR caused compilation failures with allocatable arrays, reverting
now for more investigation.
2026-03-16 21:51:07 +00:00
nextsilicon-itay-bookstein
538fcbc7e0 [clang][CMake] Fix ODR violation with LLVM_LINK_LLVM_DYLIB (#186689)
After 42b638c6b40d ("Propagate dependencies to OBJECT libraries in
add_llvm_library"), obj.clangSupport now inherits clangSupport's
LINK_LIBRARIES via target_link_libraries, which includes libLLVM.so when
LLVM_LINK_LLVM_DYLIB is enabled.

Previously the obj.clangSupport alias path was harmless because the
OBJECT library carried no link dependencies. Now, aliasing
clangSupport_tablegen to obj.clangSupport in DYLIB mode causes
clang-tblgen to transitively link libLLVM.so, while also having LLVM
symbols compiled in statically — triggering an ASan ODR violation on
globals like llvm::vfs::FileSystem::ID.

Fix by only propagating parts of the compile interface instead of the
full link interface - INTERFACE_INCLUDE_DIRECTORIES and
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES. Also add a TODO to consider
replacing with target_link_libraries($<COMPILE_ONLY:tgt>) once minimum
CMake version is 3.27 or higher.
2026-03-16 23:39:11 +02:00
Jonas Devlieghere
9da068b7cf [lldb] Default LLDB_ENABLE_MTE to OFF when Sanitizers are enabled. (#186884)
The MTE launcher complicates injecting the sanitizer runtime libraries.
2026-03-16 14:22:55 -07:00
Florian Hahn
013f2542a2 [LV] Simplify and unify resume value handling for epilogue vec. (#185969)
This patch tries to drastically simplify resume value handling for the
scalar loop when vectorizing the epilogue.

It uses a simpler, uniform approach for updating all resume values in
the scalar loop:

1. Create ResumeForEpilogue recipes for all scalar resume phis in the
main loop (the epilogue plan will have exactly the same scalar resume
phis, in exactly the same order)
2. Update ::execute for ResumeForEpilogue to set the underlying value
when executing. This is not super clean, but allows easy lookup of the
generated IR value when we update the resume phis in the epilogue. Once
we connect the 2 plans together explicitly, this can be removed.
3. Use the list of ResumeForEpilogue VPInstructions from the main loop
to update the resume/bypass values from the epilogue.

This simplifies the code quite a bit, makes it more robust (should fix
https://github.com/llvm/llvm-project/issues/179407) and also fixes a
mis-compile in the existing tests (see change in
llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-sub-epilogue-vec.ll,
where previously we would incorrectly resume using the start value when
the epilogue iteration check failed)

In some cases, we get simpler code, due to additional CSE, in some cases
the induction end value computations get moved from the epilogue
iteration check to the vector preheader. We could try to sink the
instructions as cleanup, but it is probably not worth the trouble.

Fixes https://github.com/llvm/llvm-project/issues/179407.
2026-03-16 21:21:59 +00:00
Andrzej Warzyński
0fa9a7797b [Clang][AArch64] Update comments in tests (nfc) (#186885) 2026-03-16 21:21:34 +00:00
Yunbo Ni
ddaaf4fa7a [Inliner] Fix return attribute propagation across multiple return sites (#186076)
Fixes #185159 

This patch fixes a bug in `AddReturnAttributes()` where propagated
return attributes could incorrectly leak across multiple return sites in
the callee being inlined.

`AddReturnAttributes()` walks the callee's return instructions and tries
to backward-propagate return attributes from the callsite to the
returned call when the callee directly returns a call result. However,
the propagated attribute builders were updated in-place while iterating
over return sites. As a result, attributes refined for one return site
could be reused when
processing a later return site. This is incorrect because each return
site should be handled independently, starting from the original
callsite attributes.

This patch ensures that propagated return attributes are reinitialized
for each return site, so propagation is computed independently per
returned call.
2026-03-16 22:14:11 +01:00
Usama Hameed
ed76cbccbb [AArch64] Allocate two emergency spill slots for MTE to fix register … (#186505)
…scavenger crash

When `-sanitize=memtag-stack` is enabled and the compiler optimizes
contiguous ST2Gi instructions into an MTE loop (via
`TagStoreEdit::emitLoop`), it spawns two new post-RA virtual registers
simultaneously:
1. `BaseReg`
2. `SizeReg`

Under extremely high register pressure (such as in Swift async
continuation thunks, where almost all registers are kept live), the
Register Scavenger must fall back to using emergency spill slots to
assign physical registers to `BaseReg` and `SizeReg`.

Prior to this patch, `determineCalleeSaves` assumed that a maximum of
one register would ever need to be scavenged at a time. It either
allocated a single emergency spill slot, or bypassed the allocation
entirely if it found an unused Callee-Saved Register (`ExtraCSSpill`) to
use as a scratch register.

When the MTE loop asks for two registers simultaneously, the scavenger
crashes with:
`LLVM ERROR: Error while trying to spill LR from class GPR64: Cannot
scavenge register without an emergency spill slot!`

This patch fixes the crash by explicitly searching for mergeable STG
instructions during `determineCalleeSaves`. If found, it allocates a
second emergency spill slot. This guarantees the scavenger has enough
slots to successfully resolve both post-RA virtual registers, regardless
of whether the first scratch space came from an `ExtraCSSpill` or the
baseline emergency spill slot.

Added `memtag-emergency-spill-slot.mir` to test both the `ExtraCSSpill`
bypass path and the baseline zero-free-register path.

Assisted-by: claude

rdar://172501087
2026-03-16 14:00:56 -07:00
joaosaffran
a12b612c0d [HLSL] Use 0 to represent unbounded resources (#186022)
SPIRV backend uses 0 to represent unbounded arrays. This patch makes
unbounded resources be represented with 0 when binding them, as well as
makes sure the backend uses OpTypeRuntimeArray to represent such cases.
Fix: https://github.com/llvm/llvm-project/issues/183367
2026-03-16 13:36:53 -07:00
Ben Shi
297d52ba7d [AVR] Improve expansion of pseudo instruction SPREAD (#186780)
It would be better to set the higher register to zero for devices
without `SPH`.
2026-03-16 21:24:20 +01:00
Tom Honermann
81841b722b [Clang][Docs] Discontinue documenting the GCC -I- and --include-barrier options. (#184941)
Clang has never implemented the GCC `-I-` and `--include-barrier`
options. An error is issued if they are used. GCC deprecated these
options in GCC 4. Advertising their availability in documentation and
help text is misleading.
2026-03-16 16:12:23 -04:00
Meredith Julian
d30e680229 [LLVM] [SeparateConstOffsetFromGEP] patch PR 183402 to handle negative C correctly (#186858)
Small typo in negative C threshold calculation would result in a
threshold that is too conservative due to overflow.
2026-03-16 13:10:41 -07:00
Lei Huang
c953411dee [PowerPC][NFC] Refactor Register class and operand definitons (#185647)
Created a comprehensive base class system in PPCRegisterClasses.td to
eliminate repetitive RegisterOperand definitions across PowerPC register
files and introduced PPCRegOperand multiclass in to automatically
generate AsmOperandClass and RegisterOperand definitions, eliminating
~50 lines of boilerplate.

Asissted by AI.
2026-03-16 16:08:25 -04:00
owenca
ff4cccb678 [clang-format] Fix a bug in indenting lambda comments with only tabs (#186862)
Fixes #175151
2026-03-16 13:07:40 -07:00
Victor Campos
6655312776 [libc] Build fuzzing tests in pre-merge CI tests (#185018)
At the moment, no CI job tests whether the fuzzing tests build
correctly.

This patch adds the build of fuzzing tests to the pre-merge CI job.

Only two configurations have it enabled for now. The none-eabi
configurations seemingly do not support it because in their cmake
configs compiler-rt is not enabled, hence libFuzzer isn't built. I did
not dig too much to understand why that is, preferring to just leave it
disabled for these configurations. For the remaining ones that seem to
support it, I selected one x86 and one aarch64.

In addition, it removes one outdated comment about the build type used
and changes the action to run on all branches, not only on PRs that
target main.

If we limit it to run only on PRs to the main branch, it will not run on
stacked PRs. I believe it is also okay to run it on PRs to release
branches. Therefore it is just easier to remove the limit altogether.
2026-03-16 16:02:57 -04:00
Dmitry Sidorov
8fa7660ab8 [SPIR-V] Fix scalarization of 1-element vector (#185529)
Previous patch #180735 didn't handle 1-element vectors nested in
aggregates.
2026-03-16 21:01:57 +01:00
owenca
52cd10949d [clang-format] Identify include guard #endif followed by comments (#186848)
Fixes #176321
2026-03-16 12:30:34 -07:00
owenca
9d1d7a5645 [clang-format] Correctly annotate binary stars in braced init lists (#186732)
Fixes #175241
2026-03-16 12:29:06 -07:00
Alexander Kornienko
7e51783b0b Revert "[Format] Configure ASSIGN_OR_RETURN macros for Google style" (#186445)
Reverts llvm/llvm-project#169037

The change breaks formatting of real code containing ASSIGN_OR_RETURN
macros nested into lambdas. See
https://github.com/llvm/llvm-project/pull/169037#issuecomment-4056423543
for the test case.
2026-03-16 20:16:28 +01:00
owenca
c9d321b3d1 [llvm][Support] Fix an off-by-1 bug in YAML parser (#186731)
Closes #171620
2026-03-16 12:01:17 -07:00
Alexey Bataev
d117f98ff6 [SLP]Fix legality checks for bswap-based transformations
Fix the checks for the non-power-of-2 base bswaps by checking the
power-of-2 of the source type, not the target scalar type. Plus, add
cost estimation for zext, if the source type does not match the scalar type and fixes final bitcasting for the reduced values.

Fixes https://github.com/llvm/llvm-project/pull/184018#issuecomment-4053477562
2026-03-16 11:56:24 -07:00
Krzysztof Parzyszek
fc5a2b92f8 [flang][OpenMP] Identify affected loops, provide reason (#185299)
Implement utility functions to calculate the number of affected loops in
a sequence or in a nest. Provide a reason for the returned value to be
used in an explanatory message.

Issue: https://github.com/llvm/llvm-project/issues/185287
2026-03-16 13:51:50 -05:00
Muyao Xiao
34948b549e [OpenMP][NFC] Fix stale DeviceRTL header path in OpenMPIRBuilder (#185563)
The `\see` comment in `OpenMPIRBuilder.h` references
`openmp/libomptarget/deviceRTLs/common/include/target.h`. This file no
longer exists.

This patch updates the comment to point to the current correct header:
`openmp/device/include/Interface.h`.
2026-03-16 18:50:15 +00:00
Farzon Lotfi
cf5c808198 [SPIRV][Matrix] Add support for Array Vector memory layout (#186215)
- fixes #179879
- Change is three fold:
1. Look for the Matrix Memory layout.
2. refactor out the common pieces of loadVectorFromArray into a helper
that can be shared with the matrix case.
3. The matrix case needs special indexing so we can do vector geps
instead of scalar geps that would require a 2d loop.
2026-03-16 14:49:58 -04:00
cherrymui
1098b95dac [sanitizer_common] Define SANITIZER_WEAK_IMPORT for Go race detector (#186525)
Currently, when building the Go race detector (when SANITIZER_GO
is set), SANITIZER_WEAK_IMPORT is no-op. It is perfectly fine to
define SANITIZER_WEAK_IMPORT for Go just like other cases. That
will tell the Go linker to treat _dyld_get_dyld_header as a weak
import.

Perhaps SANITIZER_WEAK_ATTRIBUTE can also be defined for Go. That
would be a separate patch.
2026-03-16 18:49:56 +00:00
Razvan Lupusoru
b8cdc1a784 [flang][acc] Handle deduplicated use_device in ACCUseDeviceCanonicalizer (#186855)
The ACCUseDeviceCanonicalizer was attempting to remove `acc.use_device`
operation even when it was used in multiple constructs. This updates the
pass to remove it only when no longer used, which for the attached
example is after the handling of the second `acc.host_data` construct.
2026-03-16 18:45:20 +00:00
Nico Weber
dc75adb30b [gn] port c5e5d5b282 2026-03-16 14:43:37 -04:00
Muhammad Bassiouni
b955eb72bd [libc] Add myself as maintainer for Math, Threading and Runtime Safety (#186595) 2026-03-16 20:39:48 +02:00
Balázs Benics
d44fdaa58c [analyzer][NFC] Reorg and add clang::suppress tests (#186447)
This reorganizes the current clang suppression tests; and adds quite a
few more cases to the corpus.
This prepares the ground for #183727

While the test cases were generated by AI, I've personally checked every
single line and expectation.

Assisted-by: claude
2026-03-16 18:25:33 +00:00
Timm Baeder
3968db46a5 [clang][bytecode][NFC] Add Function::dump() taking no arguments (#186819)
Instead of relying on the default value. That one doesn't work properly
in lldb and I have to pass the `{}` explicitly every time.
2026-03-16 19:13:34 +01:00
Jonas Devlieghere
c5e5d5b282 [lldb] When LLDB_ENABLE_MTE is ON always run the driver with MTE (#186322)
When LLDB_ENABLE_MTE is set to ON, we should always run the driver with
MTE by signing with the checked-allocations entitlement.
2026-03-16 18:11:58 +00:00
Yunbo Ni
769ffa0133 [ForceFunctionAttrs] Fix handling of conflicts for more attributes (#186304)
Fixes #185277 

ForceFunctionAttrs currently only checks the `alwaysinline`/`noinline`
conflict when forcing function attributes. This is incomplete, because
LLVM verifier rules define additional incompatible function attribute
combinations.

Extend hasConflictingFnAttr() to reject more conflicting function
attributes, including combinations involving `optnone`, `minsize`,
`optsize`, and `optdebug`.

Also add required companion attributes when forcing function attributes:
`optnone` requires `noinline`, so forceattrs now adds `noinline`
automatically when needed.
2026-03-17 02:10:16 +08:00