[ORC] Route SimpleRemoteEPC::runAsMain through CallMainProxySpec (#219770)
Replace runAsMainAddr with a CallMain proxy that is lazily initialized
by lookupAndApply on first use. This is another step towards making
callWrapperAsync the only call primitive
ExecutionSession/ExecutorProcessControl need to know about.
[clang][bytecode] Reduce `EvalEmitter::Descriptors` inline size (#219773)
For pure expressions, we usually have few locals and few scopes. Reduce
the inline size here.
[clang][bytecode] Remove native pointer marshalling (#218911)
Just emit pointers to bytecode as uintptr_t. This avoids a vector and a
DenseMap in Program. We used to emit the ID as uint32_t, but since all
arguments are pointer-aligned in bytecode anyway, switching to uint64_t
shouldn't cause a memory regression.
[clang][bytecode] Divide `noteStep()` in hot and cold paths (#219760)
Move the hot success path into the header file to encourage inlining.
Also add a likeliness-hint since the steps check should _almost_ never
hit.
[SSAF][clang-reforge] Add end-to-end clang-reforge tests
- Make CppBoundedBuffers adapt to flattened WPA results;
- Let CppBoundedBuffers use qualified EntityNames so that it can
associate ASTNodes with WPA results;
- Add end-to-end tests
Final step of:
rdar://185840466
[SSAF] Flatten 'UnsafeBufferReachableAnalysisResult' to a plain set
Previously, an 'UnsafeBufferReachableAnalysisResult' was organized as
a map from contributors to their mutually exclusive
sub-results. Because this extra layer of contributor information
proved unnecessary, this commit flattens the result into a plain set.
The source transformation expects the result to be a plain set, so
this is a prerequisite step for
rdar://185840466
[SSAF] Add APIs for resolving bare EntityNames to qualified EntityNames (#219033)
Also give Transformation access to SSAFOptions so that it can use
link-unit and compilation-unit IDs to resolve bare EntityNames.
first step of
rdar://185840466
[orc-rt] Fold the default clear_icache into sys/CacheControl.h. (#219758)
It was in a sys/posix/ header, but the default belongs with the
declaration: sys/CacheControl.h now selects on the builtin rather than
on an OS, so a freestanding target -- which has no __unix__ but does
have the builtin -- is served too. Darwin keeps its own header, to call
libSystem directly rather than depend on __clear_cache being linked in.
[FoldingSet] Add typed lookup/insert/erase/getOrInsert (#219644)
FindNodeOrInsertPos hands the insertion state to InsertNode as a `void *`:
any pointer converts to it, only a comment says where it may come from,
and since the switch to linear probing the value is the node's hash, not
a position at all.
Carry it in FoldingSetInsertToken instead, the hash wrapped in a type
whose constructor and accessor are private to FoldingSetBase, with
NotAHash as the no-token state. The `void *` overloads remain,
forwarding to the typed ones, until their callers are migrated.
LLM-aided
[SSAF][clang-reforge] Add end-to-end clang-reforge tests
- Make CppBoundedBuffers adapt to flattened WPA results;
- Let CppBoundedBuffers use qualified EntityNames so that it can
associate ASTNodes with WPA results;
- Add end-to-end tests
Final step of:
rdar://185840466
[SSAF] Flatten 'UnsafeBufferReachableAnalysisResult' to a plain set
Previously, an 'UnsafeBufferReachableAnalysisResult' was organized as
a map from contributors to their mutually exclusive
sub-results. Because this extra layer of contributor information
proved unnecessary, this commit flattens the result into a plain set.
The source transformation expects the result to be a plain set, so
this is a prerequisite step for
rdar://185840466
[SSAF] Add APIs for resolving bare EntityNames to qualified EntityNames
Also give Transformation access to SSAFOptions so that it can use
link-unit and compilation-unit IDs to resolve bare EntityNames.
first step of
rdar://185840466
[SSAF][SourceTransform] Add '--ssaf-link-unit-id=' for specifying link unit IDs (#218823)
The source-transformation pass takes WPA results as input, where
entities are named under link-unit and compilation-unit namespaces. To
associate ASTNodes with entities, the source-transformation pass needs
to know both link-unit and compilation-unit IDs. Such information is
provided by the caller.
rdar://185818153
[flang][Semantics] Resolve private PDT binding overrides (#218832)
Use the selected binding declaration owner when determining the module
in which a private binding may be overridden. A generic cloned into a
PDT instantiation is owned by the instantiation scope, which can
otherwise cause a legal same-module override to be skipped.
Add coverage for external, unrelated-module, module-owned, use-renamed,
and cross-module private/public PDT cases.
Fixes #218683
Assisted-by: AI
[dsymutil] Fix cross-container iterator comparison in MachODebugMapParser (#219370)
This patch fixes a cross-container iterator comparison in
handleStabSymbolTableEntry.
Without this patch, ObjectSymIt starts as an iterator into
CurrentObjectAddresses. If alias lookup succeeds, ObjectSymIt is
assigned AliasIt, an iterator into CurrentObjectAliasMap:
auto AliasIt = CurrentObjectAliasMap.find(Name);
if (AliasIt != CurrentObjectAliasMap.end())
ObjectSymIt = AliasIt;
Subsequent checks then evaluate:
if (ObjectSymIt == CurrentObjectAddresses.end())
which compares an iterator from CurrentObjectAliasMap against the end of
CurrentObjectAddresses.
[7 lines not shown]
[flang][test] Extend coverage for procedure-valued function results (#219477)
Follow-up test coverage for #216322, which fixed `IsProcedure()` for
references to functions whose result is a plain procedure — a shape that
previously aborted a production build on the `CHECK(IsProcedure(expr) ||
IsProcedurePointer(expr))` in intrinsic argument checking instead of
reporting the declaration error flang had already recorded.
The tests that landed with that fix reference the callee directly and
recursively (`func-proc-result.f90`) or vary the intrinsic
(`func-proc-result-intrinsics.f90`). This adds the two dimensions they
leave uncovered.
Assisted-by: AI
[ADT] Add DebugEpochBase::HandleBase::isComparableWith (#219738)
This patch unifies operator== across hash table iterators with
DebugEpochBase::HandleBase::isComparableWith, performing the following
safety checks:
- LHS is either default-constructed or in sync with its container.
- RHS is likewise either default-constructed or in sync with its
container.
- Both iterators belong to the same container instance and share the
same state (without intervening mutations).
Assisted-by: Antigravity
[SSAF][PointerFlow] Change unsafe-buffer reachability analysis back to simple graph search (#218209)
Because of #218207, we no longer need unsafe-buffer reachability
analysis to "uncompress" pointer flow graphs. It can go back to simple
DFS. Since it deals with large data, simplicity is important.
In addition, unit tests for the "compressed" pointer flow graph DFS are
moved to lit tests because they are no longer suitable as WPA unit
tests. As lit tests, they are end-to-end tests where the extractor is
involved and is responsible for generating "uncompressed" graphs.
Final step of
rdar://183529483
[lld][MachO] Support Objective-C class stubs
Teach Mach-O objc stubs to synthesize class-message stubs that load the class object, selector, and objc_msgSend target.
lld already supports the Apple clang _objc_msgSend$<selector> stub form, even though upstream clang does not currently expose a driver or cc1 flag for emitting it. Apple clang also emits _objc_msgSendClass$<selector>$_OBJC_CLASS_$_<class>; handling that form completes the existing selector-stub support.
Cover local classes, dylib classes, archives, dynamic lookup via -U, missing class symbols, malformed names, unsupported architectures, and dead stripping.
[lld][MachO] Fix ObjC stubs from autolinked archives
Move ObjC stub preparation after LC_LINKER_OPTION processing so archive members loaded via autolink can contribute _objc_msgSend$ selector stubs before selector references are built.
Previously those stubs missed __objc_methname setup; assert builds could fail in makeSelRef, and release builds could form an invalid selector reference.