[all-commits] [llvm/llvm-project] f4b39b: [LLVM][ConstantTime] Strengthen constant-time hand...

Akshay K via All-commits all-commits at lists.llvm.org
Wed Feb 11 11:08:58 PST 2026


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

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAGNodes.h
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/RISCV/ctselect-fallback.ll
    M llvm/test/CodeGen/X86/ctselect.ll

  Log Message:
  -----------
  [LLVM][ConstantTime] Strengthen constant-time handling of CTSELECT in DAG combine and legalization (#180883)

This PR improves the handling of CTSELECT in SelectionDAG to strengthen
constant-time guarantees and ensure correctness during DAG combining and
type legalization.

Key changes:

- Introduce a dedicated visitConstantTimeSelect routine that performs
only CT-safe optimizations (e.g., negated condition canonicalization and
i1 AND/OR nesting merges) while avoiding unsafe generic rewrites.
- Remove aggressive generic combinations that could violate
constant-time intent.
- Add specialized type legalization routines (SplitRes_CTSELECT,
PromoteFloatRes_CTSELECT, SoftPromoteHalfRes_CTSELECT) to preserve
constant-time semantics during result splitting and promotion.
- Handling of vector expansion with constant-time bitwise blend
lowering.
- Remove redundant X86/RISCV tests and add vector coverage while
maintaining critical code path validation.

These changes improve correctness, maintainability, and the end-to-end
constant-time behavior of the fallback implementation across the
optimization and legalization stages.



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