// Build the constraints for this region.
FlatAffineConstraints *regionCst = region->getConstraints();
+ if (rank == 0) {
+ // A rank 0 memref has a 0-d region.
+ SmallVector<ForInst *, 4> ivs;
+ getLoopIVs(*opInst, &ivs);
+ SmallVector<Value *, 4> regionSymbols(ivs.begin(), ivs.end());
+ regionCst->reset(0, loopDepth, 0, regionSymbols);
+ return true;
+ }
+
FuncBuilder b(opInst);
auto idMap = b.getMultiDimIdentityMap(rank);
}
return
}
+
+// CHECK-LABEL: func @zero_d_memref
+func @zero_d_memref(%arg0: memref<i32>) {
+ %c0 = constant 0 : i32
+ // A 0-d memref always has in-bound accesses!
+ store %c0, %arg0[] : memref<i32>
+ return
+}