[GlobalISel] Fold bitcasts of constants in CSEMIRBuilder (#214588)
After moving to extended LLT, we've started seeing a pattern of
`G_BITCAST(G_CONSTANT ...)` and `G_BITCAST(G_FCONSTANT ...)` being
emitted due to float types now being distinct from integer types. This
prevented certain optimization from detecting constants and led to worse
results.
This patch folds this pattern in CSEMIRBuilder.
[libc] introduce hardening mode and add heap integrity check as example (#210373)
This PR originates from #205382.
Heap sanitization helps us to proactively detect UAF and DF. According
to the discussion in #205382, we separate this feature out from
hardening concerns.
Together in this patch:
1. We introduce `LIBC_HARDENING_MODE` similar to `libcxx`'s counterpart.
2. Introduce `_LIBC_ASSERT(COND, MSG)` as an always-on assertion macro
and forward original `LIBC_ASSERT` to it under debug mode.
Side note: I notice that LSB actually say that assert failure needs to
**abort** the program. We need to fix that. `abort` allows reentrancy
(recursive assertion failure) but current pure-header-library style
makes cyclic dependency unavoidable. This should be cleaned up later.
Opened as https://github.com/llvm/llvm-project/issues/211348.
Assisted-by: Gemini powered automation tools (human-in-the-loop).
[lldb] Extract type lookup by name from Itanium ABI (#212013)
This adds the `CommonABIRuntime` as a base for all C++ ABIs and moves
`LookupTypeByName` into it, so it can be reused.
[libsycl] Fix sycl-ls build on Windows (#214583)
`cl` seems to have exceptions enabled by default and works fine, but
`clang-cl` doesn't, so it errors about `try` being used even though
exceptions are disabled.
I found this trying to enable our Windows CI buildbot.
Signed-off-by: Nick Sarnie <nick.sarnie at intel.com>
[llvm-objcopy] Fix AMDGPU arch checks in tests
ELFObjectFile.h getArch() for EM_AMDGPU returns Triple::UnknownArch
when e_flags & EF_AMDGPU_MACH is 0 (no GPU target specified). Only
when a MACH flag in the AMDGCN range is present does it return
Triple::amdgpu.
- cross-arch-headers.test: restore EF_AMDGPU_MACH_AMDGCN_GFX900 flag
on the input ELF so that after format conversion the output correctly
reports Arch: amdgpu.
- binary-output-target.test: expect Arch: unknown since converting
from raw binary input (-I binary) produces an ELF with e_flags=0
(no MACH flags), giving UnknownArch. This is correct behavior.
[llvm-objcopy] Add elf64-amdgpu to supported formats in command guide
Update the llvm-objcopy command guide's "Supported formats" section to
include elf64-amdgpu, added in the preceding commit.
[llvm-objcopy] Address reviewer feedback on AMDGPU test cleanups
- Remove unused -DMACHINE yaml2obj template variable in cross-arch-headers.test,
hardcode Machine: EM_NONE directly in the YAML instead
- Remove unused Flags: [[FLAGS=<none>]] template variable in cross-arch-headers.test
- Add comment in binary-output-target.test explaining that Arch: unknown is
intentional when converting from binary (e_flags=0, no EF_AMDGPU_MACH set)
[llvm-objcopy] Fix AMDGPU arch string in test: amdgpu not amdgcn
llvm-readobj reports 'Arch: amdgpu' for EM_AMDGPU ELF files
(the generic AMDGPU ELF format used by elf64-amdgpu). The test
was incorrectly expecting 'amdgcn', which is the AMDGCN-specific
arch string used by ROCm HSA code objects.
[llvm-objcopy] Address review feedback for AMDGPU test in cross-arch-headers
Per reviewer feedback, use the existing non-AMDGPU input (%t.o, EM_NONE)
to test conversion to elf64-amdgpu. This properly demonstrates that
--output-format changes the machine type, consistent with all other cases
in this test file.
The output reports Arch: unknown because converting from a non-AMDGPU ELF
produces e_flags=0 (no EF_AMDGPU_MACH set); added a comment explaining
this. Flag control is a separate concern for a follow-on PR.
[llvm-objcopy] Add AMDGPU case to binary-output-target.test
Add test coverage for converting binary input to elf64-amdgpu format,
verifying the output has the correct format string, arch (amdgpu),
and machine type (EM_AMDGPU 0xE0). Follows the same pattern as all
other architectures in this test file.
[ConstantTime] Fix CT_SELECT expansion to preserve constant-time guarantees
Create CT_SELECT nodes for scalar types regardless of target support, so
they survive DAGCombiner (visitCT_SELECT is conservative). Expand to
AND/OR/XOR during operation legalization after SETCC is lowered, preventing
the sext(setcc)->select fold chain that converts constant-time patterns
into data-dependent conditional moves (e.g. movn/movz on MIPS).
The mask uses SUB(0, AND(Cond, 1)) instead of SIGN_EXTEND because type
legalization already promoted i1 to the SetCC result type, making
SIGN_EXTEND a no-op for same-width types.
[ConstantTime] Address reviewer feedback for llvm.ct.select core
Model llvm.ct.select as IntrInaccessibleMemOnly so the call stays pinned
without pessimizing alias analysis. Make CT_SELECT flagless (drop the
getCTSelect flags parameter, dead flag propagation, and
setFlags-after-getNode) and assert its condition is scalar. Blend the FP
memory fallback at the widest legal integer width with ext-load and
trunc-store tails instead of illegal i8 chunks. Restore the LangRef
section dropped in the rebase onto the Markdown docs migration and note
RISC-V Zkt/Zvkt. Apply review style fixes and regenerate affected tests.
[ConstantTime][LLVM] Add llvm.ct.select intrinsic with generic SelectionDAG lowering
[LLVM][CodeGen] Improve CTSELECT fallback lowering and target support modeling (#179395)
This pull request refactors and improves the **fallback handling** of
constant-time select (CTSELECT) in LLVM’s code generation
infrastructure. The changes clarify semantics, simplify
target-capability checks, and improve the correctness and
maintainability of fallback lowering, without changing the intended
constant-time guarantees.
- **CTSELECT semantics**
- Clarified documentation for the `CTSELECT` node to explicitly describe
its operands and its role as the lowering target for the constant-time
select intrinsic.
- **TargetLowering cleanup**
- Removed CTSELECT-specific entries from `SelectSupportKind`.
- Introduced a dedicated `isCtSelectSupported(EVT)` hook to cleanly
[23 lines not shown]
[libc] armv8m hard float build check (#214090)
Our premerge checks were testing the softfp build for armv8m. Adding
also a hard float ABI check for this target to increase build check
coverage.
Assisted-by: Gemini
[clang][OpenMP] Split OMPOrderedDirective into two classes
Now that OMPD_ordered has been replaced with two variants, split
the OMPOrderedDirective class into two classes, one for each
variant.
[lldb][minidump] Skip the new minidump tests on ARM (#214766)
Apparently, the new tests introduced by #212641 and #212861 use features
not supported on ARM.
Example:
```
FAIL: test_save_core_range_with_unreadable_tail_dwarf (TestProcessSaveCoreMinidumpPartialRead.ProcessSaveCoreMinidumpPartialReadTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../lldbtest.py", line 2171, in test_method
return attrvalue(self)
File ".../TestProcessSaveCoreMinidumpPartialRead.py", line 78, in test_save_core_range_with_unreadable_tail
self.assertSuccess(process.SaveCore(options))
File ".../lldbtest.py", line 3045, in assertSuccess
self.fail(self._formatMessage(msg, "'{}' is not success".format(error)))
AssertionError: 'architecture arm not supported.' is not success
Config=arm-/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang
```