[Instrumentor][FIX] Ensure CXX headers are available (#205693)
Try to address failure in #205221, which results in <atomic> not found.
This is CMake code copied from other compiler-rt projects using
<atomic>.
[Clang] Don't suppress vtable emission for classes with -fmodules-debuginfo (#204662)
847f9cb0e868 made `Sema::DefineUsedVTables` skip
`Consumer.HandleVTable()` when `Class->shouldEmitInExternalSource()` is
true. This works for named C++20 modules as they have an object file,
but does not hold for -fmodules-debuginfo / -fpch-debuginfo.
This patch additionally gates that on `Class->isInNamedModule()`. This
is the same pattern used by the rest of codegen for this situation.
Needing to check this everywhere is a bit unfortunate. It would be good
to eventually refactor this class of checks to have clearer semantics
around named modules, debug info, and -fmodules-codgen.
Fixes https://github.com/llvm/llvm-project/issues/198587
Assisted-by: Claude Code: opus-4-8
[lldb][NFC] Remove ConstString from Language::MethodNameVariant (#205688)
Language::MethodNameVariant is for when a given method name may have
several language-defined variants. For example, we may see an
objective-C method name with a category that should be searchable via
the name without the category.
The ObjCLanguage plugin computes these names without checking that they
are actually useful or even exist. Because these variant names are
stored in ConstString, they will live forever even if they are never
used.
[RISCV][clang] Use fcf-protection flag in Multilib Selection (#205202)
This ensures that we can separate out multilibs that are or are not
built with control flow protection enabled.
The initial version of the patch claims all values of these flags are
incompatible. It might be the case that we could make this logic more
complex if some versions do become compatible.
[Instrumentor] Add runtime examples: [1/N] A flop counter (#205221)
This adds a instrumentor-tools folder into compiler RT to showcase
use cases of the instrumentor. The initial example is a program that,
via instrumentation, counts the number of flops performed. Call and
intrinsic support will follow after #198042.
Partially developed by Claude (AI), tested and verified by me.
[Instrumentor] Add runtime examples: [1/N] A flop counter
This adds a instrumentor-tools folder into compiler RT to showcase
use cases of the instrumentor. The initial example is a program that,
via instrumentation, counts the number of flops performed. Call and
intrinsic support will follow after #198042.
Partially developped by Claude (AI), tested and verified by me.
Revert "[LifetimeSafety] Fix liveness propagation for all origin flows (#205323)" (#205687)
Revert "[LifetimeSafety] Fix liveness propagation for all origin flows
(#205323)"
This reverts commit 8d2a578b2130742c8790f3dba5fb414962eafcd5.
Revert "[LifetimeSafety] Model GNU statement expressions (#204841)"
This reverts commit 361f3b24f2a8703eb7a32c1ae081f490888238f3.
[Instrumentor] Add subtype IDs to complement type IDs for vectors/arrays (#205466)
If the type of an argument passed to the instrumentation is a vector or
array, we still want to filter on the underlying type, and the
instrumentation might also need to know. Thus, we can now pass a subtype
ID, which is -1 except if it's a vector or array, then it's the element
type ID. Structs need to be handled differently.
[Sema] Fix ICE when passing vector types to `abs` (#205017)
fix for ICE in `Sema::CheckAbsoluteValueFunction`
We failed to reject non-scalar types.
Fixes: #204777
[lldb][Mach-O] Bounds-check GetArchitectureAtIndex against m_fat_archs (#205289)
`ObjectContainerUniversalMachO::GetArchitectureAtIndex` used
`m_header.nfat_arch` (read directly from the file and untrusted, up to
0xFFFFFFFF) as the bound before indexing `m_fat_archs`. When ParseHeader
exhausts the data partway through and breaks early, `m_fat_archs.size()`
can be smaller than `nfat_arch`, so the indexed load is out of bounds.
Bound the check on the actual vector size instead.
Found by lldb-target-fuzzer.
---------
Co-authored-by: Alex Langford <nirvashtzero at gmail.com>
[flang][cmake] Enable the runtimes in the CMake caches (#205642)
I've tried to introduce that in the PR #198863, but sadly, the buildbots
could not cope with this, so I decided to introduce it separately.
This patch also fixes the relevant places in the docs.
[APInt] Consistently use the terms pdep/pext instead of expandBits/compressBits (#205112)
After some bikeshedding in #200570 - we decided on the terms pdep/pext
[AssumptionCache] Fix removeAffectedValues() when value is repeated in AssumeInst (#205275)
If a value appears more than once in an AssumeInst (e.g., `ptr %arg1` in
`call void @llvm.assume(i1 true) [ "dereferenceable"(ptr %arg1, i64 1),
"align"(ptr %arg1, i64 8) ]`) it will appear multiple times in the
result of findAffectedValues(). removeAffectedValues() may (depending on
how the results in AffectedValues.find_as(AV.Assume) are ordered),
nullify multiple values from AffectedValues.find_as(AV.Assume) in one
iteration of an outer for loop. The next iteration of that outer for
loop might then find a match only to a different AssumeInst, resulting
in an assertion failure.
This patch fixes the issue by counting the number of matching
ResultElems we expect to find.
This was a latent bug that was revealed by
https://github.com/llvm/llvm-project/pull/204432; the latter is not
itself buggy, but relies on AssumptionCache::removeAffectedValues().
[2 lines not shown]
[OpenMP][Offload] Use argument pointer array in host kernels (#205355)
This is a follow-up to #194333, which changed liboffload's kernel launch
interface to take an array of pointers to arguments instead of a
contiguous argument buffer, but left the old path intact for OpenMP, to
be cleaned up iteratively in later changes.
This patch modifies the offload host kernels, and the OpenMP clang
codegen, to also use argument pointer arrays. The host was the only
plugin that did not support the new submission path. With it converted,
OpenMP can migrate to use the new path in all scenarios, after which
everything related to contiguous argument buffer and its construction
can be removed from plugin interface and the backends.
The change itself is fairly straightforward. The bulk of the diff is
automated test updates. In the runtime, the host kernel signature
becomes an array of pointers (void **), and the codegen is updated to
match. With each argument being a pointer, the kernel function now adds
one load to read the argument's value.
Assisted-by: Claude
[mlir][bazel]: only depend on needed LLVM translations in ExecutionEngine (#205619)
ExecutionEngine currently pulls in `AllToLLVMIRTranslations` which
includes heavy dependencies on GPU dialects (notably NVVMDialect.cpp
which takes a whopping 2 minutes to compile!), despite the
ExecutionEngine not doing anything GPU-specific.
This change reduces the dependencies to just the subset of LLVMIR
translations that ExecutionEngine actually uses: Builtin, LLVM dialect,
and OpenMP dialect.
clang: Replace getTargetID API with isProcessorName (#205653)
The "target ID" naming is an AMDGPUism. Replace the getTargetID query
with an isProcessorName predicate so the target reports whether the
string should be considered a match. This makes alias handling more
natural than checking for exact match, and avoids an unnecessary
parse of the target ID.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>