[all-commits] [llvm/llvm-project] 333219: [LLVM][CodeGen] Improve CTSELECT fallback lowerin...

Akshay K via All-commits all-commits at lists.llvm.org
Tue Feb 10 06:43:58 PST 2026


  Branch: refs/heads/users/wizardengineer/ct-select-core
  Home:   https://github.com/llvm/llvm-project
  Commit: 3332192f36520a7a76c86343f2c65e40a7abb59e
      https://github.com/llvm/llvm-project/commit/3332192f36520a7a76c86343f2c65e40a7abb59e
  Author: Akshay K <iit.akshay at gmail.com>
  Date:   2026-02-10 (Tue, 10 Feb 2026)

  Changed paths:
    M llvm/include/llvm/CodeGen/ISDOpcodes.h
    M llvm/include/llvm/CodeGen/SelectionDAGNodes.h
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/include/llvm/IR/Intrinsics.td
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.h
    M llvm/lib/Target/ARM/ARMISelLowering.h
    M llvm/lib/Target/X86/X86ISelLowering.h

  Log Message:
  -----------
  [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.

### Summary of Changes

- **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
separate ISA select support from constant-time guarantees.
  - Updated intrinsic lowering to use this new capability check.

- **Fallback implementation improvements**
- Updated the generic SelectionDAG fallback lowering to use the
canonical bitwise formulation:
    ```
    F ^ ((T ^ F) & Mask)
    ```
- Simplified handling of vector splats and bitcasting in the fallback
path.

- **DAGCombiner refactor**
- Renamed and clarified CTSELECT-related DAGCombiner code paths for
improved readability.

- **Miscellaneous cleanups**
  - Improved documentation headers for constant-time intrinsics.
  - Removed unused flags and minor nits uncovered during review.

These changes primarily affect the **generic fallback path** used when
targets do not provide specialized CTSELECT lowering. Target-specific
implementations are handled in follow-up PRs



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list