[llvm] [SDAG] Handle insert_subvector in isKnownNeverNaN (PR #131989)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 19 04:11:04 PDT 2025


================
@@ -5727,6 +5730,9 @@ bool SelectionDAG::isKnownNeverNaN(SDValue Op, bool SNaN, unsigned Depth) const
   case ISD::EXTRACT_SUBVECTOR: {
     return isKnownNeverNaN(Op.getOperand(0), SNaN, Depth + 1);
   }
+  case ISD::INSERT_SUBVECTOR:
+    return isKnownNeverNaN(Op.getOperand(0), SNaN, Depth + 1) &&
+           isKnownNeverNaN(Op.getOperand(1), SNaN, Depth + 1);
----------------
RKSimon wrote:

You might need to consider adding DemandedElts handling to isKnownNeverNaN to correctly handle concatenation patterns:
```
insert_subvector(insert_subvector(undef,lo,0),hi,n/2)
```

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


More information about the llvm-commits mailing list