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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 16:14:37 PDT 2025


================
@@ -0,0 +1,90 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes=instsimplify,verify -disable-verify -S | FileCheck %s
----------------
topperc wrote:

insert_value and extract_value both say something like

```
Elements idx through (idx + num_elements(subvec) - 1) must be valid vec indices. If this condition cannot be determined statically but is false at runtime, then the result vector is a [poison value](https://llvm.org/docs/LangRef.html#poisonvalues).
```

The only case it cannot be determined statically would be for extracting a fixed vector from a scalable vector or inserting a fixed vector into a scalable vector. For all other cases the indices must be in bounds.

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


More information about the llvm-commits mailing list