[mlir][LLVM] Mark matrix.multiply and matrix.transpose as Pure (#247388)
The LLVM intrinsics llvm.matrix.multiply and llvm.matrix.transpose are
declared with IntrNoMem and IntrSpeculatable in Intrinsics.td, but the
corresponding LLVM dialect ops were defined without any side-effect
traits. As a result, MLIR treated them as having unknown memory effects,
and passes like CSE could not eliminate duplicate instances.
Add the Pure trait to LLVM_MatrixMultiplyOp and LLVM_MatrixTransposeOp
to match the LLVM intrinsic properties, consistent with other
side-effect-free intrinsics in LLVMIntrinsicOps.td.
Fixes #247055
[scudo] Avoid deadlock when reporting map errors on glibc (#246746)
The map, unmap and protect error reports call strerror(). On glibc,
strerror() translates the message through gettext, which calls malloc().
If the error is reported while scudo holds its own locks, that malloc()
re-enters the allocator and deadlocks.
This happens when the initial reservation of the primary fails, e.g.
under a low RLIMIT_AS: the thread already holds the TSD registry mutex,
so the process hangs instead of printing the error and aborting.
On glibc >= 2.32, use strerrordesc_np() instead. It is documented as
async-signal-safe and returns the untranslated message. Other C
libraries keep using strerror(); musl and bionic don't allocate in it.
The mincore() failure message gets the same treatment.
Add a regression test that reports a map error while the allocator is
disabled with malloc_disable().
[libc][test] Add stream printers, Types, and file paths to GTest.h (#247346)
Bring libc/test/UnitTest/GTest.h up to parity with LibcTest.h for
building llvm-libc unit tests against GoogleTest:
- Include TestFilePath.h so libc_make_test_file_path dispatches to
libc_make_test_file_path_func (matching LibcTest.h, where tests using
it link CmakeFilePath.cpp or BazelFilePath.cpp rather than falling
back to Test.h's bare-filename macro), and include TestLogger.h for
LIBC_NAMESPACE::testing::tlog.
- Re-export ::testing::Types into LIBC_NAMESPACE::testing for typed
test suites.
- Provide ::std::ostream operator<< overloads for cpp::string_view,
cpp::string, and BigInt, plus ADL PrintTo overloads for
cpp::string_view and cpp::string so GoogleTest prints them as strings
rather than character containers.
- Undefine the XSI isascii and toascii macros that system <ctype.h> may
leak transitively through <gtest/gtest.h> and <ostream> and collide
with qualified LIBC_NAMESPACE::isascii and LIBC_NAMESPACE::toascii
[6 lines not shown]
[GlobalISel] Use source known bits in G_ASSERT_ALIGN (#246927)
Compute the source's known bits before setting the low zero bits from
the alignment.
Assisted-by: Claude Opus 5.5
[clang-doc][test] Avoid compdb lookups in clang-doc tests (#247381)
In #247006, it was pointed out that our tests are searching the build
dir and picking up the local compdb. This breaks w/ PCH enabled builds,
as the compiler has been modified.
Instead of passing `--` to every test, follow the clangd example and use
an empty compile_flags.txt file generated by the build, and a checked in
file for our test dir. This means we won't silently regress, when
someone forgets to suffix `--` on a RUN line, and tests that pass
specific combdb params will work per normal.
[M68k] ExpandMOVI - remove ambiguous cast (#245011)
MSVC fails to determine how to cast from the MachineInstrBuilder to a
MachineBasicBlock::iterator.
Since this is only used for a debugging message I've removed the code to
fix the build, but we can tweak the code (get buildClearRegister to
return the last created MachineInstr?) if necessary.
[RISCV][GlobalISel] Use Zfa fli for floating-point constants (#246564)
G_FCONSTANT always built the value in a GPR and moved it with fmv, so
even 1.0 took two instructions and f64 on RV32 went through the stack.
Select fli when Zfa can encode the constant, using fli + fneg for the
negative values that are not in the table, matching SelectionDAG.
[AMDGPU][NFC] Make getRegisterPressures a static helper
getRegisterPressures no longer uses any members of GCNSchedStrategy, so
make it a static helper in GCNSchedStrategy.cpp.
Co-authored-by: Cursor <cursoragent at cursor.com>
[Clang][AMDGPU] Remove redundant isAMDGCN checks. NFC
After the r600 target removal, AMDGPUTargetInfo is only created for
the amdgcn triple, so every `isAMDGCN()` check in it is always true.
Drop those checks and the helpers that only wrapped them.
```
if (hasFMAF())
Builder.defineMacro("__HAS_FMAF__");
-->
Builder.defineMacro("__HAS_FMAF__");
```
RFC: https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840
[Clang][AMDGPU] Remove R600 target support (#246817)
Remove the r600 triple from the clang frontend, driver and CodeGen,
together with the `__R600__` macro and the `__builtin_r600_*` builtins.
AMDGPUTargetInfo now only handles amdgcn, so the R600 branches are gone.
```
$ clang --target=r600 -S test.cl
error: unknown target triple 'r600'
```
RFC: https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840
[AMDGPU][NFC] Make CandUnifiedVGPRPressure a local in initCandidate
CandUnifiedVGPRPressure is now only set and read in initCandidate, so
make it a local there and remove the member.
Co-authored-by: Cursor <cursoragent at cursor.com>
[Bazel] Fix libc build after dfd4bf2 (#247379)
This introduced a new header that the bazel build didn't know about. Add
it to the BUILD files to get the build working again.
[AMDGPU] Use a disjoint scope domain for merged LDS structs
When lowering LDS values, all the values are mutually disjoint, so we
can use the newly-added disjoint scopes feature to simplify the IR.
AI disclosure: Claude wrote this and I reviewed it and wrote the
commit message
[mlir][LLVM] Use a disjoint scope domain when inlining noalias
This matches recent changes to the LLVM inliner.
AI disclosure: Claude wrote the code, I wrote the commit message and
have done initial review.
[mlir][LLVM] Add disjointScopes to AliasScopeDomainAttr (#218772)
This also updates the MLIR-side inliner to clone disjoint domains
while cloning alias scopes, matching changes to LLVM.
AI disclosure: Claude wrote the code, I wrote the commit message and
looked at the code.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
[asan] Use FastCheckForUnpoisonedRegion in __asan_loadN/__asan_storeN (#247039)
Add an inline `FastCheckForUnpoisonedRegion` fast path with early
returns to `__asan_loadN`, `__asan_storeN`, their `_exp`/`_noabort`
variants, and `__asan_report_assume_dereferenceable{,_noabort}` before
falling back to `__asan_region_is_poisoned`. This matches
`ACCESS_MEMORY_RANGE` and avoids the out-of-line
`__asan_region_is_poisoned` call for common small unpoisoned accesses.
Affects builds with "-fsanitize-address-outline-instrumentation".
Improves performance of clang built with Asan by up to 10%.
I see similar improvement on test-suite.
Assisted-by: Gemini