[Clang][C2y] Make the 'if' declaration extension warning on by default
Declarations in the condition of 'if' and 'switch' statements (N3356)
were previously only diagnosed in pre-C2y modes under -pedantic, since
the C compatibility warnings default to Extension. Promote the
diagnostic to an ExtWarn so users on older language modes are told
they are relying on a C2y extension; -Wno-c2y-extensions silences it.
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[Clang][C2y] Simplify condition-declaration diagnostics in C
Key the diagnostics on whether a declaration is permitted as the
condition (only as the sole clause of an 'if' or 'switch'), so the two
"expected expression" emissions collapse into one and the first-clause
check is no longer nested inside the branching. No functional change.
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
[MIR] Use block references in callSites and calledGlobals (#229320)
The bb field of callSites and calledGlobals is the number of the block,
as the MIR printer writes it, but the parser used it as the position of
the block in the function. The two differ once a pass adds, removes or
moves blocks without renumbering them, for example after block placement
or when a custom inserter splits a block in finalize-isel. Such MIR then
fails to parse, or an entry is silently attached to the call in another
block.
Make the field a block reference, printed and parsed like the blocks of
jump tables and savePoint, and update the tests that use it.
[AArch64] Preserve exceptions from discarded strict SVE FP operations (#230112)
Mark strict AArch64 target SDNodes as IsStrictFP and advertise FP
exception capability on the SVE FP-unary undef pseudos. Both metadata
properties are needed to preserve observable exception effects when the
numeric result is unused.
Add a regression covering discarded strict f16/f32/f64 round calls with
SVE and streaming SME, selected MIR without nofpexcept, and removable
ignore-mode f32/f64 controls.
Signed-off-by: Sriram Shastry <sriramshastry at gmail.com>
[lldb][OpenBSD] Fix sysctl usage for process info (#122534)
The OpenBSD Host code used FreeBSD-style sysctl MIBs, which don't
match OpenBSD's interface, so process lookups failed.
- GetOpenBSDProcessArgs: use {CTL_KERN, KERN_PROC_ARGS, pid,
KERN_PROC_ARGV}. OpenBSD returns a NULL-terminated argv array
whose pointers point into the returned buffer, so iterate it
directly.
- GetOpenBSDProcessUserAndGroup, FindProcessesImpl: KERN_PROC
takes a 6-element MIB on OpenBSD, with the kinfo_proc element
size and element count as the last two entries.
[sancov][NFC] Store raw coverage addresses in a DenseSet
Union inserts the same addresses over and over. A std::set walks a tree for every one of them. A hash set checks whether the address is already present in one step. Sort once on output so the bytes stay ordered. On 5,000 llc dumps, union went from 39s to 5s.
Assisted-by: Cursor (Grok 4.7)
[sancov][NFC] Append a coverage file into an existing address set
Union was reading each .sancov file into its own address set and then
inserting that set into the union. Read the file straight into the
caller's set instead. append returns the file header so a bitness
mismatch still warns, and read is implemented on top of it.
Assisted-by: Cursor (Grok 4.7)
[mlir] Detect hasLoop cycles with a single DFS
Calling isRegionReachable for every region the traversal popped made
hasLoop quadratic in the number of region successor edges. Use one
iterative depth-first search from the entry regions instead, in a new
canReachCycle helper. Reaching a region that is still on the DFS path
is a loop, reaching a finished one is not. Each region is queried at
most once, the search stops at the first loop, and the stack holds
one pointer-sized item per entry so small ops need no heap
allocation.
Both traversals now get a region's successors from
RegionBranchOpInterface::getSuccessorRegions(Region &) instead of
asking each terminator with null operand attributes. The in-tree
terminators that override getSuccessorRegions (scf.condition and
cir.condition) return the same regions as their parent op when no
operand is constant.
Restore the dropped debug output. Rename the multi-branch test and
[6 lines not shown]
[lldb] Don't take the module mutex to build a section list (#233524)
`ObjectFilePECOFF::CreateSections` takes the module mutex while
`Module::GetSectionList` holds `m_sections_mutex` (#205226), but
`Module::GetSymbolFile` holds the module mutex and asks for the section
list, so two targets loading the same DLL can deadlock.
`ObjectFile::GetSectionList` has the same inversion for every object
file format: it holds the object file's section mutex and waits for the
module mutex.
This patch makes both build through the object file's section mutex and
then `m_sections_mutex`, and drops the module mutex from
`CreateSections` in PECOFF and COFF.
The new unit tests hang without this patch. Part of #233425.
[LoopPeel] Only peel last iter if requested by shouldPeelLastIter. (#234130)
countToEliminateCompares also bumped DesiredPeelCountLast whenever it
increased the number of iterations to peel from the front. This value is
only used when peeling the front is rejected because the loop has
already been peeled, in which case we tried to peel more than a single
iteration from the end, or peel the end of a loop that does not support
it, triggering an assertion in peelLoop.
Only set DesiredPeelCountLast when shouldPeelLastIteration determined
that peeling the last iteration is possible and profitable.
Fixes https://github.com/llvm/llvm-project/issues/231037
[ARM] Add -verify-machineinstrs in test (#234127)
One of the testcase added in PR #225747
crashes with -verify-machineinstrs.
Removed the specific test to unblock the CI.
[CodeGen] Update the dominator tree in LiveIntervalTest's testSplitAt (#234113)
TestPassT claims to preserve all analyses, including the
MachineDominatorTree that LiveIntervals requires transitively, but
testSplitAt changed the CFG without updating it.
Found by the extra verification in #98314.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[mlir] Detect hasLoop cycles with a single DFS
Calling isRegionReachable for every region the traversal popped made
hasLoop quadratic in the number of region successor edges. Use one
iterative depth-first search from the entry regions instead, in a new
canReachCycle helper. Reaching a region that is still on the DFS path
is a loop, reaching a finished one is not. Each region is queried at
most once, the search stops at the first loop, and the stack holds
one pointer-sized item per entry so small ops need no heap
allocation.
Both traversals now get a region's successors from
RegionBranchOpInterface::getSuccessorRegions(Region &) instead of
asking each terminator with null operand attributes. The in-tree
terminators that override getSuccessorRegions (scf.condition and
cir.condition) return the same regions as their parent op when no
operand is constant.
Restore the dropped debug output. Rename the multi-branch test and
[6 lines not shown]
[mlir] Detect hasLoop cycles with a single DFS
Calling isRegionReachable for every region the traversal popped made
hasLoop quadratic in the number of region successor edges. Use one
iterative depth-first search from the entry regions instead, in a new
canReachCycle helper. Reaching a region that is still on the DFS path
is a loop, reaching a finished one is not. Each region is queried at
most once, the search stops at the first loop, and the stack holds
one pointer-sized item per entry so small ops need no heap
allocation.
Both traversals now get a region's successors from
RegionBranchOpInterface::getSuccessorRegions(Region &) instead of
asking each terminator with null operand attributes. The in-tree
terminators that override getSuccessorRegions (scf.condition and
cir.condition) return the same regions as their parent op when no
operand is constant.
Restore the dropped debug output. Rename the multi-branch test and
[6 lines not shown]
[mlir][SymbolTable] Handle unknown symbol users in SymbolUserMap (#227918)
This PR fixes #226052 treating unknown users record the symbol table
having this specific users instead use the assertion.
Please see my comment here explaining where the bug was introduced!
[here](https://github.com/llvm/llvm-project/issues/226052#issuecomment-5922633002).
[PowerPC] Use an unversioned FreeBSD triple in pr47373.ll (#233652)
pr47373.ll was added in 27714075848e with powerpc64-unknown-freebsd13.0,
but at the time llc defaulted to ELFv1 for all big-endian ppc64
triples, so the generated checks were ELFv1 even though FreeBSD 13
uses ELFv2. 4b09cb2b16eb made llc select ELFv2 for FreeBSD 13+ and
worked around the resulting failure by changing the triple to
freebsd12.0.
Use powerpc64-unknown-freebsd and regenerate the checks. The test
covers vector FDIV lowering without VSX, which is unaffected by the
ABI.
[lldb] Fix a lock-order deadlock in OptionValueFileSpecList::Clone (#233507)
`OptionValueFileSpecList::Clone` locks `m_rmutex` and then copies its
`OptionValue` base, which locks `m_mutex`, while
`OptionValue::GetFileSpecListValue` takes the same two locks in the
opposite order. When several debuggers create targets at once, this
deadlocks on the global `target.debug-file-search-paths` setting and
`TestMultipleDebuggers.py` times out (#233425).
This patch removes the `Clone` override. The copy constructor already
locks `m_rmutex` on its own. The new unit test hangs 10/10 without the
patch, and the test's driver went from 3 hangs in 1920 runs to 0 in 3840
on Windows.
[Flang] Avoid deep template recursion (#233865)
The names of all runtime functions is stored as variadic template
parameters of a `RuntimeTableEntry`, but the preprocessor macro that
creates the template instantiation (`FirMacroExpandKey`) expands to
exactly 50 characters. A recursive function `filter` then was used to
strip the unnecessary trailing `'\0'` characters out of the variadic
template. On the msvc compiler this 50x template recursion hits a
hard-coded limit
([C1202](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/fatal-error-c1202)).
#218985 exposed this limted because this 50x template recursion started
to happen in a deeper context, maybe because the instantiation order
stopped making use of a previous memoization.
The updated code is non-recursive, using a constexpr loop instead of
template recursion.
This should fix
[flang-x86_64-windows](https://lab.llvm.org/buildbot/#/builders/166)
[2 lines not shown]
[mlir][tosa] Lower concat to tensor.concat (#231726)
Lower `tosa.concat` directly to `tensor.concat` instead of expanding it
into `tensor.empty` and `tensor.insert_slice` operations.
Update the TosaToTensor conversion tests to check the resulting concat
operations.
[lldb][test] Disable TestLldbGdbServer.py test_Hg_fails_on_minus_one_pid (#234129)
On Windows. It is flaky in GitHub CI and likely not specific to one
architecture. See #138085.
Relates to #232235.
[LoopPeel] Add tests for peeling last iter of already peeled loops. (#234128)
Add tests where peeling from the front is rejected because the loop has
already been peeled, with and without a compare that can be eliminated
by peeling the last iteration.
Aided by Opus 5.5
[AArch64][llvm] Fix incorrect diagnostic (index/immediate in simm9)
Improve the error message in the simm9 diagnostics and use the word
'immediate' instead of 'index'. This was noticed when creating the
CFLT instructions for Armv9.8-A, but would have caused a lot of
unrelated churn if merged as part of that change.
Co-authored-by: Martin Wehking <martin.wehking at arm.com>
[mlir][SPIR-V] Add Volatile function parameter round-trip tests (#232195)
The deserializer accepts Volatile function parameter decorations since
#230611 made it keep every unit decoration. Add round-trip tests for
function definitions and imported declarations, including Volatile
combined with Alignment and FuncParamAttr decorations, so the Volatile
path is covered explicitly.
[lldb][test] Make TestMultipleDebuggers check every debug session (#233526)
`multi-process-driver` exits 0 once every session finishes, even if they
failed, and on Windows they all failed at their first stop:
`SBFrame::GetFunctionName` returns `int foo(void)`, not `foo` or
`foo()`.
This patch checks which breakpoint the selected thread stopped at
instead of the name of thread 0's function, fails a session when
`SBTarget::Launch` fails, and exits 1 when a session fails.
It sets `plugin.process.gdb-remote.packet-timeout` to 600 like dotest,
since 13 of 1920 runs on a loaded host failed with "failed to get reply
to handshake packet within timeout of 6.0 seconds", and prints the
timeout message, which the loop never reached.
With https://github.com/llvm/llvm-project/pull/233524, 1920 runs of 32
parallel drivers pass on Windows with lldb-server.