llvm-project
cea17086 - [ConstantTime] Fix CT_SELECT expansion to preserve constant-time guarantees

Commit
48 days ago
[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.
Parents
Loading