[llvm] [AMDGPU][SDAG] Support source modifiers on select integer operands (PR #147325)

Janek van Oirschot via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 04:21:04 PDT 2025


================
@@ -12175,6 +12176,71 @@ SDValue DAGCombiner::foldSelectToABD(SDValue LHS, SDValue RHS, SDValue True,
   return SDValue();
 }
 
+static SDValue getBitwiseToSrcModifierOp(SDValue N, SelectionDAG &DAG) {
+
+  unsigned Opc = N.getNode()->getOpcode();
+  if (Opc != ISD::AND && Opc != ISD::XOR && Opc != ISD::OR)
+    return SDValue();
+
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+
+  const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+  if (!TLI.shouldFoldSelectWithIdentityConstant(
+          N.getOpcode(), N->getValueType(0), ISD::SELECT, LHS, RHS))
----------------
JanekvO wrote:

```suggestion
          Opc, N->getValueType(0), ISD::SELECT, LHS, RHS))
```

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


More information about the llvm-commits mailing list