[llvm] [ConstantTime][LLVM] Add llvm.ct.select intrinsic with generic SelectionDAG lowering (PR #166702)
Julius Alexandre via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 6 12:57:45 PST 2025
wizardengineer wrote:
> Is there a guarantee in SelectionDAG that bitwise operations will never turned back into a select?
@topperc Are you asking if there's any guarantee that SelectionDAG won't fold the bitwise operations back into a SELECT node?
If so, we use DAG chaining to create artificial dependencies between the instructions. This prevents later optimization
passes (in SelectionDAG or beyond) from reordering or combining these operations in ways that could break the
constant-time guarantee. The dependencies ensure the bitwise pattern remains intact and isn't recognized/transformed
back into conditional behavior.
Have you seen cases where this might not be sufficient or are there specific optimization passes we should be
concerned about?
https://github.com/llvm/llvm-project/pull/166702
More information about the llvm-commits
mailing list