[flang] Defer typing of forward-referenced DATA implied-DO indices (#214473)
F2023 19.4 p5 gives a data-i-do-variable without an explicit
integer-type-spec the type that its name would have as a variable of the
innermost scoping unit including the DATA statement. That is a property
of the whole scoping unit: since a data-stmt is a declaration-construct,
the type declaration statement establishing the name's type may follow
the DATA statement in the same specification part. Name resolution
resolved the index eagerly at the DATA statement, so under IMPLICIT
NONE(TYPE) a later declaration drew a spurious "No explicit type
declared" error, and without IMPLICIT NONE a later declaration with a
non-default kind was ignored.
Defer the typing of such indices to the end of the specification part,
mirroring the existing deferral for ordinary DATA statement objects.
DATA statements in an execution part keep the current eager resolution.
Assisted-by: AI
[clang-tidy][docs] Rename bugprone check docs to Markdown [3/4] (#214421)
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is the mechanical rename for part 3/4 of the remaining `bugprone`
check documentation.
The rewrite is provided by the next PR in this stack.
[clang-tidy][docs] Rewrite bugprone check docs to Markdown [3/4] (#214422)
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This rewrites part 3/4 of the remaining bugprone check documentation
from reST to MyST Markdown.
AI Usage: This was prepared with rst2myst and GPT5.6-assisted cleanup.
I manually verified that the documentation renders as expected.
Preview site:
https://broken.life/llvm-staging/bugprone-markdown-port/
[mlir][Transforms] Check successor operand types before merging identical blocks (#215036)
Merging identical blocks threads their differing values through the
predecessors' terminators as new successor operands, but the only
legality question asked of a predecessor was whether its terminator
implements `BranchOpInterface` (`ableToUpdatePredOperands`). The
transform's implicit assumption is that such a terminator can forward
operands of **any** type — false for dialects whose branch ops constrain
successor operand types. The LLVM dialect terminators declare theirs as
`Variadic<LLVM_Type>`, so merging two blocks that differ in, say, an
index-typed operand rewrote a verifying `llvm.cond_br` into one that no
longer verifies.
Reproducer (mixed-dialect IR of the kind a progressive lowering/raising
pipeline carries), via `mlir-opt
-pass-pipeline='builtin.module(func.func(canonicalize{region-simplify=aggressive}))'`:
```mlir
func.func @f(%m: memref<4xf32>, %c: i1) {
[33 lines not shown]
[JITLink] Notify memory managers on JITLinkDylib destruction (#214739)
Add JITLinkDylib::notifyOnDestruction so a JITLinkMemoryManager can
register to be told when a JITLinkDylib it served is being torn down,
giving it a chance to release resources held on the dylib's behalf (e.g.
reserved address ranges). Notification may be handled asynchronously:
once notifyDestroying is called, the JITLinkDylib is guaranteed not to
make further use of those resources.
[ORC] Make RTBridge Callers value types; add buildCallers (#215046)
rt::Caller was an abstract base with a per-protocol subclass
(rt::sps::Caller), so holding one polymorphically meant a vtable and a
heap allocation, and each caller stored an ExecutionSession reference.
Replace that with a value type: rt::Caller<Sig> holds a callee address
and a dispatch function pointer (CallerBase provides the address,
operator bool, and calleeAddr()). The serialization/dispatch protocol is
erased behind the function pointer instead of a class hierarchy, so
callers are copyable, carry no vtable or heap allocation, can be stored
inline, and take the ExecutionSession at the call rather than storing
it. This lets non-templated generic code hold and invoke callers without
knowing the protocol.
rt::sps::CallerSpec supplies a caller's dispatch function and
controller-interface name; the named specs (MainCallerSpec,
VoidVoidCallerSpec, ...) replace the previous rt::sps caller subclasses.
[3 lines not shown]
[DomTree] Remove redundant getNodeForBlock. NFC (#215045)
Semi-NCA has given every node a dominator with a smaller DFS number,
whose node already exists.
[libc] Disable hermetic version of printf_core.parser_test (#215037)
It fails on amdgpu:
https://lab.llvm.org/buildbot/#/builders/10/builds/33548
ld.lld: error: undefined symbol: operator delete(void*, unsigned long,
std::align_val_t)
This effectively reverts a part of #213852.
[clang] Simplify the overload resolution logic for operator new and new[] (#211482)
This PR replaces the current spec-equivalent argument list mutation with
direct iteration of the correctly ordered set of argument lists for a
given allocation.
This adds a bit of architectural work around the argument list
construction but the overall effect is substantially simplified search
of the overload candidates
LLM usage: Claude found align_val_t caching bug, and found and created a
test for reentrant `getTypeIdentityArgument`+`tryBuildStdTypeIdentity`
[flang] To fix LIT test that AIX does not emit comdat. (#214950)
PR #213890 added this new LIT test.
However, AIX uses XCOFF and does not emit COFF COMDAT.
[InstCombine] Use DenseMap instead of MapVector (NFC) (#214536)
WorkMap is accessed only via MapVector::operator[] and lookup.
This patch changes its type to DenseMap to avoid populating the vector
portion of MapVector.
DAG: Gracefully diagnose missing lrint/llrint/lround/llround libcall
Avoid hitting the fatal error in makeLibCall by emitting a diagnostic
if the library call is unsupported.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[libc] Enable most tests in hermetic mode (#213852)
This is mostly a straightforward search&replace, as I've addressed the
blockers in previous patches. The nontrivial parts are:
- adding a SUITE to a single (FP) test which doesn't have it (turns out
hermetic tests require a SUITE argument)
- using APPEND_LIBC_TESTS in a couple of tests creating files (to avoid
races between unit and hermetic versions)
- renaming add_libc_unittest to _add_libc_unittest to prevent accidental
creations of non-hermetic tests (one can still use the UNIT_TEST_ONLY
arg to add_libc_test to achieve this effect)
[clang] Simplify the overload resolution logic for operator new and new[]
This PR replaces the current spec-equivalent argument list mutation with
direct iteration of the correctly ordered set of argument lists for a
given allocation.
This adds a bit of architectural work around the argument list construction
but the overall effect is substantially simplified search of the overload
candidates.
* We now simply enumerate correctly ordered candidates for the implicit
arguments. This means no more re-entrant modification of the argument
list to handle addition and removal of type-identity or alignment
parameters.
* We no longer mutate the primary LookupResult when attempting the MSVC
array fallback. This also lays the groundwork for correct diagnostics
of such cases. For now we have a minor improvement of correctly
reporting the operator we were trying to resolve originally, and tell
the user that we have attempted the MSVC fallback if applicable.
[16 lines not shown]
[libc] Fix Atan2f128 and add tests for all versions (#215023)
It fixes the THREE_PI_OVER_4 value in atan2f128 and adds a small smoke
test against the failure.
The result or comparison value is directly taken from the failure while
comparing with core math :
```CPP
FAIL x=inf y=-inf ref=0x1.2d97c7f3321d234f272993d1414ap+1 z=0x1.2d97c7f3321d234f272993d1414ap-1
```
Additionally it adds some more smoke tests for all atan2 versions.