[llvm] [IR] Add new CreateVectorInterleave interface and constant fold (PR #150931)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 28 08:00:22 PDT 2025


================
@@ -189,6 +189,24 @@ class LLVM_ABI TargetFolder final : public IRBuilderFolder {
     return nullptr;
   }
 
+  Value *FoldVectorInterleave(ArrayRef<Value *> Ops) const override {
----------------
david-arm wrote:

I don't think we can do that because llvm/include/llvm/IR/ConstantFolder.h only includes llvm/IR/ConstantFold.h, whereas I *think* what you're talking about is trying to reuse an intrinsic folding function in the Analysis directory.

I'll abandon the constant folds for now, because if I only add support in the TargetFolder the only way I could test it is via unit tests, since both the loop vectoriser and the complex interleaving pass use the default IRBuilder, which uses ConstantFolder. I care more about adding the CreateVectorInterleave interface - I just saw an opportunity to tidy up the IR but it turns out to be far too complicated to do all in one patch.

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


More information about the llvm-commits mailing list