Support for affine integer sets
- introduce affine integer sets into the IR
- parse and print affine integer sets (both inline or outlined) similar to
affine maps
- use integer set for IfStmt's conditional, and implement parsing of IfStmt's
conditional
- fixed an affine expr paren omission bug while one this.
TODO: parse/represent/print MLValue operands to affine integer set references.
PiperOrigin-RevId: 207779408
diff --git a/include/mlir/IR/Builders.h b/include/mlir/IR/Builders.h
index 1be6c3e..33f11d4 100644
--- a/include/mlir/IR/Builders.h
+++ b/include/mlir/IR/Builders.h
@@ -97,6 +97,11 @@
AffineExpr *getFloorDivExpr(AffineExpr *lhs, AffineExpr *rhs);
AffineExpr *getCeilDivExpr(AffineExpr *lhs, AffineExpr *rhs);
+ // Integer set.
+ IntegerSet *getIntegerSet(unsigned dimCount, unsigned symbolCount,
+ ArrayRef<AffineExpr *> constraints,
+ ArrayRef<bool> isEq);
+
// TODO: Helpers for affine map/exprs, etc.
protected:
MLIRContext *context;
@@ -279,8 +284,8 @@
AffineConstantExpr *upperBound,
AffineConstantExpr *step = nullptr);
- IfStmt *createIf() {
- auto *stmt = new IfStmt();
+ IfStmt *createIf(IntegerSet *condition) {
+ auto *stmt = new IfStmt(condition);
block->getStatements().insert(insertPoint, stmt);
return stmt;
}