[Mlir-commits] [mlir] [mlir][vector] Prevent folding of OOB values in insert/extract (PR #135498)
Mehdi Amini
llvmlistbot at llvm.org
Thu Apr 17 01:30:20 PDT 2025
================
@@ -1996,6 +1996,12 @@ static Value extractInsertFoldConstantOp(OpType op, AdaptorType adaptor,
std::vector<int64_t> staticPosition = op.getStaticPosition().vec();
OperandRange dynamicPosition = op.getDynamicPosition();
ArrayRef<Attribute> dynamicPositionAttr = adaptor.getDynamicPosition();
+ ArrayRef<int64_t> vectorShape;
+ if constexpr (std::is_same_v<OpType, ExtractOp>) {
+ vectorShape = op.getSourceVectorType().getShape();
+ } else {
+ vectorShape = op.getDestVectorType().getShape();
+ }
----------------
joker-eph wrote:
```suggestion
if constexpr (std::is_same_v<OpType, ExtractOp>)
vectorShape = op.getSourceVectorType().getShape();
else
vectorShape = op.getDestVectorType().getShape();
```
https://github.com/llvm/llvm-project/pull/135498
More information about the Mlir-commits
mailing list