[Mlir-commits] [mlir] [mlir][vector]advance support extract insert under dynamic case. (PR #121631)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Mon Jan 6 06:56:48 PST 2025
================
@@ -1096,6 +1096,26 @@ class VectorExtractOpConversion
SmallVector<OpFoldResult> positionVec = getMixedValues(
adaptor.getStaticPosition(), adaptor.getDynamicPosition(), rewriter);
+ for (unsigned idx = 0; idx < positionVec.size(); ++idx) {
+ if (auto position = llvm::dyn_cast<Value>(positionVec[idx])) {
+ auto defOp = position.getDefiningOp();
+ while (defOp) {
+ if (llvm::isa<arith::ConstantOp, LLVM::ConstantOp>(defOp)) {
+ Attribute value =
+ defOp->getAttr(arith::ConstantOp::getAttributeNames()[0]);
+ positionVec[idx] = OpFoldResult{
+ rewriter.getI64IntegerAttr(cast<IntegerAttr>(value).getInt())};
----------------
ftynse wrote:
`value` is already an `IntegerAttr`. There is no need to extract its integer value only to construct yet another integer attribute. However, `value` _may not_ hold a 64-bit value, which could lead to tricky bit-level issues. This piece should additionally check for the `value` containing exactly a 64-bit integer.
https://github.com/llvm/llvm-project/pull/121631
More information about the Mlir-commits
mailing list