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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 17:59:47 PDT 2025


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

@topperc Is there a non-obvious reason for this restriction?  It looks like you added this in the original commit that added this transform.  

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


More information about the llvm-commits mailing list