[llvm] [DAG] Constant Folding for U/SMUL_LOHI (PR #69437)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 02:11:40 PDT 2023


================
@@ -9879,6 +9879,27 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
            VTList.VTs[0] == Ops[0].getValueType() &&
            VTList.VTs[0] == Ops[1].getValueType() &&
            "Binary operator types must match!");
+    // Constant fold.
+    ConstantSDNode* LHS = dyn_cast<ConstantSDNode>(Ops[0]);
+    ConstantSDNode* RHS = dyn_cast<ConstantSDNode>(Ops[1]);
+    if(LHS && RHS) {
----------------
jayfoad wrote:

clang-format is not gonna like this :)

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


More information about the llvm-commits mailing list