[flang] Do not branch to a FORMAT statement from an assigned GO TO
Label analysis already classifies which labeled statements may be named by
a statement that branches. Record the positions of those statements in the
semantics context and consult it when lowering records the targets of an
assigned GO TO, so that a FORMAT statement is not given a target block.
A GO TO whose variable holds only a format label now reaches the run-time
error instead of branching into the FORMAT statement.
Co-Authored-By: Claude
[lldb] Fix scripted frame provider cross-thread re-entrant deadlock (#208242)
`GetStoppedExecutionContext` unconditionally blocked acquiring the
target's API mutex. A thread already holding that mutex (for example a
`bt` command thread, through `CommandObjectParsed`'s
`eCommandTryTargetAPILock`) can end up waiting on a `StackFrameList`
lock held by another thread (for example the debugger's event-handler
thread) that is itself blocked re-acquiring the API mutex from inside a
scripted frame provider's Python code that touches the SB API. This is a
classic AB-BA deadlock.
This patch introduces
`Policy::Capabilities::can_bypass_target_api_mutex`, pushed around every
scripted-extension callback in `ScriptedPythonInterface`:
`CreatePluginObject`, `Dispatch` and `CallStaticMethod`. A thread
running one of these callbacks isn't servicing a client-facing SB API
entry point; it doesn't need the same locking guarantees a top-level SB
API call does for any of the calls it makes during that window, not just
the one that happens to deadlock.
[24 lines not shown]
[ObjectYAML][NFC] Finalize COFF symbol table offset in writeCOFF (#212671)
Move NumberOfSections and NumberOfSymbols initialization out of
layoutCOFF. Derive PointerToSymbolTable from the live output offset and
write its final value back to the emitted header.
Add an endian-aware ContiguousBlobAccumulator::updateDataAt overload.
This is a preparatory step toward removing the separate COFF layout
pass.
[clang][AST] Remove APValue float/int double-initialization (#217100)
Every call to `MakeInt()` and `MakeFloat()` used to initialize the
backing `APSInt`/`APFloat`, but they were also all followed by a
`setInt()`/`setFloat()` call.
Just pass the value to `MakeInt()` and `MakeFloat()` directly, which is
also what most of the other `Make*` functions do.
[BOLT] ICF: Use nameStartsWith instead of getName (#206999)
The getName method returns the name of the first symbol for a given
BinaryData. If a symbol is associated with the same address as a vtable
symbol, the ICF check for vtable mangled names may behave unexpectedly.
The correct approach is to use nameStartsWith, which checks all symbols
associated with the BinaryData.
[LoopInterchange] Bail out if a PHI would be cloned into the new latch (#212742)
The transformation stage of LoopInterchange splits the inner loop latch
and clones the necessary instructions from the original latch into the
new one. PHI nodes cannot be cloned this way, so the legality check is
supposed to reject cases where such a clone would happen. However, it
missed some cases, allowing a PHI node to be cloned and invalid IR to be
produced.
This patch fixes the issue by making the legality check follow all the
instruction trees the transformation would clone, i.e., the use-def
chains of both the exit condition and the induction variable updates,
and reject the interchange if a PHI node other than the induction PHIs
appears in them. Previously, the check only ran when the inner loop
contains subloops, only followed the use-def chains of the exit
condition, and only rejected PHI nodes placed in the latch block.
Note that this is a stop-gap solution, especially because the legality
check strongly depends on the details of the transformation stage. The
[3 lines not shown]
[llvm-ar][GOFF] Implement symbol attributes for GOFF archives
z/OS archive symbol table entries contain a 32-bit attribute word
alongside each member offset. The low three bits encode:
bit 2 (0x4): 64-bit addressing (AMODE 64)
bit 1 (0x2): XPLink calling convention
bit 0 (0x1): Writable Static Area (WSA)
Previously in e2c8fa0, llvm-ar wrote zero for
these attributes. This patch reads them from GOFF ESD records and stores them
in a SymbolAttrs vector parallel to the existing Symbols vector in
MemberData to emit the correct word per symbol.
These attributes are tested using `llvm-nm --print-armap` implemented in
#212830 within the LIT test.
[llvm-nm][GOFF] Display archive attributes in GOFF archives through --print-armap (#214527)
GOFF archive symbol table entries contain an attribute word in addition
to the archive member offset. The low three bits describe whether the
symbol is 64-bit, uses XPLink, or belongs to the WSA namespace (which
was briefly mentioned in e2c8fa09872cfacba7f73599dcf8557971ebe865).
This patch extends `llvm-nm --print-armap` to print the attribute value
(in hex)
and its decoded description beside a symbol and its corresponding member
when processing a GOFF archive. This will functionality will be used to
help
validate full support for writing GOFF archives in a subsequent llvm-ar
patch.
The output for non-z/OS archives is unchanged.
[orc-rt] Drop iostreams from CommandLine.h via formatHelp (#217178)
Add ljust/rjust field-padding helpers to StringOutputStream (a nested
Justified type plus free ljust/rjust functions), the string-building
analogue of std::setw with std::left/std::right.
Use them to replace CommandLineParser::printHelp(std::ostream &, ...)
with formatHelp(std::string_view) -> std::string, built via
StringOutputStream. CommandLine.h no longer includes any iostream header
(<iomanip> dropped, no <ostream> added); callers that want to print
route the returned string themselves, e.g.
std::cerr << P.formatHelp(argv[0]);
This moves the iostream dependency out of the reusable header and into
the leaf tools (host binaries) that opt into it. Updates the two check
tools and the unit test, which no longer needs a stringstream.
[llvm-nm][GOFF] Support symbol types and sizes (#207119)
Add GOFF-specific handling in llvm-nm for symbol types and sizes. GOFF
symbols are now classified using their GOFF type, allowing llvm-nm to
distinguish global/local data and text symbol,s as well as undefined
symbols.
This addition to llvm-nm is also useful to display the symbol table of
GOFF object and archives.
[ADT] Reland: Remove CRTP from FoldingSet and ContextualFoldingSet (NFC) (#217058)
This patch relands #216830 with a fix for MSVC build failures.
In the original patch, FoldingSetInfo was defined as a static constexpr
member variable of FoldingSetImpl. On MSVC, instantiating
FoldingSetImpl<T> (e.g. in LLVMContextImpl.h) eagerly evaluates the
static constexpr member variable and its lambdas containing
static_cast<T *>(N). When T is an incomplete type (such as AttributeImpl
forward-declared in LLVMContextImpl.h and compiled in Metadata.cpp),
this
caused MSVC to fail with C2440 because static_cast requires a complete
type.
This patch wraps FoldingSetInfo in a static getFoldingSetInfo() member
function so that instantiation is deferred until the function is
actually
called, such as during InsertNode or FindNodeOrInsertPos.
Assisted-by: Antigravity