[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
Tue Sep 8 06:53:33 PDT 2026


================
@@ -5694,8 +5878,13 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
     // Promote each of the values to the new type.
     Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1));
     Tmp3 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(2));
-    // Perform the larger operation, then round down.
-    Tmp1 = DAG.getSelect(dl, NVT, Tmp1, Tmp2, Tmp3);
+    // Perform the larger operation, then round down. CT_SELECT carries no
+    // SDNodeFlags (see ISDOpcodes.h); rebuild it through the helper.
+    if (Node->getOpcode() == ISD::CT_SELECT)
+      Tmp1 = DAG.getCTSelect(dl, NVT, Tmp1, Tmp2, Tmp3);
+    else
+      Tmp1 =
----------------
wizardengineer wrote:

Fixed with a temporary. Braces alone did not help, clang-format still wanted the wrap after the assignment.

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


More information about the llvm-commits mailing list