[llvm] [SDAG] Make Select-with-Identity-Fold More Flexible; NFC (PR #136554)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 06:56:07 PDT 2025


================
@@ -3353,8 +3353,10 @@ class TargetLoweringBase {
   /// Return true if pulling a binary operation into a select with an identity
   /// constant is profitable. This is the inverse of an IR transform.
   /// Example: X + (Cond ? Y : 0) --> Cond ? (X + Y) : X
-  virtual bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode,
-                                                    EVT VT) const {
+  virtual bool
+  shouldFoldSelectWithIdentityConstant(unsigned BinOpcode, EVT VT,
+                                       unsigned SelectOpcode, SDValue X,
+                                       SDValue NonIdConstNode) const {
----------------
RKSimon wrote:

NonIdConstNode -> Y to match example in comment?

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


More information about the llvm-commits mailing list