[llvm] [ConstantTime][LLVM] Add llvm.ct.select intrinsic with generic SelectionDAG lowering (PR #166702)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 15 13:39:03 PDT 2026
================
@@ -7579,6 +7579,23 @@ static Value *simplifyIntrinsic(CallBase *Call, ArrayRef<Value *> Args,
}
return nullptr;
}
+ case Intrinsic::ct_select: {
+ // Only fold on a literal IR-constant condition or identical arms; these
+ // are the only two folds LangRef permits for ct.select. Folding through
+ // ValueTracking-derived known bits would defeat the constant-time
+ // contract on conditions the user wants kept opaque.
+ Value *Cond = Args[0], *TrueVal = Args[1], *FalseVal = Args[2];
+ if (auto *CI = dyn_cast<ConstantInt>(Cond)) {
----------------
dtcxzyw wrote:
What is the benefit of this simplification, as the intrinsic cannot be DCEd?
https://github.com/llvm/llvm-project/pull/166702
More information about the llvm-commits
mailing list