574169 Commits

Author SHA1 Message Date
Nikhil Kotikalapudi
feae3bc202
[libc++] Remove non-standard member type iterator_type from __wrap_iter (#186871)
Resolves #186801 
Removed the non-standard member type `iterator_type` from `__wrap_iter`.
This member exposed the underlying iterator type, and its removal
prevents users from relying on the implementation detail.
2026-03-25 11:04:14 +08:00
Longsheng Mou
eca7d833a6
[mlir][memref] Simplify expand_shape size/stride computation using output_shape (#187844)
This PR refactors `getExpandedSizes` and `getExpandedStrides` to compute
their results directly from the `output_shape` of `memref.expand_shape`.
Instead of reconstructing expanded sizes/strides through manual
inference, we now rely on the operation’s explicit shape information.
The previous implementation imposed the restriction that there must be
at most one dynamic size per reassociation group. This limitation is
removed by the new approach: any number of dynamic dimensions within a
group is now supported, as long as they are represented in the
`output_shape`.
As a result, the code becomes both simpler and more expressive, while
better matching the semantics of `memref.expand_shape`.
2026-03-25 10:59:56 +08:00
Weibo He
80603c6672
[CoroSplit] Never collect allocas used by catchpad into frame (#186728)
Windows EH requires exception objects allocated on stack. But there is
no reliable way to identify them. CoroSplit employs a best-effort
algorithm to determine whether allocas persist on the stack or the
frame, which may result in miscompilation when Windows exceptions are
used.
This patch proposes that we treat allocas used by catchpad as exception
objects and never place them on the frame. A verifier check is added to
enforce that operands of catchpad are either constants or allocas.

Close #143235 Close #153949 Close #182584
2026-03-25 10:37:31 +08:00
Lang Hames
cd9a0dc454
[ORC] EPCGenericJITLinkMemoryManager from SimpleNativeMemoryMap syms. (#188391)
Adds a new EPCGenericJITLinkMemoryManager convenience constructor that
constructs an instance by looking up the given symbol names in the
bootstrap JITDylib of the given ExecutionSession.

The symbol names default to the SimpleNativeMemoryMap SPS-interface
symbol names provided by the new ORC runtime.
2026-03-25 13:34:15 +11:00
wanglei
6ae5803ffd
[LoongArch] Fix incorrect reciprocal sqrt estimate semantics (#187621)
The current implementation of getSqrtEstimate() has incorrect semantics
when using `FRSQRTE`.

`FRSQRTE` computes an approximation to 1/sqrt(x), but the existing code
multiplies the estimate by the operand when Reciprocal is true. This
results in returning sqrt(x) instead of 1/sqrt(x), effectively reversing
the intended semantics of the 'Reciprocal' flag.

Additionally, the implementation does not properly account for LLVM's
Newton-Raphson refinement pipeline. When refinement steps are requested,
the initial estimate must be in reciprocal form so that the generic
DAGCombiner can apply NR iterations correctly.

This patch fixes the behavior by:

- Returning the raw FRSQRTE result when Reciprocal is true, or when
  refinement steps are required.
- Only reconstructing sqrt(x) via x * rsqrt(x) when no refinement is
  requested.
- Refactoring type checks into a helper function
(isSupportedReciprocalEstimateType)
  for improved readability and maintainability.

The updated implementation aligns with the expectations of LLVM's
reciprocal estimate framework and matches the behavior of other targets
such as X86 and AArch64.

No functional change when reciprocal estimates are disabled, but fixes
incorrect results when fast-math enables reciprocal sqrt estimates.

Fixes #186328
2026-03-25 09:58:40 +08:00
Philip Reames
d49d24ca97
[RISCV] Remove the experimental XRivosVisni extension (#188370) 2026-03-24 18:55:38 -07:00
Jim Lin
218f240472
[RISCV] Fix ssub_sat cost model to use signed VSSUB instead of VSSUBU (#188195)
Intrinsic::ssub_sat was incorrectly mapped to RISCV::VSSUBU_VV (unsigned
saturating subtract) instead of RISCV::VSSUB_VV (signed saturating
subtract), causing wrong cost estimates.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 09:54:22 +08:00
Vitaly Buka
cb12534650 [compiler-rt] Suppress unused variable report in emutls
Pull Request: https://github.com/llvm/llvm-project/pull/188329
2026-03-24 18:22:41 -07:00
khaki3
aecfaf1195
[flang][acc] Handle fir.undefined with OutlineRematerializationOpInterface in OffloadLiveInValueCanonicalization (#188325)
Example:
```fortran
!$ACC KERNELS PRESENT(CG, W1)
  CG(1:W1%WDES1%NPL, NN) = W1%CPTWFP(1:W1%WDES1%NPL)
  CPROJ(:, NN) = W1%CPROJ(1:SIZE(CPROJ,1))
!$ACC END KERNELS
```

When compiling OpenACC kernels containing array section assignments of
rank-2 arrays with a scalar index in one dimension (e.g. `CG(1:NPL,
NN)`), the Fortran lowering creates a `fir.slice` where collapsed
(scalar) dimensions use `fir.undefined index` as the stop/step values.
`SliceOp::getOutputRank()` relies on `getDefiningOp()` returning
`fir::UndefOp` to identify these collapsed dimensions and compute the
correct output rank.

When `fir.undefined` values defined outside an offload region are used
inside it, `gpu-kernel-outlining` turns them into function arguments.
Since function arguments have no defining op (`getDefiningOp()` returns
`nullptr`), `getOutputRank()` no longer recognizes the collapsed
dimensions, computing rank 2 instead of rank 1. This causes the
`fir.rebox` verifier to fail with:

```
'fir.rebox' op result type rank and rank after applying slice operand must match
```

Fix: Register `OutlineRematerializationOpInterface` for `fir::UndefOp`
(and `fir::SliceOp`) in `RegisterOpenACCExtensions.cpp`. This causes
`OffloadLiveInValueCanonicalization` to clone these operations inside
the offload region before outlining, preserving the `fir::UndefOp`
identity so that `getOutputRank()` correctly identifies collapsed
dimensions.
2026-03-24 18:03:57 -07:00
Zorojuro
408bb4d4b2
[libc] Wrong guards for totalorderbf16 and totalordermagbf16 (#188241)
Currently the guards for `totalorderbf16` and `totalordermagbf16` are as
follows:
```
#ifndef LLVM_LIBC_SRC_MATH_TOTALORDERMAGF16_H
#define LLVM_LIBC_SRC_MATH_TOTALORDERMAGF16_H
-
#endif // LLVM_LIBC_SRC_MATH_TOTALORDERMAGF16_H
```
and 
```
#ifndef LLVM_LIBC_SRC_MATH_TOTALORDERF16_H
#define LLVM_LIBC_SRC_MATH_TOTALORDERF16_H
-
#endif // LLVM_LIBC_SRC_MATH_TOTALORDERF16_H
```
As we can see these are for F16 and not BF16 .
This Pr intends to fix that with correct guards as `TOTALORDERBF16` and
`TOTALORDERMAGBF16`
2026-03-24 20:54:31 -04:00
Zorojuro
9999f7fe08
[libc] Wrong header guard comment for atanpif16 (#188310)
This PR intends to fix a small nit caused in
[1c1135b](1c1135b3fc)
```
#endif // LLVM_LIBC_SRC_MATH_ASINIF16_H
```
to 
```
#endif // LLVM_LIBC_SRC_MATH_ATANPIF16_H
```
2026-03-24 20:53:29 -04:00
Derek Schuff
b60a39e3c2
[lld][WebAssembly] Propagate +atomics for ThinLTO when using --shared-memory (#188381)
When compiling WebAssembly with ThinLTO, functions are partitioned into
isolated `.bc` modules and dispatched to individual LTO backend threads.
During code generation, the `CoalesceFeaturesAndStripAtomics` pass
iterates over the module to gather the union of target features (like
`+atomics`) attached to defined functions. In particular when not using
threads, it lowers away atomics and TLS variables to their
single-threaded equivalents.

However, if a partitioned module only contains globally defined TLS
variables (e.g. there are no functions, or all functions were fully
inlined or stripped by dropDeadSymbols before ThinLTO optimization), the
module becomes completely devoid of function definitions. The coalescing
pass then falls back to fetching features from the `TargetMachine`.
Because in LTO the `TargetMachine` defaults to a generic target without
atomics enabled, the TLS is lowered away and the `wasm-feature-atomics`
flag is omitted from the resulting ThinLTO object partition, causing
`wasm-ld` to immediately reject it.

To fix this we take advantage of the fact that the linker always knows
whether threads are being used (via the --shared-memory flag). When
using shared memory, we enable +atomics and +bulk-memory in the
TargetMachine that is used for the backend, and the feature coalescing
pass will correctly detect the use of therads.
This only makes sense for atomics because of the global linker
configuration; for other features we wouldn't be able to do this, but we
don't rewrite away any other features anyway.
2026-03-25 00:30:39 +00:00
Zeyi Xu
dd9885c0f3
[clang-tidy] Add missing #include insertion in macros for modernize-use-std-format (#188247)
Added missing ``#include`` insertion when the format function call
appears as an argument to a macro.

Part of #175183

---------

Co-authored-by: Victor Chernyakin <chernyakin.victor.j@outlook.com>
2026-03-25 07:52:45 +08:00
Dmitry Sidorov
d2dab9788a
[SPIR-V] Decompose bitcasts involving bool vectors (#187960)
OpTypeBool has no defined bitwidth in SPIR-V, so OpBitcast is invalid
for boolean vector types. Decompose `<N x i1> <-> iN` bitcasts into
element-wise extract/shift/OR and AND/icmp/insert sequences during IR
preprocessing.

Fixes:
https://github.com/kuhar/iree/blob/amdgcn-spirv/spirv-repros/bitcast_crash.ll
and https://github.com/llvm/llvm-project/issues/185815
2026-03-24 23:58:07 +01:00
vporpo
710c2f0ca5
[SandboxIR][Tracker] Test UncondBrInst CondBrInst setters (#187549)
This checks the `setCondition()` and `setSuccessor()` setters introduced
in #187196.
2026-03-24 15:49:12 -07:00
Charlie Li
2a7b0f06d2
[lldb] use the Py_REFCNT() macro instead of directly accessing member (#188161)
[PyObject members are not to be accessed
directly](https://docs.python.org/3/c-api/structures.html#c.PyObject),
but rather through macros, in this case `Py_REFCNT()`.

In most, ie Global Interpreter Lock-enabled, CPython cases,
`Py_REFCNT()` expands to accessing `ob_refcnt` anyway. However, in a
free-threaded CPython, combined with disabling the limited API (since it
requires the GIL for now), the direct member does not exist, causing the
build to fail. The macro expands to the correct access method in the
free-threaded configuration.
2026-03-24 17:49:09 -05:00
Peter Collingbourne
30084d7476
[libc++] Fix type confusion in hash_{,multi}map
The type `__gnu_cxx::hash_{,multi}map` creates objects of type
`std::pair<Key, Value>` and returns pointers to them of type
`std::pair<const Key, Value>`. If either `Key` or `Value` are
non-standard-layout, this is UB, and is furthermore considered by
pointer field protection to be a type confusion, which leads to a
program crash. Fix it by using the correct type for the pair's storage
and using const_cast to form a pointer to the key in the one place where
that is needed.

Reviewers: ldionne

Reviewed By: ldionne

Pull Request: https://github.com/llvm/llvm-project/pull/183223
2026-03-24 15:44:54 -07:00
Slava Zakharin
c3d69eda36
[mlir][mem2reg] Process direct uses inside other regions. (#188359)
We need to add the regions with the direct uses into the list
for processing, otherwise the direct uses will not be removed
and will use the slot after the promotion.

The added LIT test was triggering "after promotion, the slot pointer
should not be used anymore" assertion.
2026-03-24 15:29:44 -07:00
Zyn
303afa0899
[lldb][DWARFASTParserClang] Handle pointer-to-member-data non-type template (#187598)
## Description

### Problem
MakeAPValue in DWARFASTParserClang.cpp did not handle
pointer-to-member-data non-type template parameters (e.g., template <int
S::*P>), causing LLDB to produce incorrect results or crash.

DWARF encodes pointer-to-member-data NTTPs as
`DW_TAG_template_value_parameter` with a `DW_AT_const_value`
representing the byte offset of the member within the containing struct.
MakeAPValue is responsible for converting this value into a clang
APValue, but it only handled integer/enum and floating-point types. For
pointer-to-member types, it returned `std::nullopt`.

This caused the caller (ParseTemplateDIE) to fall back to creating a
type-only TemplateArgument (kind=Type) instead of a value-carrying one.
When two specializations differ only by which member they point to
(e.g., MemberData<&S::x> / MemberData<&S::y>), both produce identical
TemplateArguments. Clang's
[findSpecialization](3bc216c29c/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (L1674-L1677))
then treats the second as a duplicate, so only one specialization exists
in the AST. The second variable becomes unresolvable.

(See Debugger Evidence section below)

In more complex cases, this triggers an assertion failure in
[clang::CXXRecordDecl::setBases():
cast()](3bc216c29c/clang/lib/AST/DeclCXX.cpp (L219))
argument of incompatible type.

## Fix
MakeAPValue: Added `IsMemberDataPointerType()` to the integral type
check so that pointer-to-member byte offsets produce distinct APValues.
Also replaced the silent return `std::nullopt` for unsupported types
with `lldbassert` so unknown type classes are caught during development.

`ResolveMemberDataPointerToFieldDecl`: New method that follows the DWARF
chain to resolve the byte offset to the actual FieldDecl, creating
TemplateArgument(Declaration) matching clang's own AST:

DW_TAG_template_value_parameter (DW_AT_type)
  → DW_TAG_ptr_to_member_type (DW_AT_containing_type)
    → DW_TAG_structure_type → match DW_TAG_member by byte offset

If resolution fails at any step, falls through to the integer APValue
path as a safe fallback.

Verified by comparing clang's AST (clang -Xclang -ast-dump) with LLDB's
reconstructed AST (image dump ast) — both now produce TemplateArgument
decl '&S::x' referencing the correct FieldDecl.


## Test Plan
Added `lldb/test/API/lang/cpp/non-type-template-param-member-ptr/` with
a test that creates two specializations (MemberData<&S::x> and
MemberData<&S::y>) and verifies both are resolvable with correct type
names.

```
| |-ClassTemplateSpecializationDecl 0x234e2314800 <line:18:1, line:21:1> line:19:8 struct MemberData definition instantiated_from 0x234e2314110 implicit_instantiation
| | |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
| | | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
--
| | |-TemplateArgument decl '&S::x'
| | | `-Field 0x234e2313ed0 'x' 'int'
| | |-CXXRecordDecl 0x234e2314ac0 <col:1, col:8> col:8 implicit struct MemberData
--
| `-ClassTemplateSpecializationDecl 0x234e25b5968 <line:18:1, line:21:1> line:19:8 struct MemberData definition instantiated_from 0x234e2314110 implicit_instantiation
|   |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
|   | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
--
|   |-TemplateArgument decl '&S::y'
|   | `-Field 0x234e2313f38 'y' 'int'
|   |-CXXRecordDecl 0x234e25b5bd8 <col:1, col:8> col:8 implicit struct MemberData
--
| |-ClassTemplateSpecializationDecl 0x234e25b7080 <line:27:1, line:30:1> line:28:8 struct MaybeNull definition instantiated_from 0x234e25b6b50 implicit_instantiation
| | |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
| | | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
--
| `-ClassTemplateSpecializationDecl 0x234e25b80c0 <line:27:1, line:30:1> line:28:8 struct MaybeNull definition instantiated_from 0x234e25b6b50 implicit_instantiation
|   |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
|   | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
--
|   |-TemplateArgument decl '&g1'
|   | `-Var 0x234e25b69b8 'g1' 'int'
|   |-CXXRecordDecl 0x234e25b8338 <col:1, col:8> col:8 implicit struct MaybeNull
```

```
lldb a.out -o "type lookup MemberData<&S::x>" -o "type lookup MemberData<&S::y>" -o quit
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) type lookup MemberData<&S::x>
template<> struct MemberData<&S::x> {
    int get(S &);
}
(lldb) type lookup MemberData<&S::y>
template<> struct MemberData<&S::y> {
    int get(S &);
}
```



## **Debugger Evidence**
Collected at two `DW_TAG_template_value_parameter` DIEs during
ParseTemplateDIE, both with name="PtrToMember" and `type_class=256`
(eTypeClassMemberPointer): DIE `0xcb: uval64=8`; DIE `0x1e9 : uval64=24`

These correspond to two members of Fiber:
```
DW_TAG_member "listHook_"        DW_AT_data_member_location(0x08)  ← uval64=8
DW_TAG_member "globalListHook_"  DW_AT_data_member_location(0x18)  ← uval64=24
```
Clang's ground truth AST correctly produces TemplateArgument decl
(kind=Declaration) with distinct FieldDecl references for each
specialization.
```
22:| | |-ClassTemplateSpecializationDecl 0x36d785b7cc0 <line:43:1, line:56:1> line:44:8 struct mhtraits definition instantiated_from 0x36d785b4238 implicit_instantiation
23-| | | |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
24-| | | | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
25-| | | | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
26-| | | | |-MoveConstructor exists simple trivial
27-| | | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
28-| | | | |-MoveAssignment exists simple trivial needs_implicit
29-| | | | `-Destructor simple irrelevant trivial
30-| | | |-TemplateArgument type 'intrusive::Fiber'
31-| | | | `-RecordType 0x36d785b3fb0 'intrusive::Fiber' canonical
32-| | | |   `-CXXRecord 0x36d78344850 'Fiber'
33-| | | |-TemplateArgument type 'intrusive::list_member_hook<>'
34-| | | | `-RecordType 0x36d785b3c20 'intrusive::list_member_hook<>' canonical
35-| | | |   `-ClassTemplateSpecialization 0x36d78344b48 'list_member_hook'
36-| | | |-TemplateArgument decl '&intrusive::Fiber::listHook_'
37-| | | | `-Field 0x36d785b3e70 'listHook_' 'list_member_hook<>':'intrusive::list_member_hook<>'
38-| | | |-CXXRecordDecl 0x36d785b93a0 <col:1, col:8> col:8 implicit struct mhtraits
39-| | | |-TypeAliasDecl 0x36d785b9470 <line:45:3, col:22> col:9 referenced value_type 'intrusive::Fiber'
40-| | | | `-SubstTemplateTypeParmType 0x36d785b9430 'intrusive::Fiber' sugar typename depth 0 index 0 T
41-| | | |   |-ClassTemplateSpecialization 0x36d785b7cc0 'mhtraits'
42-| | | |   `-RecordType 0x36d785b3fb0 'intrusive::Fiber' canonical
--
78:| | `-ClassTemplateSpecializationDecl 0x36d785b8210 <line:43:1, line:56:1> line:44:8 struct mhtraits definition instantiated_from 0x36d785b4238 implicit_instantiation
79-| |   |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
80-| |   | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
81-| |   | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
82-| |   | |-MoveConstructor exists simple trivial
83-| |   | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
84-| |   | |-MoveAssignment exists simple trivial needs_implicit
85-| |   | `-Destructor simple irrelevant trivial
86-| |   |-TemplateArgument type 'intrusive::Fiber'
87-| |   | `-RecordType 0x36d785b3fb0 'intrusive::Fiber' canonical
88-| |   |   `-CXXRecord 0x36d78344850 'Fiber'
89-| |   |-TemplateArgument type 'intrusive::list_member_hook<>'
90-| |   | `-RecordType 0x36d785b3c20 'intrusive::list_member_hook<>' canonical
91-| |   |   `-ClassTemplateSpecialization 0x36d78344b48 'list_member_hook'
92-| |   |-TemplateArgument decl '&intrusive::Fiber::globalListHook_'
93-| |   | `-Field 0x36d785b3f60 'globalListHook_' 'list_member_hook<>':'intrusive::list_member_hook<>'
94-| |   |-CXXRecordDecl 0x36d785be080 <col:1, col:8> col:8 implicit struct mhtraits
95-| |   |-TypeAliasDecl 0x36d785be150 <line:45:3, col:22> col:9 referenced value_type 'intrusive::Fiber'
96-| |   | `-SubstTemplateTypeParmType 0x36d785be110 'intrusive::Fiber' sugar typename depth 0 index 0 T
97-| |   |   |-ClassTemplateSpecialization 0x36d785b8210 'mhtraits'
98-| |   |   `-RecordType 0x36d785b3fb0 'intrusive::Fiber' canonical
```


### **Full Paste**
```
$ llvm-dwarfdump --debug-info=0x000000cb repro.dwp -c -p
repro.dwp:	file format elf64-x86-64
.debug_info.dwo contents:
0x00000014: DW_TAG_compile_unit
              DW_AT_producer	("clang version 22.1.20 ...)
              DW_AT_language	(DW_LANG_C_plus_plus_14)
              DW_AT_name	("repro.cpp")
              DW_AT_dwo_name	("repro-repro.dwo")
0x0000001a:   DW_TAG_namespace
                DW_AT_name	("intrusive")
0x000000b9:     DW_TAG_structure_type
                  DW_AT_calling_convention	(DW_CC_pass_by_value)
                  DW_AT_name	("mhtraits<intrusive::Fiber, intrusive::list_member_hook<(intrusive::link_mode_type)2>, &intrusive::Fiber::listHook_>")
                  DW_AT_byte_size	(0x01)
                  DW_AT_decl_file	(0x00)
                  DW_AT_decl_line	(44)
0x000000cb:       DW_TAG_template_value_parameter
                    DW_AT_type	(0x0000022d "intrusive::list_member_hook<(intrusive::link_mode_type)2> intrusive::Fiber::*")
                    DW_AT_name	("PtrToMember")
                    DW_AT_const_value	(8)
```
lldb prints: 
```
p name
(const char *) 0x000055f44554c4ca "PtrToMember"
p uval64
(uint64_t) 8
p (unsigned)clang_type.GetTypeClass()
(unsigned int) 256
```
```
$ llvm-dwarfdump --debug-info=0x000001e9 repro.dwp -c -p
repro.dwp:	file format elf64-x86-64
.debug_info.dwo contents:
0x00000014: DW_TAG_compile_unit
              DW_AT_producer	("clang version 22.1.20")
              DW_AT_language	(DW_LANG_C_plus_plus_14)
              DW_AT_name	("repro.cpp")
              DW_AT_dwo_name	("repro-repro.dwo")
0x0000001a:   DW_TAG_namespace
                DW_AT_name	("intrusive")
0x000001d7:     DW_TAG_structure_type
                  DW_AT_calling_convention	(DW_CC_pass_by_value)
                  DW_AT_name	("mhtraits<intrusive::Fiber, intrusive::list_member_hook<(intrusive::link_mode_type)2>, &intrusive::Fiber::globalListHook_>")
                  DW_AT_byte_size	(0x01)
                  DW_AT_decl_file	(0x00)
                  DW_AT_decl_line	(44)
0x000001e9:       DW_TAG_template_value_parameter
                    DW_AT_type	(0x0000022d "intrusive::list_member_hook<(intrusive::link_mode_type)2> intrusive::Fiber::*")
                    DW_AT_name	("PtrToMember")
                    DW_AT_const_value	(24)
```
lldb prints: 
```
 p name
(const char *) 0x000055f44554c4ca "PtrToMember"
p uval64
(uint64_t) 24
p (unsigned)clang_type.GetTypeClass()
(unsigned int) 256
```
2026-03-24 15:26:41 -07:00
Amir Ayupov
2fafeb0509 [BOLT] Support buildid in pre-aggregated profile (#186931)
Sample addresses belonging to external DSOs (buildid doesn't match the
current file) are treated as external (0).

Buildid for the main binary is expected to be omitted.

Test Plan:
added pre-aggregated-perf-buildid.test
2026-03-24 15:15:08 -07:00
Amir Ayupov
2e247a1d54 Revert "[BOLT] Support buildid in pre-aggregated profile"
Accidentally pushed unreviewed version.

This reverts commit fce6895804e596f18765c4db0f76931dac8df9f8.
2026-03-24 15:13:14 -07:00
Dave Lee
2975451a70
[lldb] Mark lldbtest.build() parameters as keyword-only (#188327)
This reinforces what is already true in the codebase: all uses of
`build()` use keyword arguments.

With this change, it will be an error to call `build` using positional
arguments:

```
TypeError: build() takes 1 positional argument but 2 were given
```
2026-03-24 15:12:09 -07:00
Amir Ayupov
fce6895804 [BOLT] Support buildid in pre-aggregated profile
Sample addresses belonging to external DSOs (buildid doesn't match the
current file) are treated as external (0).

Buildid for the main binary is expected to be omitted.

Test Plan: added pre-aggregated-perf-buildid.test

Reviewers:
paschalis-mpeis, maksfb, yavtuk, ayermolo, yozhu, rafaelauler, yota9

Reviewed By: paschalis-mpeis

Pull Request: https://github.com/llvm/llvm-project/pull/186931
2026-03-24 15:05:33 -07:00
Amir Ayupov
31b17c4789
[BOLT] Add profile format documentation (#186685)
Create bolt/docs/profiles.md documenting all accepted profile formats:
perf.data, fdata, YAML, and pre-aggregated. Covers collection methods,
format syntax, examples, and known limitations.

Add reference from bolt/docs/index.rst.
2026-03-24 23:04:52 +01:00
Alex Duran
de0c366e4b
[llvm][SPIRV] Add pass to lower Ctors/Dtors for SPIRV (#187509)
This PR adds a new SPIRV pass that generates a kernel named
"spirv$device$init" that iterates the pointers in the table pointed by
__init_array_start and __init_array_end and executes them. It also
generates symbols for each constructor with the form
__init_array_object_NAME_PRIORITY.

These symbols will be used by the Level Zero plugin in the liboffload
runtime (with the support introduced by #187510) to generate the
aforementioned table as spirv-link cannot create the table itself.

It also does the same thing for destructors, with the kernel name being
"spirv$device$fini", the table pointers __fini_array_start and
__fini_array_end, and the generated symbols prefix __fini_array_object.

The code was mostly generated by Claude 4.5 and has been reviewed by me
to the best of my ability.
2026-03-24 21:47:09 +00:00
Mehdi Amini
6a045c29a9
Revert "[GlobalISel][LLT] Introduce FPInfo for LLT (Enable bfloat, ppc128float and others in GlobalISel) (#155107)" (#188344)
This reverts commit b1aa6a45060bb9f89efded9e694503d6b4626a4a and commit
ce44d63e0d14039f1e8f68e6b7c4672457cabd4e.

This fails the build with some older gcc:

llvm/include/llvm/CodeGenTypes/LowLevelType.h:501:35: error: call to
non-constexpr function ‘static llvm::LLT llvm::LLT::integer(unsigned
int)’
     return integer(getSizeInBits());
                                   ^
2026-03-24 21:40:36 +00:00
Sirraide
6b128091ba
[InstallAPI] [Tests] Avoid checking compiler output for 'error' (#188307)
We have two tests that use FileCheck for diagnostics and which try to
check that the output contains no compiler errors by checking for the
string 'error'. The issue with this approach is that this also causes
those tests to fail if the *path* contains the word 'error', which can
happen e.g. if the branch name contains the word 'error'.

Instead, we now check for `error:` since that string is much less likely
to appear in a path.
2026-03-24 22:23:15 +01:00
satyanarayana reddy janga
674cb9e3f1
[lldb] Fix immediately-destroyed ScopedTimeout in KillProcess (#188333)
The ScopedTimeout was created as a temporary, causing it to be destroyed
immediately and the timeout to have no effect. Give it a name so it
lives until the end of the function scope.
2026-03-24 14:22:23 -07:00
Jinsong Ji
642bde76c3
[SLP] Fix infinite loop in ordered reduction worklist processing (#188342)
The ordered reduction support introduced in 94e366ef2060 can cause an
infinite loop when processing complex reduction chains. The worklist
algorithm re-adds instructions from PossibleOrderedReductionOps when
switching to ordered mode, but doesn't track which instructions have
already been processed. This allows instructions to be re-added and
processed multiple times, creating cycles.

Add a Visited set to track processed instructions and skip any that
have already been handled, preventing the infinite loop.
2026-03-24 21:19:53 +00:00
Mircea Trofin
fe286356ca
[JT] tryToUnfoldSelectInCurrBB should update BFI & BPI if present (#188097)
Issue #187545
2026-03-24 14:12:31 -07:00
Lang Hames
e3c6244f6e
[ORC] Add EPCGenericJITLinkMemoryManager::Create named constructor. (#188191)
Create takes a JITDylib and a SymbolNames struct, looks up the
implementation symbol addresses in the given JITDylib, and uses them to
construct an EPCGenericJITLinkMemoryManager instance. This makes it
easier for ORC clients to construct the memory manager from named
symbols (e.g. in a bootstrap JITDylib) rather than raw addresses.
2026-03-25 08:02:30 +11:00
Jakub Kuderski
13b2ee25ae
[clang][AST] Fix LazyGenerationalUpdatePtr NumLowBitsAvailable on 32-bit (#188318)
The `PointerLikeTypeTraits` for `LazyGenerationalUpdatePtr` claimed
`PointerLikeTypeTraits<T>::NumLowBitsAvailable - 1` spare low bits. This
assumed that the inner `PointerUnion<T, LazyData*>` has `T_bits - 1`
spare bits, which is only true when `alignof(LazyData) >= alignof(*T)`.

On 32-bit systems, `LazyData` (containing pointers and `uint32_t`) has
`alignof = 4`, giving `LazyData*` only 2 low bits. With `T = Decl*` (3
bits due to `alignas(8)`), the inner `PointerUnion` has `min(3,2) - 1 =
1` spare bit, but the PLTT claimed `3 - 1 = 2`.

Historically, the formula was correct when introduced in 053f6c6c9e4d --
at that time `Decl` had no alignment annotation, so `T_bits ==
LazyData*_bits` on all platforms. It became outdated when 771721cb35f3
added `LLVM_ALIGNAS(8)` to `Decl`, raising `Decl*` to 3 bits on 32-bit
while `LazyData*` stayed at 2. The old `PointerIntPair`-based
`PointerUnion::doCast` happened to mask with `minLowBitsAvailable()`
(tolerant of overclaims), so this was never exposed until the
`PunnedPointer` refactoring changed `doCast` to mask with
`To::NumLowBitsAvailable`.

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

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:58:55 -04:00
zGoldthorpe
11bc6e8776
[SelectionDAG] Add known bit for ISD::FABS (#188335)
Absolute value always clears the sign bit, so make that knowh to
selectionDAG's `computeKnownBits`.
2026-03-24 14:53:06 -06:00
Jeff Bailey
4e290b3429
[libc][strings] Refactor load_aligned for cleaner endianness handling (#186360)
Replace the explicit `if constexpr` branching for big and little
endianness with compile-time calculated shift constants `VAL_SHIFT` and
`NEXT_SHIFT`. This simplifies the logic and reduces code duplication,
relying on the compiler to constant-fold the zero shifts into no-ops.
2026-03-24 20:40:22 +00:00
Jordan Rupprecht
6ef30612ee
[lldb][trace] Ensure ProcessTrace plugin can be re-registered (#188336)
Initialize makes sure that it calls RegisterPlugin only once, but
Terminate always calls UnregisterPlugin. This is a problem for tests
that call Initialize/Terminate before and after each test case: the
second case will fail because the trace plugin won't be loaded.

This fixes a test failure introduced by #187768, which adds a test case
that passes on its own but fails when run after the previous test case.
2026-03-24 20:39:04 +00:00
Deric C.
daec3b9fb6
[HLSL] Implement TableGen for builtin HLSL intrinsics (#187610)
This PR introduces a TableGen-based code generation system for HLSL
intrinsic overloads as described in proposal
[[0043]](https://github.com/llvm/wg-hlsl/blob/main/proposals/0043-hlsl-intrinsic-tablegen.md)
for replacing hand-written boilerplate with declarative .td definitions.

Actual changes to `hlsl_intrinsics.h` and `hlsl_alias_intrinsics.h` to
replace handwritten HLSL intrinsic overloads with TableGen is left to
follow-up PRs.

Assisted-by: GitHub Copilot (powered by Claude Opus 4.6)
2026-03-24 13:30:13 -07:00
Aiden Grossman
2ae3d8ae57
[CodeGen][NewPM] Mark ExpandPostRAPseudos as required (#188304)
We need to lower these pseudoinstructions regardless of optimization
level or we end up with instructions that we cannot print.
2026-03-24 13:26:39 -07:00
vporpo
7bfd54ac25
[SandboxVec][BottomUpVec] Improve handling of external uses (#185468)
Up until now the bottom-up vectorizer pass would not delete the scalar
instructions that have external uses after being vectorized, because it
lacked the ability to generate extracts from the vectors.
With the term "external uses", we refer to uses outside the currently
vectorized graph.

This patch fixes this. We can now properly handle external uses by
extracting from the vectors.

This change relies on the recent changes to the DAG's callbacks because
the external user may not be within the current DAG's interval.
2026-03-24 13:17:36 -07:00
Vitaly Buka
55bbf7b16b
Reland "[WebAssembly][FastISel] Fold i64 extension chains into widened loads" (#188324)
Reverts llvm/llvm-project#188306
Relands llvm/llvm-project#187934

It was reverted by mistake.
2026-03-24 20:12:29 +00:00
Richard Howell
cd1a598d86
[lipo] add -remove flag (#188275)
Add the -remove flag to llvm-lipo. This matches the existing Darwin lipo
tool:
```
% xcrun lipo 2>&1 | grep remove
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: one of -create, -thin <arch_type>, -extract <arch_type>, -remove <arch_type>, -replace <arch_type> <file_name>, -verify_arch <arch_type> ... , -archs, -info, or -detailed_info must be specified
    -remove <arch_type> [-remove <arch_type> ...]
```
Assisted-by: claude-code
2026-03-24 13:10:43 -07:00
Oleksandr Tarasiuk
0692bd52cb
[Clang] fix crash in duplicate attribute checking (#188274)
Fixes #188259

--- 

This PR fixes a crash in duplicate attribute checking when arguments
have different integer signedness. It changes the check to use
`isSameValue` (which uses `compareValues`) instead of `llvm::APSInt`
equality.
2026-03-24 21:56:09 +02:00
Susan Tan (ス-ザン タン)
35e958d7f0
[openacc][flang] Avoid attaching declare post-actions to acc.terminator (#188157)
Fix lowering so post declare-actions are not attached to acc.terminator
(step back from trailing fir.result/acc.terminator before attaching).

---------

Co-authored-by: Slava Zakharin <szakharin@nvidia.com>
2026-03-24 15:34:53 -04:00
Craig Topper
52296eab79
[TargetLowering] In BuildSDIV, avoid creating build_vector with illegal scalar types after type legalization. (#188280)
Code is based on a similar code in BuildUDIV.
2026-03-24 12:27:10 -07:00
Mehdi Amini
5c06541fb8
[mlir][CFGToSCF] Fix crash when region contains unconvertible multi-successor op (#183935)
`transformCFGToSCF` would crash with a use-list assertion when it
encountered an op like `spirv.BranchConditional` that implements
`BranchOpInterface` (passing the existing precondition checks) but is
not handled by `createStructuredBranchRegionOp`. The algorithm mutated
the IR significantly before discovering the op was unsupported, leaving
it in a corrupt half-transformed state that triggered the assertion on
teardown.

Fix by adding `canConvertBranchOp` to `CFGToSCFInterface` (default:
accept all ops) and calling it inside `checkTransformationPreconditions`
for every block with more than one successor, before any IR
modifications are made. `ControlFlowToSCFTransformation` overrides the
method to accept only `cf.cond_br` and `cf.switch`.

Fixes #173566

Assisted-by: Claude Code
2026-03-24 19:09:40 +00:00
Guo Chen
e71da01f0f
[AMDGPU][True16] add true16 pattern for cvt_pk_fp32_f8 (#180096) 2026-03-24 15:03:00 -04:00
Matthias Springer
7712249363
[mlir][arith] Mark arith.remsi and arith.remui as conditionally speculatable (#188263)
Division by zero is undefined behavior, so these two ops cannot be pure.
This commit marks them as conditionally speculatable, similar to
`arith.divsi` and `arith.divui`.
2026-03-24 20:01:20 +01:00
Vitaly Buka
03e8fd6aa7
Revert "[WebAssembly][FastISel] Fold i64 extension chains into widened loads" (#188306)
Reverts llvm/llvm-project#187934

Breaks bots.
2026-03-24 18:59:06 +00:00
Craig Topper
5928fc42d8
[RISCV] Use uimm3/4/5/6_plus1 for (P)SATI instructions. (#186541)
The encoded immediate is the number of trailing 1s in the maximum value.
Mailing list discussion has a preference to print and parse this value
plus one. https://lists.riscv.org/g/tech-p-ext/message/910

With this patch, saturating to a signed 8-bit integer would be "sati a0,
a0, 8". Previously it was "sati a0, a0, 7".

This is reflected in version 0.20 of the adoc spec here
https://github.com/riscv/riscv-p-spec/pull/226. I have updated our
RISCVUsage.rst to point to the adoc version of the spec.
2026-03-24 11:48:55 -07:00
Jakub Kuderski
46620f84b3
Reland "[llvm][ADT] Refactor PointerUnion to use PunnedPointer. NFC." (#188242)
This reverts commit 040b7e0a1deb and re-lands the PointerUnion
refactoring from #187950, with a fix for the 32-bit crash.

The bug was in doCast: it masked with
PointerLikeTypeTraits<To>::NumLowBitsAvailable to strip tag bits, but
the old PointerIntPair-based code masked with minLowBitsAvailable() (the
minimum across all union members). When a member type's PLTT over-claims
spare low bits, the new mask was too aggressive and cleared bits
belonging to a nested PointerUnion's tag.

Concretely, on 32-bit systems, Redeclarable::DeclLink nests
LazyGenerationalUpdatePtr (LGUP) whose PLTT claims 2 spare bits (Decl*
has alignas(8) = 3 bits, minus 1). But LGUP's inner PointerUnion<Decl*,
LazyData*> only has 1 spare bit on 32-bit (alignof(LazyData) = 4 gives
LazyData* only 2 low bits, tagShift = 1). Extracting LGUP from the outer
PointerUnion cleared bit 1 (the inner PU's type tag), corrupting the
discriminator and breaking redeclaration chains.

Added new unit tests that cover this scenario, but we will want to fix
the clang side too.

Issue: #188269

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:44:32 -04:00
Mehdi Amini
9f6d9d6a12 [MLIR] Apply clang-tidy fixes for llvm-else-after-return in TosaOps.cpp (NFC) 2026-03-24 11:40:03 -07:00