[Mlir-commits] [mlir] [mlir][vector] Prevent folding of OOB values in insert/extract (PR #135498)
Jakub Kuderski
llvmlistbot at llvm.org
Sat Apr 12 19:00:31 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 if constexpr (std::is_same_v<OpType, InsertOp>) {
+ vectorShape = op.getDestVectorType().getShape();
+ }
----------------
kuhar wrote:
What happens in the else case? Since this is only meant for these two ops, I don't think we need the second if. Alternatively, make this a helper function overloaded for these two types?
https://github.com/llvm/llvm-project/pull/135498
More information about the Mlir-commits
mailing list