[Instrumentor] Add runtime examples: [2/N] A FP precision analysis
Second example:
Check all floating point operations and track if they could be done at
lower precision.
Partially developped by Claude (AI), tested and verified by me.
[clang] Exclude EmptyRecord when calculating larger CXX records (#205040)
To match with GCC: https://godbolt.org/z/KPKGhhenK
Fixes: #203760
Assisted-by: Claude Sonnet 4.6
[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.
[llubi] Add basic support for pointer comparisons (#205410)
This patch was a part of
https://github.com/llvm/llvm-project/pull/201170. I split the `icmp ptr`
support from the original PR since I am worried it might not catch up
for the LLVM 23 release (#201170 is blocked by #200672 for curating
mixed provenance tests). I hope we can pick most of the low-hanging
fruit exposed by fuzzers before the release. The released version should
be able to run csmith-generated tests without obvious false positives or
crashes.
BTW, this patch doesn't respect the exact semantics of `icmp ptr` (i.e.,
truncating the address to the address width. The naming is a bit
confusing...). Currently, we don't model external state in non-address
bits of a pointer in llubi. So I think it is fine.
[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.
[Instrumentor] Add subtype IDs to complement type IDs for vectors/arrays
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.
[mlir] Simplify DimOp::fold by using `getConstantIndex`(NFC) (#205343)
Refactor `DimOp::fold` in both memref and tensor dialects to use the
existing `getConstantIndex()` helper instead of manually extracting the
index via `IntegerAttr`.
[C++ Safe Buffers][libcxx][test] Add a test for hardened span in ObjC++
The C++ Safe Buffers project does not officially support ObjC++, while
people may still want to apply the analysis to ObjC++ code for
improved confidence. However, it would be meaningless to do so if
hardened containers do not trap out-of-bounds accesses. We need to add
a test that shows that hardened containers do work for ObjC++.
rdar://180461846
[flang][OpenMP] Fix ICE lowering user-defined operator declare reduction
A REDUCTION clause naming a user-defined operator (e.g.,
reduction(.myop.:x)) crashed in lowering: ReductionProcessor assumed the
DefinedOperator clause variant always held an intrinsic operator and called
std::get<IntrinsicOperator> unconditionally, which aborts for the
DefinedOpName alternative.
Handle DefinedOpName in the reduction clause processor, adding the
clause-side counterpart to the directive handling from #190288. For a
locally declared user-defined operator reduction, resolve the operator to
its reduction symbol and reference the omp.declare_reduction op materialized
for the declare reduction directive. The op name is now module-scoped via
AbstractConverter::mangleName, on the directive and clause sides in
lockstep, so reductions with the same operator spelling in different modules
no longer collide.
Cases that are not yet supported (reductions imported by USE association,
renamed or merged operators, and declarations with multiple types) now emit
[10 lines not shown]
[Github] Reenable prune-unused-branches workflow
The Github API has recovered and the previous failure mode has been
rectified by ensuring that branches are ready for deletion for seven
days rather than 24 hours.
Reviewers: cmtice
Reviewed By: cmtice
Pull Request: https://github.com/llvm/llvm-project/pull/205439
[Github] Make prune-unused-branches only delete branches after 7 days
To hopefully prevent the last failure mode that led to the job being
disabled where the GitHub API failed to return results for >24 hours.
Reviewers: cmtice
Pull Request: https://github.com/llvm/llvm-project/pull/205438
[Hexagon] Add HVX caller-save remark pass for call-site diagnostics (#189188)
Add a new MachineFunctionPass (HexagonHVXSaveRemark) that emits
optimization analysis remarks when HVX vector registers must be saved
and restored around function calls. All HVX registers are caller-saved
(Section 5.3 of the Hexagon ABI), so any HVX value live across a call
requires a save/restore pair on the stack. Each HVX vector is 64 or 128
bytes, making this overhead expensive.
The pass exits when remarks are not requested
(-Rpass-analysis=hexagon-hvx-save) or when HVX is not enabled. A byte
threshold (default 1024, tunable via -hexagon-hvx-save-threshold)
filters out functions with only a small number of saves. The remarks
help programmers identify call sites where inlining, hoisting, or
sinking could reduce the save/restore cost.
[lldb] Resolve dyld introspection SPIs with dlsym (NFC) (#205434)
HostInfoMacOSX's SharedCacheInfo used the dyld process-snapshot
introspection SPIs only when <mach-o/dyld_introspection.h> was present,
gating the calling code behind a compile-time macro.
To avoid bifurcating the behavior based on the SDK, rather than the
presence of the symbols, use dlsym to resolve them at runtime.
While here, fold the duplicate dlsym of dyld_image_segment_data_ into
the new, once-initialized, shared table.
Assisted-by: Claude
[COFF] Make ICF compare .pdata xdata references
ICF must not fold functions solely because their .text is identical when their unwind or EH information differs. On AMD64 and ARM64, .pdata records describe code ranges and point at the unwind data used for unwinding and EH dispatch, so different reachable .xdata gives otherwise identical functions different semantics.
Record live .pdata records by the code section they describe and compare those records during ICF, following .pdata relocations to compare referenced .xdata sections directly. This keeps folding valid when the reachable unwind data is equivalent, while preventing folds for object files where old MSVC compilers did not associate .xdata with the parent .text COMDAT.
Drop the post-ICF duplicate .pdata removal workaround, update the existing test expectations, and add an ARM64 variant covering the two-field .pdata form.
[dsymutil] Fix help message after #200971 (#203337)
The default DWARF linker is parallel after #200971. Fix help message
which still suggests classic DWARF linker.
[SandboxVec][Scheduler] Implement direction (#205193)
DGNode::UnscheduledPreds was added in a previous patch, so this patch
makes use of it in the scheduler. Depending on Dir we can now schedule
BottomUp or TopDown.
[flang][cuda] Materialize trivial computation to avoid data transfer error (#205422)
Avoid this error: `error: 'cuf.data_transfer' op expect src and dst to
be references or descriptors or src to be a constant: 'f32' -
'!fir.ref<f32>'`
Modified ExpressionAnalyzer::Analyze derived type check to use ultimate symbol, added a guard in IsEnumerationType to use ultimate, and added test cases for USE-associated enumeration types.
[MemoryBuiltins][NFC] Allow users to retrieve detailed (de)allocation info
There are some helpers to inspect a value or call but not all
information about the (de)allocation are made available outside of
MemoryBuiltins.cpp. The two new functions allow users a more in-depth
view of (de)allocations through a single API. To help with this, we now
read the alloc_align attribute to provide better alignment information
to users. alloc-family is used as well. Two new helpers provide argument
numbers, rather than values.
Co-authored-by: Antonio Frighetto <me at antoniofrighetto.com>