ConversionPatternRewriter &rewriter, Location loc, Operation *op,
TypeConverter *typeConverter, MemRefType srcType, MemRefDescriptor &srcDesc,
MemRefDescriptor &dstDesc, ArrayRef<ReassociationIndices> reassociation) {
+ auto llvmIndexType = typeConverter->convertType(rewriter.getIndexType());
// See comments for computeCollapsedLayoutMap for details on how the strides
// are calculated.
auto srcShape = srcType.getShape();
rewriter.create<LLVM::BrOp>(loc, srcStride, continueBlock);
break;
}
- Value one = rewriter.create<LLVM::ConstantOp>(
- loc, rewriter.getI64Type(), rewriter.getI32IntegerAttr(1));
+ Value one = rewriter.create<LLVM::ConstantOp>(loc, llvmIndexType,
+ rewriter.getIndexAttr(1));
Value predNeOne = rewriter.create<LLVM::ICmpOp>(
loc, LLVM::ICmpPredicate::ne, srcDesc.size(rewriter, loc, srcIndex),
one);
// CHECK: llvm.extractvalue %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.extractvalue %{{.*}}[4, 2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK: llvm.mlir.constant(1 : i32) : i64
+// CHECK: llvm.mlir.constant(1 : index) : i64
// CHECK: llvm.extractvalue %{{.*}}[3, 2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
// CHECK: llvm.icmp "ne" %{{.*}}, %{{.*}} : i64
// CHECK: llvm.cond_br %{{.*}}, ^bb2(%{{.*}} : i64), ^bb1
// CHECK: llvm.br ^bb2(%{{.*}} : i64)
// CHECK: ^bb2(%[[STRIDE:.*]]: i64):
// CHECK: llvm.insertvalue %[[STRIDE]], %{{.*}}[4, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
+// CHECK32-LABEL: func @collapse_shape_dynamic_with_non_identity_layout(
+// CHECK32: llvm.mlir.constant(1 : index) : i32
+// CHECK32: llvm.mlir.constant(4 : index) : i32
+// CHECK32: llvm.mlir.constant(1 : index) : i32
// -----
// CHECK-LABEL: func @extract_aligned_pointer_as_index
func.func @extract_aligned_pointer_as_index(%m: memref<?xf32>) -> index {
%0 = memref.extract_aligned_pointer_as_index %m: memref<?xf32> -> index
- // CHECK: %[[E:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<1 x i64>, array<1 x i64>)>
+ // CHECK: %[[E:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<1 x i64>, array<1 x i64>)>
// CHECK: %[[I64:.*]] = llvm.ptrtoint %[[E]] : !llvm.ptr<f32> to i64
// CHECK: %[[R:.*]] = builtin.unrealized_conversion_cast %[[I64]] : i64 to index