[llvm] [ConstantTime][LLVM] Add llvm.ct.select intrinsic with generic SelectionDAG lowering (PR #166702)

Simon Tatham via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 01:15:51 PST 2026


statham-arm wrote:

> I believe volatile and atomic are first-class semantic properties defined in LLVM IR and preserved through DAG and Machine IR, which is why they cannot be dropped. Making secret a similar semantic instruction property could potentially avoid the issues associated with metadata-based approaches.

I'm _not_ seriously suggesting this, but just so it's been mentioned and we can marvel at how impractical it is ...

If metadata is allowed to be thrown away on whim, then a rigorous way to implement constant-time marking with metadata is if the metadata has the opposite sense – it represents _not_ being secret. Almost everything in every LLVM IR program would acquire a metadata attribute saying "it's ok, this doesn't need to be constant-time", except the insides of cryptography kernels. Then dropping the attribute would fail safe, and lead to only a performance problem :slightly_smiling_face: 

https://github.com/llvm/llvm-project/pull/166702


More information about the llvm-commits mailing list