[llvm] [ConstantFolding] Add folding for [de]interleave2, insert and extract (PR #141301)

Nikolay Panchenko via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 11:58:27 PDT 2025


================
@@ -3872,6 +3947,22 @@ ConstantFoldStructCall(StringRef Name, Intrinsic::ID IntrinsicID,
       return nullptr;
     return ConstantStruct::get(StTy, SinResult, CosResult);
   }
+  case Intrinsic::vector_deinterleave2: {
+    auto *Vec = dyn_cast<Constant>(Operands[0]);
+    if (!Vec)
+      return nullptr;
+
+    unsigned NumElements =
+        cast<VectorType>(Vec->getType())->getElementCount().getKnownMinValue() /
----------------
npanchen wrote:

This is `ConstantFoldStructCall` function, that is invoked when structure is returned. Here scalable vector operands and results could exist.


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


More information about the llvm-commits mailing list