[Mlir-commits] [mlir] [mlir][vector]add foldConstantOp fold function and apply it to extractOp and insertOp. (PR #124399)

lonely eagle llvmlistbot at llvm.org
Tue Jan 28 01:00:24 PST 2025


linuxlonelyeagle wrote:

I have a question I'd like to ask. This doesn't seem to successfully fold, am I doing something wrong, it should instantiate a position op instead. Thank you.
```
static OpFoldResult extractInsertFoldPoison(ExtractOp op) {
   if (llvm::is_contained(op.getStaticPosition(), ExtractOp::kPoisonIndex)) {
    return ub::PoisonAttr::get(op.getContext());
   }
   return {};
}

...

  if (auto val = extractInsertFoldPoison(*this))
    return val;
```

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


More information about the Mlir-commits mailing list