[lldb] Fix SBAPI breakage in SBFrame::GetValueForVariablePath (#218565)
SBFrame::GetValueForVariablePath added new parameters in commit
80fffd527c20ac8970fbffc37c674caa17faa815.
This caused an ABI break because
the ABI is based on the function's mangled name, which changes when
parameters are added. Existing users depend on the original symbol being
present in the library.
changing the ABI from:
```cpp
// _ZN4lldb7SBFrame23GetValueForVariablePathEPKcNS_16DynamicValueTypeE
lldb::SBFrame::GetValueForVariablePath(char const*, lldb::DynamicValueType)
```
to
```cpp
// _ZN4lldb7SBFrame23GetValueForVariablePathEPKcNS_16DynamicValueTypeENS_7DILModeE`
lldb::SBFrame::GetValueForVariablePath(char const*, lldb::DynamicValueType, lldb::DILMode)
```
[47 lines not shown]
[AArch64] Use NoSchedPred for SME instructions in C1 scheduling models.
We can have the scheduling model enabled without SME using -mtune, which means
that no scheduling information was persent for any instructions that execute in
either SME or the core. AFAICT the predicate should be NoSchedPred, as any
instructions should be using the non-streaming scheduling info when not in a
SME function.
This is a cherry-pick of f33ef3a26db25f9a4b75a25af6527304bc03fcb8,
modified to remove the Pro change not present in the llvm-23 branch.
Fixes #220070
Fixes #220067
[clang-tidy] Fix false positives in readability-trailing-comma for designated initializers (#215934)
The problem is that we delete the necessary comma whenever we use
implicit initializer lists. How we solve this is that whenever we see an
implicit initializer list, we do not match ``InitListExpr`` nodes at
all, so that we will not delete the necessary comma. Why we chose this
path is detailed in Alternatives considered.
This produces a fix that breaks valid code (#214087) and one that never
converges (#214086).
<details>
<summary><b>Alternatives considered</b></summary>
### Why not repair the source ranges instead
The synthesized nodes also carry misleading locations - their range is a
snapshot of the designator that caused them to be created, so it need
not cover their own children. The anonymous-struct node in #214087
[40 lines not shown]
[ORC] Fix malformed Mach-O `__unwind_info` tables (#217781)
The malformed tables are produced by `JITLink` after compact-unwind
record merging.
`CompactUnwindManager::mergeRecords()` coalesces adjacent function
records with identical mergeable encodings. When the final raw record is
merged away, `writeIndexes()` generates the top-level index terminator
from the final remaining record instead of the final original function.
This truncates the final index range.
On macOS arm64, libunwind resolves a PC in the merged-away final
function through the terminator entry. Its second-level-page offset is
zero by design, causing libunwind to interpret the `__unwind_info`
header as a second-level page and report:
```
libunwind: malformed __unwind_info ... bad second level page
```
[23 lines not shown]
[clang-repl] Stop interpreter init on action failure (#217147)
`clang::Interpreter` previously ignored the result of its initial
`CompilerInstance::ExecuteAction()` call and always constructed the
`IncrementalParser`. When the initial action failed, the parser could be
created from an invalid compiler state.
In practice, this failure happens if the incremental PCH included has
expired, due to system headers changing. This happens quite regularly,
after system updates, and is affecting jank users.
To fix this, the `Interpreter` now returns an error immediately when the
initial action fails or records a diagnostic error. This allows jank to
add a diagnostic consumer to detect PCH-related errors and rebuild the
PCH as needed.
----
I used Github copilot to help me diagnose and fix the issue. I have
manually reviewed the code, manually executed the test, and have
[4 lines not shown]
[OpenMP][libomp] Fix dist barrier arrival synchronization (#213845)
Make distributedBarrier::stillNeed atomic and use release/acquire
ordering for distributed barrier gather arrival flags.
The old volatile stillNeed flag did not synchronize an arriving thread's
pre-barrier writes with the thread that observed its arrival. On weakly
ordered architectures, a group leader could observe stillNeed == 0
before the arriving thread's pre-barrier writes were visible. This
allowed another thread to pass the barrier and read stale data written
before the barrier.
Use release stores when publishing stillNeed == 0. Keep the spin loops
on relaxed loads, then perform one acquire fence after all expected zero
values have been observed. This connects the arriving threads'
pre-barrier writes to the observer through the standard release/acquire
happens-before chain, without using acquire loads on every poll.
The same pattern is used when a group leader publishes its own stillNeed
[109 lines not shown]
[clang][Driver] Link libssp_nonshared.a on musl with stack protector (#219828)
While upgrading clang/llvm to 23.1.0 in openembedded-core I hit this
link failure on 32-bit x86 musl:
ld: undefined reference to `__stack_chk_fail_local'
I dug into it. musl's libc has __stack_chk_fail but not
__stack_chk_fail_local. GCC emits calls to the _local variant in
PIC/PIE code on some targets - I checked with GCC 16: 32-bit x86 does
it, x86_64 does not. So on those targets, any GCC-built object linked
with clang on musl fails once stack protection is used.
Distros already solve this on the GCC side: Alpine and OpenEmbedded
ship a tiny libssp_nonshared.a containing just that symbol, and patch
GCC to add -lssp_nonshared when stack protection is on. Both carry
the same downstream patch for clang too (OpenEmbedded since 2016),
and the GCC side is being fixed in parallel (gcc PR driver/127138,
v2 on gcc-patches:
[16 lines not shown]
[clang][Sema] Check exported default constructors in nested classes (#214275)
Teach Clang to check exported default constructors declared in nested
classes. This prepares Microsoft ABI constructor closures for
non-dependent nested classes before CodeGen.
This fixes a failure seen when compiling PyTorch on Windows. An exported
nested
class with defaults for every constructor parameter caused Clang to emit
its
constructor closure without cached default arguments and assert in
MicrosoftCXXABI.cpp.
Assisted by: GPT-5.6 Sol
(cherry picked from commit 1b782da49ae976dbb59607b95b49a1465e2cfef9)
[win/asan] GetInstructionSize: Add some more instructions. (#214707)
Below instructions can be found in wine-11.14 Debian packages.
```
8D 45 XX : lea eax, [ebp + XX]
66 0f ef c0 : pxor xmm0, xmm0
41 B9 XX XX XX XX : mov r9d, XX XX XX XX
45 84 c9 : test r9b,r9b
```
This patch also adds `80 3A XX` to tests (followup of 3ca5b7dc4f) and
fixes the sorting of test lists.
```
==484==interception_win: unhandled instruction at 0x7bcb2264: 8d 45 f8 83 ec 18 8b 5d
ntdll.dll`RtlExitUserThread:
0x7bcb2264 <+4>: 8d 45 f8 lea eax, [ebp - 0x8]
[14 lines not shown]
[SCCP] Fix missing worklist push for recursive calls that update lattice values (#219826)
For a recursive call, the call instruction itself is a user of the
function's arguments. Because I == CurI, I->comesBefore(CurI) is false,
and the condition triggers an early return. The recursive call
instruction was skipped and never pushed back onto the worklist, halting
the solver prematurely before reaching a fixpoint. This caused the
solver to incorrectly believe arguments were hardcoded constants rather
than a wider constant range, resulting in invalid branch folding.
The Fix: This patch updates the condition to explicitly check if I comes
strictly after CurI.
Fixes: https://github.com/llvm/llvm-project/issues/219503
(cherry picked from commit 88f3a791ddb3886cb6fa8d8df1c19e821b7a49b2)
[WebAssembly] Add funclet bundle to thread local wrapper calls (#213826)
When accessing a thread local variable, Clang generates a thread local
wrapper function that checks if the variable has been initialized, and
if it isn't, initializes it. This is a function call, so if this is
within a funclet (i.e., within a `catchpad` or `cleanuppad`), it needs
the funclet bundle argument, which was missing before. If it lacks a
funclet argument, it will be considered invalid and removed in
WinEHPrepare.
Fixes https://github.com/emscripten-core/emscripten/issues/27448.
(cherry picked from commit 73817e6a9279833e53fb9ccca3158ed987c4ad61)
DAGCombiner: Drop AllowFPOpFusion from isContractableFMUL
This is a step toward removing the AllowFPOpFusion field from TargetOptions.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
AMDGPU: Drop AllowFPOpFusion from FMA formation
Exclusively use the flags so AllowFPOpFusion can be removed.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
AArch64: Drop AllowFPOpFusion from the MachineCombiner FMA conditions
Only use the flags, and add missing tests for a missing flag on only
one of the participating instructions. This is a step toward removing
the AllowFPOpFusion field from TargetOptions.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[CIR] Use the modern enum case classes
The `I32EnumAttrCase` family carries an `Attr` half, and an `IntegerAttr`
predicate with it, that a CIR enum has no use for now that the enums derive
from `EnumInfo`. Upstream says of those forms that they "are not needed when
using the newer `EnumCase` form".
Rename all 198 of them to `I32EnumCase`, `I32BitEnumCaseNone`,
`I32BitEnumCaseBit` and `BitEnumCaseGroup`. The group class drops its width
prefix because the modern spelling takes the width from its cases.
NFC, mechanical.
[CIR] Derive lowering attr names from cppClassName, not the def name
CIRLoweringEmitter built its CXX_ABI_ALWAYS_LEGAL_ATTRS entries with
GetOpCppClassName, which splits the TableGen def name at the first
underscore. That works only while every def is named CIR_<CppClassName>Attr.
When one is not, the emitter writes an `isa<>` for a class that does not
exist, and the failure lands as a compile error in generated code.
Attributes carry the authoritative name in cppClassName, which
GenerateAttrToValueVisitor was already reading. Factor that out as
GetAttrCppClassRef and use it for both attribute paths. GetOpCppClassName
stays for operations.
NFC, and checkable. No CIR attribute overrides cppClassName, so the generated
CIRLowering.inc is byte-identical.
[CIR] Drop the redundant suffix from the inline kind mnemonic
inline_kind was the one CIR enum attribute mnemonic still repeating what its
C++ enum class name says. The attribute now spells
`#cir.inline<always_inline>`. The operation argument keeps the name
inline_kind, since that is the accessor name, so the printed form reads
`inline_kind = #cir.inline<always_inline>`.
The enum's summary also becomes "inline kind" rather than the camelCase
"inlineKind", which is what generated docs show now that CIR_InlineKindAttr
no longer overrides it.
25 CHECK lines change across four test files. Nine are in an
aarch64-registered-target test, unsupported in an X86-only build, but the
substitution matches the two CIR tests that do run.
[CIR] Drop dead ceremony around the CIR enum attributes
Five things that no longer earn their place in the CIR enum attribute
machinery.
CIR_CleanupKindAttr carried three. Its cppClassName restated the default
AttrDef already derives. Its skipDefaultBuilders plus hand-written
AttrBuilder existed only to default $value to CleanupKind::All, which no
caller relies on, so the generated builders stayed suppressed for nothing.
And its summary and description restated the name, overriding the enum's own
"cleanup kind" that EnumAttr would otherwise inherit. The isNormal, isEH and
isNormalAndEH helpers stay.
CIR_TLSModelAttr's summary restated its name the same way, so only that goes.
CIR_DefaultValuedEnumParameter has never had a user.
NFC.
[CIR] Move the CIR enums off the legacy EnumAttrInfo hierarchy
MLIR has two enum hierarchies. `EnumAttrInfo` doubles as an `IntegerAttr`
constraint, so every CIR enum had to clear `genSpecializedAttr` to say it did
not want one. `EnumInfo` describes a C++ enum and nothing more.
Derive the CIR bases from `I32Enum`, `I64Enum` and `I32BitEnum`, and widen
`CIR_EnumAttr` to the `EnumInfo` that upstream `EnumAttr` already takes. The
flag no longer exists to clear. `FPClassTestEnum` gets unquoted printing from
`BitEnumBase` rather than overriding `printBitEnumQuoted`, and
`CIR_KnownFuncKind` drops a `parameterPrinter` the generated `operator<<`
now covers, still spelling `#cir.func_identity<"std::find">`.
AMDGPU wraps an `I32Enum` in an `EnumAttr` with this same bracketed format.
Parsing moves to the generated `FieldParser`, whose diagnostic names the
accepted spellings, so two `expected-error` lines change. Generated attribute
code drops 16 KB as 28 inlined parsers collapse into it.
[CIR] Migrate the FPClassTest bit enum and unquote its flags
cir.is_fp_class printed its flags inconsistently. Single-bit values came out
bare, as in `fcSNan`, while group values and combinations came out quoted, as
in `"fcInf"` and `"fcSNan|fcNegInf"`. That comes from I32BitEnumAttr setting
printBitEnumQuoted, which EnumAttr.td keeps only for backwards compatibility.
Clearing the bit and using the `enum` directive selects the separator-aware
parser and printer, so every value now spells unquoted:
cir.is_fp_class %x, fcSNan|fcNegInf : (!cir.float) -> !cir.bool
The enum also drops its specialized IntegerAttr for a CIR_EnumAttr wrapper,
giving it the standalone spelling `#cir.fp_class<fcSNan|fcNegInf>`. This
changes operation syntax, so it updates 37 CHECK lines.
[CIR] Migrate AssumeBundleKind, AtomicFetchKind and AsmFlavor off IntegerAttr
AssumeBundleKind, AtomicFetchKind and AsmFlavor generated IntegerAttr
subclasses with no dialect spelling of their own. Each now sets
genSpecializedAttr = 0 and gains a CIR_EnumAttr wrapper.
Unlike the other CIR operation enums, these three are reached through
hand-written parsers and printers, so they needed checking individually.
cir.atomic.fetch references $binop declaratively and gains an `enum()`
wrapper. The other two need no change, since printAssumeBundle is already
typed on cir::AssumeBundleKindAttr and InlineAsmOp::print streams the enum
rather than the attribute.
Operation syntax is unchanged.
[CIR] Migrate GlobalLinkageKind, CallingConv and SideEffect off IntegerAttr
GlobalLinkageKind, CallingConv and SideEffect generated IntegerAttr
subclasses with no dialect spelling of their own. Each now sets
genSpecializedAttr = 0 and gains a CIR_EnumAttr wrapper, and cir.global wraps
$linkage in `enum()`. GlobalLinkageKind spells `#cir.linkage<internal>`,
dropping both the `global_` prefix and the `_kind` suffix.
cir.func and cir.call print all three by hand, but they stream
stringifyGlobalLinkageKind(getLinkage()) and friends, which take the enum
rather than the attribute, so those sites are unchanged.
Operation syntax is unchanged.
[CIR] Migrate MemOrder and SyncScopeKind off IntegerAttr
MemOrder and SyncScopeKind, the enums the atomic operations share, generated
IntegerAttr subclasses with no dialect spelling of their own.
Both now set genSpecializedAttr = 0 and gain CIR_EnumAttr wrappers, spelling
`#cir.mem_order<seq_cst>` and `#cir.sync_scope<system>`, and the atomic
operations wrap their arguments in `enum()` to keep the bare keyword.
`enum()` works as an optional-group anchor, so the `syncscope` and `atomic`
groups on cir.load and cir.store are unaffected. Operation syntax is
unchanged.
AArch64: Drop AllowFPOpFusion from isProfitableToHoist
Exclusively rely on the instruction contract flags to enable
the eventual removal of AllowFPOpFusion. This was also untested.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[orc-rt] Fix -Wctad-maybe-unsupported warning in unit test. (#221399)
Avoid the warning by naming the mutex type on scoped_lock.
'std::scoped_lock' may not intend to support class template argument
deduction