[llvm] [RISCV] Allow constants in tryFoldSelectIntoOp (PR #157376)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 12:55:52 PDT 2025


================
@@ -18838,7 +18838,7 @@ static SDValue tryFoldSelectIntoOp(SDNode *N, SelectionDAG &DAG,
     break;
   }
 
-  if (!TrueVal.hasOneUse() || isa<ConstantSDNode>(FalseVal))
+  if (!TrueVal.hasOneUse())
----------------
topperc wrote:

I don't recall. I might have done it because InstCombine doesn't do it for constants. I think InstCombine's motivation for the transform is to reduce the number of uses of Y, but that doesn't matter for constants.

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


More information about the llvm-commits mailing list