[Instrumentor] Add support for modules and globals
We can emit callbacks when a module is loaded/unloaded and before
globals are initialized. Both happens in newly introduced constructors
and destructors.
[Windows][test] Fix "LLVM" test failures when LLVM_WINDOWS_PREFER_FORWARD_SLASH is ON (#184556)
This patch fixes several LLVM test failures on Windows that occur when
the LLVM_WINDOWS_PREFER_FORWARD_SLASH CMake option is enabled.
The failures were caused by tests either hardcoding backslash
expectations in FileCheck or constructing paths with strict backslashes
in C++ unit tests, both of which break when the environment is
configured to prefer forward slashes.
Specific changes:
- `llvm-cov` lit tests: Changed the path separators with
`-DSEP=%{fs-sep}`.
- `llvm-objdump` lit test: Relaxed
`source-interleave-prefix-windows.test` to accept either forward or
backward slashes using the `{{[/\\]}}` regex. This makes the path
matching resilient to the underlying separator preference without losing
precision.
- CommandLineTest.cpp: Conditionalized the TestRoot variable to use
[5 lines not shown]
[Instrumentor] Add a property filter for static properties
The user can define static filters in the json to limit instrumentation
to opportunities that match the static expression, e.g., is_volatile==1.
The matcher logic is pretty basic for now. Integer comparisons, pointer
null checks, string equalities and startswith are supported.
The commit was prepared with Claude (AI) and modified/tested by me.
[llvm] Add a tablegen !sort operator (#197303)
This operator creates a new ``list`` containing the same elements as
*list*
but in sorted order. To determine the order, TableGen binds the variable
*var* to each element and evaluates the *key* expression, which
presumably
refers to *var*. The key must produce a ``string`` or integer value
(``bit``, ``bits``, or ``int``); all keys must be of the same type.
Elements
with equal keys preserve their original relative order, resulting in a
stable
sort.
For example, to sort a list of records by their ``Name`` field::
` list<Thing> sorted = !sort(t, Things, t.Name);`
[Offload] Make 'llvm-offload-binary' use multi-binaries (#197456)
Summary:
There's two ways you can put multiple binaries in the section. Either
use the version two multi-binary support or just concatenate them. This
PR changes the llvm-offload-binary tool to use the multi-support rather
than directly concatenating them.
The motivation for this is to save space and make it easier to support
compression in the future. Compression would be a flag in the header and
the compression is only really valuable if it can combine the
architecture variants. ELF section compression is a little spotty but
would be another good solution.
[lldb] Support building test inferiors without debug info (#197002)
Add first class support for building test inferiors without debug info,
instead of having to pass `-g0` in the Makefile or the build dictionary.
```
def test(self):
self.build(debug_info="none")
```
rdar://164923931
[AMDGPU] Validate forced lit() immediate
Right now it takes validation path of an inline constant if fits
even though it is forced to literal encoding.
[clang-sycl-linker] Migrate tests from Driver/ to Tooling/ and use LLVM IR input (#197566)
1. Replace the C++ source test that required compiling with %clangxx and
separate Input files with self-contained .ll tests using split-file.
2. Split the test into two files:
- clang-sycl-linker.ll: basic tool behavior (link, dev libs, AOT,
errors)
- clang-sycl-linker-split-mode.ll: device code split mode handling
Co-Authored-By: Claude
[clang] NFC: add asserts enforcing template parameters have valid positions
Some tests are violating these assertions, so they are commented out.
Most of these are alias CTAD tests, with a couple of lambda in concepts tests on
top of that.
For the test in `clang/test/SemaTemplate/concepts.cpp`, that was broken by #195995
and needs a partial revert at least.
[scudo] Add test for initFlags()
Add a test case to verify that initFlags() correctly reads the
SCUDO_ALLOCATION_RING_BUFFER_SIZE environment variable and updates the
corresponding flag. This increases line coverage for flags.cpp to 100%.
[clang-format] Handle more Verilog attributes (#196455)
before
```SystemVerilog
(* x = "x" *) foreach(x[x]) x = x;
```
after
```SystemVerilog
(* x = "x" *) foreach (x[x])
x = x;
```
The code for handling statements like the `foreach` preceded the part
for handling the attributes inside `(* *)`. So there was a problem with
some of the statements following attributes. The patch moves the part
for the statements down. The loop in the code was also unnecessary.
[compiler-rt][cmake] Fix check_cxx_compiler_flag calls (#197529)
check_cxx_compiler_flag, when passing multiple flags, we must separate
them using a SEMICOLON-separated list. Not spaces. These checks
succeed incorrectly sometimes because "-Werror -mcrc" has a different
return value than "-Werror" "-mcrc" on some systems.
This issue was verified with LLVM_ENABLE_PROJECTS=llvm;compiler-rt,
and I'm uncertain whether it exists in runtime CMake builds.
Nonetheless, it's still a bug.
See:
https://cmake.org/cmake/help/latest/module/CheckCXXCompilerFlag.html
This issue was identified downstream in ChromiumOS.
ChromiumOS Bug:
https://issuetracker.google.com/507177988
Improve the executable name detection in ELF core files. (#197341)
A previous commit switched us to use the value of the AT_EXECFN, which
is an entry in the aux vector, as the executable path. As it turns out,
if a symlink is used to launch a program, the symlink path will be in
the AT_EXECFN string in core file memory. The PRPSINFO also contains a
basename of the program, and it will also be the symlink basename. The
best source of information to figure out the executable name is from the
NT_FILE note. This always has the resolved path to the executable.
Now the executable name is found in a reliable way starting with finding
the NT_FILE entry for the main executable. This can reliably be done by
finding the NT_FILE entry whose address contains the AT_PHDR aux vector
value. This value is the address of the program headers for the main
executable. If there is no NT_FILE entry we can find, we fall back to
the AT_EXECFN entry from memory and then fallback to the basename in the
PRPSINFO. This patch also creates a placeholder as the main executable
when the executable can't be found to ensure users can see which
executable they will need to track down in order to load the core file.
[8 lines not shown]
[Instrumentor][NFC] Add docs and config-wizard script (#197066)
This commit adds initial documentation for the instrumentor to the
html/man pages and provides a script that helps new users to setup the
config and stubs file interactively.
The script and docs have been created with Claude (AI) but
proofread/tested and modified afterwards.
[AMDGPU] Validate forced lit() immediate
Right now it takes validation path of an inline constant if fits
even though it is forced to literal encoding.
[LSV] Handle or-disjoint as an add-like operation for vectorization. (#197243)
LoadStoreVectorizer can safely handle `or disjoint` instructions as
`add nuw nsw`, when they are used for offset computations. This patch
enables vectorization of such patterns.
Assisted-by: Claude Opus 4.6 <noreply at anthropic.com>