[all-commits] [llvm/llvm-project] bfbd19: [mlir] Replace `llvm::OwningArrayRef` with `std::v...

David Stone via All-commits all-commits at lists.llvm.org
Thu Nov 20 10:23:33 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bfbd191f35352df2decde46d117bb940864889bf
      https://github.com/llvm/llvm-project/commit/bfbd191f35352df2decde46d117bb940864889bf
  Author: David Stone <davidfromonline at gmail.com>
  Date:   2025-11-20 (Thu, 20 Nov 2025)

  Changed paths:
    M mlir/include/mlir/IR/PDLPatternMatch.h.inc
    M mlir/lib/Rewrite/ByteCode.cpp
    M mlir/lib/Rewrite/ByteCode.h

  Log Message:
  -----------
  [mlir] Replace `llvm::OwningArrayRef` with `std::vector` (#168803)

There are several places where we use `llvm::OwningArrayRef`. The
interface to this requires us to first construct temporary storage, then
allocate space and set the allocated memory to 0, then copy the values
we actually want into that memory, then move the array into place.
Instead we can just do it all inline in a single pass by using
`std::vector`. In one case we actually allocate a completely separate
container and then allocate + copy the data over because
`llvm::OwningArrayRef` does not (and can't) support `push_back`.

Note that `llvm::SmallVector` is not a suitable replacement here because
we rely on reference stability on move construction: when the outer
container reallocates, we need the the contents of the inner containers
to be fixed in memory, and `llvm::SmallVector` does not give us that
guarantee.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list