[Instrumentor] Support multiple runtime bitcodes (#216333)
Replace the runtime_bitcode string option with runtime_bitcodes, an
ordered list of runtime bitcode files. Each file is parsed and linked
into the instrumented module in list order, so a runtime can be split
into separate modules, e.g., shared state and callbacks, without merging
them into one file first.
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Establish clean baseline for implementation-in-namespace (#231639)
Scope libc/src/.clang-tidy down to llvmlibc-implementation-in-namespace
with WarningsAsErrors to establish a 100% green baseline.
Add NOLINT comments to replaceable global allocation functions in
new.cpp which must reside in the global namespace. Disable default
clang-analyzer checks in libc/.clang-tidy with a leading '-*'.
Assisted-by: Automated tooling, human reviewed.
[SCEV] Derive x >=s 0 from x <u y when y is non-negative
If x <u y and y <=u 2^(n-1) (e.g. y >=s 0), then x >=s 0.
Prove this in SCEV's isImpliedCondBalancedTypes so a guard
like "start <u len" proves start >=s 0. This also covers
x <=u y with y up to INT_MAX, which reaches the implication
code canonicalized as x <u y + 1.
The query is proven from the derived fact via
isImpliedCondOperands, so weaker bounds (x >=s c, c <= 0) follow
too.
y is checked via ranges only, to keep compile time low.
Co-Authored-By: Claude Sonnet 5.5 <noreply at anthropic.com>
[SCEV][NFC] Precommit tests for x <u y && y >=s 0 implying x >=s 0
SCEV derives x <s y from x <u y && y >=s 0, but not x >=s 0, so a loop
guarded by "start <u len" with a non-negative len does not prove
start >=s 0.
Add unit tests for isImpliedCond and the end-to-end guard queries, and
an IndVars lit test.
Checks SCEV cannot prove yet are marked FIXME.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Rename attribute and clean up qualifying set of instructions
"no-async" was based on an imprecise use of the word "async", which also
confused me during its implementation, so I also removed
unintentionally-added intrinsics from the set of intrinsics this
attribute checks for.
[SCEV] Derive x >=s 0 from x <u y when y is non-negative
If x <u y and y <=u 2^(n-1) (e.g. y >=s 0), then x >=s 0.
Prove this in SCEV's isImpliedCondBalancedTypes so a guard
like "start <u len" proves start >=s 0. This also covers
x <=u y with y up to INT_MAX, which reaches the implication
code canonicalized as x <u y + 1.
The query is proven from the derived fact via
isImpliedCondOperands, so weaker bounds (x >=s c, c <= 0) follow
too.
y is checked via ranges only, to keep compile time low.
Co-Authored-By: Claude Sonnet 5.5 <noreply at anthropic.com>
[clang][ssaf] Interpose ar in clang-ssaf-orchestrator-make (#231618)
Add an ar shim so that static libraries built by the project take part
in the analysis. It records the members of each archive it writes and
links their summaries with clang-ssaf-linker static-library create. In
the transformation pass it merges their edits, as the ld shim does for a
link.
The ld shim now takes archives as inputs, so a program linked against an
in-project library includes the translation units behind it.
Attributor: Only use anchor instruction effects for call site positions
AAMemoryBehavior initialized the known state of a position from the
mayReadFromMemory/mayWriteToMemory of its anchor instruction. This is
only correct when the anchor is the call. For a floating pointer value
defined by a load, the load does not write, but the pointer may still be
written through. AAInvariantLoadPointer then marked loads as invariant
that were clobbered in the same function, which miscompiled sqlite3 with
-attributor-enable=full.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR] Emit the frame-pointer function attribute and module flag (#230697)
CIR now honors -mframe-pointer= for the functions CIRGen emits, the way
classic CodeGen does. Functions and the module carry a new
#cir.frame_pointer attribute. On a function it lowers to the
"frame-pointer" function attribute, and on the module LowerToLLVM turns
it into the "frame-pointer" module flag, which LLVM gives to the
functions it creates later.
Assisted-by: Cursor / claude-opus-5.5
---------
Co-authored-by: Henrich Lauko <xlauko at mail.muni.cz>
[mlir][python] Handle rank-zero MemRefs in NumPy conversion (#231403)
I found this while testing MLIR's NumPy MemRef helpers in wasm32 and
wasm64 xeus-python kernels.(Basically while working on my RFC :
https://discourse.llvm.org/t/rfc-bringing-interactive-mlir-compilation-and-execution-to-webassembly/91566/3)
Rank-zero descriptors have no `shape` or `strides`, but
`ranked_memref_to_numpy()` accesses those fields and raises
`AttributeError`. Handle them as scalar NumPy views, preserving the
offset and shared storage.
The regression covers float32, float16 and complex64, including nonzero
offsets. Added a new file. Can club with the execution_engine.py tests
too if required.
[NVPTX] Set default value of nvptx-allow-ftz-atomics to false
This restores the strict FTZ default originally introduced in #200732
and temporarily relaxed in #206154.
Frontends can now explicitly opt in to native FTZ-mismatched atomics on a
per-instruction basis using !atomic.ignore.denormal.mode metadata (#217585,
#217586), which is supported in Clang, MLIR, and XLA. Users who need the
previous behavior globally can still pass -nvptx-allow-ftz-atomics=true.
Update test cases to verify the new default disallow behavior.
Attributor: Don't use callee return attributes for mismatched call types
A call site returned position took the state and attributes of the
callee's returned position, even if the call uses a different return type
than the callee, e.g. calling a void function as returning ptr. This
asserted in AANonNull::isImpliedByIR on the non-pointer callee return
type, and put the callee's nofpclass on calls returning another FP type.
Ignore the callee's returned position, and its returned arguments, if the
types differ.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>