Revert "[DebugInfo] Ignore undefined constexpr constructors in constructor homing." (#221566)
This reverts commit
https://github.com/llvm/llvm-project/commit/6ba0802b406e0963720a698702b9136578dde149
(https://github.com/llvm/llvm-project/pull/218165).
canUseCtorHoming() used to bail out on
hasConstexprNonCopyMoveConstructor().
That commit narrowed the exemption to *defined* constexpr constructors,
on the
assumption that a constructor which is not defined here will be defined
- and
will therefore emit the type's debug info - in whichever translation
unit
constructs the object.
That assumption does not hold when the constructor is never invoked at
all. A
constructor of a class template specialization is only instantiated, and
[86 lines not shown]
[InstCombine] Canonicalize zext+overflow check to overflow check if zext's only purpose is to check overflow (#220658)
Change processUMulZExtIdiom to also support adds, since the idiom is the
same, except with add instead of mul.
Alive2: https://alive2.llvm.org/ce/z/SsB4AK
[CIR] Derive lowering attr names from cppClassName, not the def name
CIRLoweringEmitter built its CXX_ABI_ALWAYS_LEGAL_ATTRS entries with
GetOpCppClassName, which splits the TableGen def name at the first
underscore. That works only while every def is named CIR_<CppClassName>Attr.
When one is not, the emitter writes an `isa<>` for a class that does not
exist, and the failure lands as a compile error in generated code.
Attributes carry the authoritative name in cppClassName, which
GenerateAttrToValueVisitor was already reading. Factor that out as
GetAttrCppClassRef and use it for both attribute paths. GetOpCppClassName
stays for operations.
NFC, and checkable. No CIR attribute overrides cppClassName, so the generated
CIRLowering.inc is byte-identical.
[CIR] Drop the redundant suffix from the inline kind mnemonic
inline_kind was the one CIR enum attribute mnemonic still repeating what its
C++ enum class name says. The attribute now spells
`#cir.inline<always_inline>`. The operation argument keeps the name
inline_kind, since that is the accessor name, so the printed form reads
`inline_kind = #cir.inline<always_inline>`.
The enum's summary also becomes "inline kind" rather than the camelCase
"inlineKind", which is what generated docs show now that CIR_InlineKindAttr
no longer overrides it.
25 CHECK lines change across four test files. Nine are in an
aarch64-registered-target test, unsupported in an X86-only build, but the
substitution matches the two CIR tests that do run.
[CIR] Use the modern enum case classes
The `I32EnumAttrCase` family carries an `Attr` half, and an `IntegerAttr`
predicate with it, that a CIR enum has no use for now that the enums derive
from `EnumInfo`. Upstream says of those forms that they "are not needed when
using the newer `EnumCase` form".
Rename all 198 of them to `I32EnumCase`, `I32BitEnumCaseNone`,
`I32BitEnumCaseBit` and `BitEnumCaseGroup`. The group class drops its width
prefix because the modern spelling takes the width from its cases.
NFC, mechanical.
[CIR] Drop dead ceremony around the CIR enum attributes
Five things that no longer earn their place in the CIR enum attribute
machinery.
CIR_CleanupKindAttr carried three. Its cppClassName restated the default
AttrDef already derives. Its skipDefaultBuilders plus hand-written
AttrBuilder existed only to default $value to CleanupKind::All, which no
caller relies on, so the generated builders stayed suppressed for nothing.
And its summary and description restated the name, overriding the enum's own
"cleanup kind" that EnumAttr would otherwise inherit. The isNormal, isEH and
isNormalAndEH helpers stay.
CIR_TLSModelAttr's summary restated its name the same way, so only that goes.
CIR_DefaultValuedEnumParameter has never had a user.
NFC.
[CIR] Migrate the FPClassTest bit enum and unquote its flags
cir.is_fp_class printed its flags inconsistently. Single-bit values came out
bare, as in `fcSNan`, while group values and combinations came out quoted, as
in `"fcInf"` and `"fcSNan|fcNegInf"`. That comes from I32BitEnumAttr setting
printBitEnumQuoted, which EnumAttr.td keeps only for backwards compatibility.
Clearing the bit and using the `enum` directive selects the separator-aware
parser and printer, so every value now spells unquoted:
cir.is_fp_class %x, fcSNan|fcNegInf : (!cir.float) -> !cir.bool
The enum also drops its specialized IntegerAttr for a CIR_EnumAttr wrapper,
giving it the standalone spelling `#cir.fp_class<fcSNan|fcNegInf>`. This
changes operation syntax, so it updates 37 CHECK lines.
[CIR] Move the CIR enums off the legacy EnumAttrInfo hierarchy
MLIR has two enum hierarchies. `EnumAttrInfo` doubles as an `IntegerAttr`
constraint, so every CIR enum had to clear `genSpecializedAttr` to say it did
not want one. `EnumInfo` describes a C++ enum and nothing more.
Derive the CIR bases from `I32Enum`, `I64Enum` and `I32BitEnum`, and widen
`CIR_EnumAttr` to the `EnumInfo` that upstream `EnumAttr` already takes. The
flag no longer exists to clear. `FPClassTestEnum` gets unquoted printing from
`BitEnumBase` rather than overriding `printBitEnumQuoted`, and
`CIR_KnownFuncKind` drops a `parameterPrinter` the generated `operator<<`
now covers, still spelling `#cir.func_identity<"std::find">`.
AMDGPU wraps an `I32Enum` in an `EnumAttr` with this same bracketed format.
Parsing moves to the generated `FieldParser`, whose diagnostic names the
accepted spellings, so two `expected-error` lines change. Generated attribute
code drops 16 KB as 28 inlined parsers collapse into it.
[flang-rt] Initialize I/O unit storage read by short-circuit predicates (#221126)
ConnectionState and OpenFile hold common::optional members read through
predicates of the form `opt && x < *opt`, which never use an indeterminate
value in the abstract machine. Compilers do, however, routinely if-convert
the short-circuit && into a branchless compare and select, which speculates
the payload load; because these objects are placement-new'd into malloc'd
storage by UnitMap::Create(), a memory checker then reports a conditional
branch that depends on uninitialized memory. On AArch64 this fires for
every Fortran program that writes a record, giving two reports in
ExternalFileUnit::AdvanceRecord() from IsAfterEndfile() and IsAtEOF(),
while x86-64 is unaffected and libgfortran is clean on the same program and
host. The reports are false positives -- the engaged flag is 0, so both arms
of the select are 0 -- but they are unavoidable noise for anyone running
Valgrind on Fortran code.
Add common::ResetWithDefinedPayload(), which leaves an optional disengaged
while writing its payload storage, and call it at construction for the
optionals in ConnectionAttributes, ConnectionState and OpenFile. Also
[15 lines not shown]
[flang] Reclassify MVBITS, SPLIT, and TOKENIZE as SIMPLE (#205024)
F2023 makes MVBITS a simple elemental subroutine and SPLIT/TOKENIZE
simple subroutines.
This change:
- adds `simpleSubroutine` and `simpleElementalSubroutine` to
`IntrinsicClass`,
- reclassifies the MVBITS, SPLIT, and TOKENIZE intrinsic table entries,
- propagates `SIMPLE` through intrinsic resolution and procedure
characteristics.
MOVE_ALLOC is not included in this change.
[asan][test] Check that stack traces are not truncated (#221518)
Add a test that the access, free and malloc traces each name the whole
call
chain down to `main`, in order, and that each names its own call site in
`main`. A trace that stops early -- as every trace but the access one
does when
the fast unwinder runs on a target that chains no frames -- fails it.
`deep_stack_uaf.cpp` already covers trace depth, but it looks for three
individual frames anywhere in the trace, so it passes on a trace with
holes in
it, and it needs C++ name demangling to do that.
Split out of #220231 at reviewer request.
Assisted-by: Claude Code
[OptTable] Store Info strings in the string table (#218845)
Change HelpText, MetaVar, AliasArgs, and Values from `const char *` to
StringTable::offset, making the fields smaller, and removing dynamic
relocations in .data.rel.ro in PIC links.
Store them as StringTable::Offset, like the option names already are,
and return StringRef from getOptionHelpText() and getOptionMetaVar().
The 53 tables in the tree lose all 616 KB of .data.rel.ro, and sizeof(Info)
drops from 88 to 60; clang's table becomes 232 KB of .rodata.
An unset field and one explicitly set to the empty string, such as a
HelpText<"">, have to stay distinguishable, so the latter gets an empty
string of its own rather than offset zero.
Values declared with ValuesCode are only known to the generated code,
which supplies getOptionValuesCode() for OptTable to call; only clang has any.
Aided by Opus 5
MC: Move DisableIntegratedAS from TargetOptions to MCTargetOptions (#221547)
The integrated assembler is only meaningful in MC, so this field belongs
in MCTargetOptions alongside the other assembler options rather than in
the codegen-level TargetOptions.
Co-authored-by: Claude (Claude-Opus-4.8)
[SelectionDAG] Remove dead functions (NFC) (#221541)
SelectionDAG::getBitcastedSExtOrTrunc,
SelectionDAG::getBitcastedZExtOrTrunc: Added on August 11, 2023 in
commit d26a06728da84a7302875a99ea86e887f6bc425a without any callers.
Assisted-by: Antigravity