[CodeGenPrepare][X86] Add tests for sinking GEPs (#242745)
Pre-commit tests for sinking the GEPs computing the address of a
gather/scatter into its block.
This is a preparation for the PR that addresses FIXME in CodegenPrepare.
(https://github.com/llvm/llvm-project/pull/242746)
[clang-tidy] Fix SARIF test missing '--' (#244927)
[clang-tidy] Fix SARIF test missing '--'
export-SARIF-diagnostics-macro-thread-flows.cpp was missing a "--" that
caused this test to fail.
Co-authored-by: Jones, Matthew (DI SW SIM FRWK PLAT SIMFW HPC) <jones.matthew at siemens.com>
[CMake] Update regex to match typed arguments (#244963)
The regex used to match arguments in the cross-compiling case didn't
account for types and would fail to match.
[CMake] Fix variable name shadowing (#244962)
The append_passthrough_options macro has an argument named type, but it
also reads the property into the variable of the same name. Because
CMake macros perform textual substitution of the ${type} argument before
dereferencing the ${type} variable, passthrough options are emitted as
-DCMAKE_CXX_FLAGS:RUNTIMES=... instead of -DCMAKE_CXX_FLAGS:STRING=...
Attributor: Don't report a change when no functions are internalized
internalizeFunctions returned true for an empty set, so this reported
a change for every module and invalidated all function analyses even
when it did nothing.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
PHIElim: Trim PHI source subranges without a full shrinkToUses (#228488)
This contains a repurposed version of #226209, plus a supplemental fix
branch which was never posted. #228073 was an alternative implementation which
landed first; this replaces the brute-force shrinkToUses with targeted live range
adjustments. Some crude stress test benchmarking suggests this is 2-4x
faster measuring the pass in isolation.
shrinkToUses rescans every use of each subrange which is much more than is
necessary. The only segments that need changing are the ones ending at the
inserted phi source copies. Instead, track the per-lane copies as they are inserted
and trim each lane at its last read, clamped to the predecessor block, and stop
SplitCriticalEdge from extending subranges for lanes the PHI does not read. This
keeps the live ranges correct while avoiding the per-subrange rescans. The
shrinkToUses implementation's cost scales with the number of uses, but this remains
relatively flat. An example with 640 uses is 7.2x faster.
Because this edits segments surgically instead of recomputing them, it has to get the
bounds exactly right in cases shrinkToUses handles. The clamp to the predecessor
[14 lines not shown]
[lldb] Intern remaining SB API strings in the right pool (#244422)
Strings returned straight from a ConstString now go through the system
pool, or the owning debugger's pool. Only the strings that live in the
object itself (such as SBError, SBCommandReturnObject) and static
literals are left as they are.
SBDebugger::GetVersionString continues to use the global pool because it
can be called before SBDebugger::Initialize.
Assisted-by: Claude
[libc] Add strcmp benchmark
To guide some optimization work around implementing an optimized strcmp
implementation.
Assisted-By: LLM
Reviewers: petrhosek
Pull Request: https://github.com/llvm/llvm-project/pull/244924
[libc] Add a benchmark for strlen
Add a benchmark for strlen to guide optimization efforts.
Just reuse the SearchSetup that memchr uses by making it put a \0 at the
end.
Reviewers: petrhosek
Pull Request: https://github.com/llvm/llvm-project/pull/244923
OpenMPOpt: Invalidate function analyses individually
Avoid discarding analyses that never need to be invalidated, such as
TargetLibraryInfo.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Fix dangling paths in line_reader_test (#244912)
Kept the CString returned by libc_make_test_file_path alive instead of
storing a pointer to its temporary string. The dangling pointers caused
intermittent failures when opening the test files.
Assisted-by: Gemini
[Clang] Check address space overlap for C-style casts to references
In OpenCL and SYCL, `TryAddressSpaceCast` rejects a pointer cast between
two address spaces that don't overlap, but a C-style cast to a reference
is not checked (there is a FIXME for it). As a result,
`(__local int &)global_var` is accepted and we emit an `addrspacecast`.
This PR checks such reference casts in the same way. We only check the
case where the reference binds to the operand directly, i.e. the two
types are related. Other casts to a reference are not affected.
This PR was assisted by AI but I reviewed all the changes.
[clang][CIR] Add tests for SVE RINTA intrinsics (#240756)
adds CIR tests for svrinta (plain SVE) intrinsics.
Moves and adapts `sve-intrinsics/acle_sve_rinta.c` to `sve/rinta.c`
Part of #223963
[clang][CIR] Add tests for SVE RINTM intrinsics (#240758)
adds CIR tests for svrintm (plain SVE) intrinsics.
Moves and adapts `sve-intrinsics/acle_sve_rintm.c` to `sve/rintm.c`
Part of #223963
[CIR] Load return values before cleanups that can change them (#244202)
When FlattenCFG routes a `cir.return` through a cleanup, it sinks the
load feeding the return past the cleanup. If the cleanup stores to the
slot, ends its lifetime, or calls something holding its address, the
function returns the post-cleanup value.
Sink the load only when the slot provably can't change: its address does
not escape and nothing after the load or in the cleanup uses it.
Otherwise spill it through the existing return-operand temporary, as
volatile and atomic loads already are. Under NRVO, where return slot
escapes, the value is now read before the cleanups, which is also valid.
Fixing this issue unblocks more usage of mem2reg in CIR.
[LV] Add tests for reusing IR values with poison-generating flags (NFC) (#244948)
Add a test where computing an exit value via SCEV while building VPlans
reuses an 'add nsw' in the preheader, which drops its nsw flag, even
though vectorization is not profitable and the plans are discarded.
Also add a test where only the epilogue vector loop uses a strided
access, whose start reuses a 'getelementptr inbounds' that requires
dropping its inbounds flag.