[WebAssembly] Remove WasmEHFuncInfo (NFC) (#194972)
This removes `WasmEHFuncInfo` class.
This class was created to maintain the information of, "If an exception
is not caught by EHPad A, what is its next unwind destination?". Turns
out this information is already in the CFG.
After #130374, we use the common `findUnwindDestination`:
https://github.com/llvm/llvm-project/blob/113479d119a997e4c4c3eae63e087588c9662121/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#L2107-L2164
Note that in case of `catchswitch`, we follow its unwind destination
chain and add all of them to the invoke BB's successors until it meets a
`cleanuppad`, which always catches an exception. And the order of the
successor is the order of the unwind destination chain. So an invoke
BB's successor list would be like: [normal destination, unwind EHPad 1,
unwind EHPad 2, unwind EHPad 3, ...] where EHPad 2 is the next unwind
destination if EHPad 1 does not catch an exception and so on. So if we
want to know what the current EHPad's next unwind destination is, we can
[18 lines not shown]
[RISCV] Remove isAsmParserOnly from isPseudo instructions. NFC (#194958)
isAsmParserOnly is only used to suppress DecoderEmiter, but that's
already supressed by isPseudo. The real usage for this should be for
instructions that have encoding information but we don't want to
disassemble.
Many of these pseudos are emitted from codegen meaning they aren't
really assembler only. So you can't argue this flag is good for
documentation either.
[RISCV] Remove isAsmParserOnly from LongBccPseudo and LongBcciPseudo. NFC (#194949)
These instructions are created by assembler relaxation. They aren't
"parsed.". isAsmParserOnly suppresses the disassembler for these, but
that was already suppressed by isPseudo and isCodeGenOnly.
IR: Introduce !elf_section_properties for setting section properties.
This new metadata type may be used to set sh_type and sh_entsize on a
global's section. The intent is that it will be used to mark up
CFI jump table sections.
Reviewers: fmayer, MaskRay, nikic, efriedma-quic
Reviewed By: fmayer
Pull Request: https://github.com/llvm/llvm-project/pull/149260
[Clang] Reject __annotation on unsupported targets (#193731)
__annotation emits llvm.codeview.annotation intrinsics, which are only
consumed by CodeViewDebug
on Windows and UEFI targets. On other targets the intrinsic is silently
dropped, and codegen
hits an assertion due to wchar_t being 4 bytes (UTF-32) instead of the
expected 2 bytes
(UTF-16).
Fixes #184318
[MemProf] Skip GV `__prof*` during instrumentation (#193354)
The existing filter in `isInterestingMemoryAccess` skips globals named
`__llvm*`, but PGO counter globals are named `__profc_*` (and related
`__profd_*`, `__profvp_*`, etc.), so they bypass the name check, e.g.:
https://github.com/llvm/llvm-project/blob/b48d8a54e29f5f33ef52a4759414126904f01611/llvm/include/llvm/ProfileData/InstrProf.h#L128-L138
The section-based check above catches direct accesses where
`stripInBoundsOffsets` resolves to the GlobalVariable, but fails for
bias-based counter addressing `(inttoptr(add(ptrtoint(__profc_),
bias)))` which the strip cannot see through.
This causes MemProf to instrument PGO counter updates, inflating MGO
binary access profiles proportionally to __llvm_prf_cnts section size.
Filtering `__prof` prefixed globals closes this gap.
RFC: we have confirmed `__prof*` are dead weight, whether we should
[4 lines not shown]
[CIR] FlattenCFG: accept cir.trap as a ternary region terminator (#194497)
The CIRTernaryOpFlattening pattern only accepted cir.yield and
cir.unreachable as the terminator of a ternary region. Any other
terminator caused a verifier error ("unexpected terminator in ternary
false region") and aborted the backend with "IR failed to verify after
pattern application".
Real-world C++ code that uses the libc++ assertion macros hits this
path: _LIBCPP_ASSERT_NON_NULL expands to `cond ? (void)0 :
__builtin_trap()`, which lowers to a `cir.ternary` whose false region
ends in `cir.trap`. This is structurally identical to the
`cir.unreachable` case (both are non-returning Terminators), so the
flattening pattern just needs to leave the trap in place rather than
trying to rewrite it into a branch to the continue block.
Concretely this is blocking ~1,510 libc++ tests (~17% of the suite) that
all failed with the same diagnostic at construct_at.h, sample.h, and
pop_heap.h.
[2 lines not shown]
[libc][thread] detect self-join and mutual-join deadlock (#194891)
Fix #194034.
Detect the deadlock cases of mutual thread joining.
Required by
`libcxx/test/std/thread/thread.jthread/join.deadlock.pass.cpp`
Assisted-by: Codex with gpt-5.5 high fast
[dsymutil] Fix ODR type uniquing for -gsimple-template-names (#194501)
With -gsimple-template-names (now the default on macOS with deployment
target >= 26), template types like vector<int> and vector<float> both
get DW_AT_name("vector") in DWARF, with template parameters encoded only
as DW_TAG_template_type_parameter children.
Previously, dsymutil used only DW_AT_name for ODR type uniquing, causing
different template specializations to collide. This PR fixes that by
reconstructing template parameter information from child DIEs when the
type name does not already contain template parameters.
The reconstructed name is used only for uniquing and not emitted into
the output DWARF. The parallel DWARF linker already handled this
correctly via SyntheticTypeNameBuilder.
rdar://175115639
[llvm-dwp] Replace MCStreamer with direct ELF writer for zero-copy output (#192112)
Replace the MCStreamer-based output pipeline with a lightweight direct
ELF writer (DWPWriter). Section data is stored as zero-copy StringRef
chunks pointing to the mmap'd input files, and written as a minimal
ELF64 relocatable object directly to disk.
## Rationale
The MCStreamer pipeline copies all section data into 16KB MCDataFragment
blocks, accumulates them in memory, then writes everything out during
MCAssembler::Finish(). This can be cause lots of memory pressure and
slow down llvm-dwp.
For instance, on a 3.3GB DWP file, this translates to rougly ~3.3GB of
heap allocation and two full copies of the data.
The new DWPWriter avoids this via:
- emitBytes() stores a StringRef chunk (zero-copy, no allocation)
- emitIntValue() writes to a small per-section buffer (index tables)
[16 lines not shown]
[clang-tidy] Fix some false positive in bugprone-move-forwarding-reference (#191435)
In the following case:
template <typename T, typename U>
void shocase(U&& SomeU) {
[SomeU] () { T SomeT(std::move(SomeU)); };
}
We use to flag the move as a forward, while the lambda captures SomeU by
copy, which makes the move valid.
[LangRef] asm clobber constrains: '~memory' allows reads and synchronization (#150191)
I was not sure what the best way is for talking about "synchronization effects".
[flang][OpenMP] Check conflicts between predetermined/explicit DSA
Improve checks for loop iteration variables with predetermined DSA
appearing in DSA clauses. Show both the location of the variable
in the offending clause, and in the loop.
Make the checks a bit more accurate as well: only allow LINEAR clause
on SIMD construct with a single affected loop.
[RegisterCoalescer] Fix LiveRange::overlaps assert on empty interval (#194771)
Make the empty-range check in LiveRange::overlaps() symmetric by also
checking this->empty(), not just other.empty(). This prevents an
assertion failure in overlapsFrom() when applyTerminalRule encounters a
virtual register with no definition and thus an empty live interval.
[clang][modules] Always keep submodule index up-to-date (#194039)
This partially reverts #113391, always keeping the submodule index
up-to-date. This is important for a follow-up PR that will make
deserialization of submodules lazier. Without this change, updating the
index would deserialize submodules too eagerly. The original PR only
showed 0.5% improvement in scan times, while the upcoming PR promises an
order of magnitude larger improvement.
[clang][modules] Make `ExportDecl` a `std::pair` (#194036)
This PR replaces `llvm::PointerIntPair` with `std::pair` for module
exports. This is NFC that enables a future PR to use a different
(larger) type to represent module references.
[clang] NFC: Replace `auto` with `Module *` (#194032)
This PR updates some uses of `auto` to `Module *`. This is NFC for now,
but will be important in a follow-up to trigger a conversion operator.
[clang][deps] Use `ModuleFile` instead of `Module` (#194028)
This switches the dependency scanner from handling `Module` objects to
dealing with `serialization::ModuleFile`. Module file already contains
(almost) all of the information the scanner needs, and has the advantage
of not forcing deserialization of `Module` objects from PCM files, which
will become important in a later PR.
This alone improves clean scans by 1.8% and incremental scans by 2.6%.
This effect is likely caused by removing iteration over many `Module`
objects, removing deduplication via associative containers deduplication
of work, and sorting `Module` objects by name to ensure deterministic
order.