[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
[M68k] Use ISD::getSetCCInverse instead of ISD::GlobalISel::getSetCCInverse. NFCI (#216871)
It's odd to use a GlobalISel named function in SelectionDAG code. This
code path isn't exercised by lit, but I think this should be equivalent.
[NewPM] Port ImplicitNullChecks to the new pass manager (#216965)
Adds a newPM pass for ImplicitNullChecks.
- Refactors base logic into an ImplicitNullChecks class
- Renames old pass with the "Legacy" suffix
- Adds the new pass manager pass ImplicitNullChecksPass
- Updates MachinePassRegistry.def, PassBuilder, and CodeGenPassBuilder
- Updated existing .mir tests to also test with the New Pass Manager
Assisted-by: Gemini / Next
[CIR] Handle an empty C++ class in x86_64 callconv lowering (#214742)
CIR lays a C++ empty class out as a record that is nothing but padding,
and isSupportedType rejected every padded record, so any signature
naming one failed the pass with an NYI. Ordinary C++ hits this
constantly through tag dispatch, allocators, and empty bases.
Implement empty C++ class support. Every record member now carries a
kind, so a record holds no data exactly when none of them is marked
data, which `RecordType::isEmptyForABI()` answers and the pass reads. An
empty record then maps with no fields, so the classifier drops it on its
own.
Assisted-by: Cursor / claude-opus-5
[llvm-nm][GOFF] Display archive attributes in GOFF archives through --print-armap
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.