forked from OSchip/llvm-project
Change sigil for integer set: @@ -> #
PiperOrigin-RevId: 218786684
This commit is contained in:
parent
adbba70d82
commit
988ce3387f
|
@ -337,7 +337,7 @@ void ModulePrinter::printAffineMapReference(AffineMap affineMap) {
|
|||
|
||||
// Prints integer set identifier.
|
||||
void ModulePrinter::printIntegerSetId(int integerSetId) const {
|
||||
os << "@@set" << integerSetId;
|
||||
os << "#set" << integerSetId;
|
||||
}
|
||||
|
||||
void ModulePrinter::printIntegerSetReference(IntegerSet integerSet) {
|
||||
|
|
|
@ -122,10 +122,6 @@ Token Lexer::lexToken() {
|
|||
return emitError(tokStart, "unexpected character");
|
||||
|
||||
case '@':
|
||||
if (*curPtr == '@') {
|
||||
++curPtr;
|
||||
return lexDoubleAtIdentifier(tokStart);
|
||||
}
|
||||
return lexAtIdentifier(tokStart);
|
||||
|
||||
case '#':
|
||||
|
@ -215,20 +211,6 @@ Token Lexer::lexAtIdentifier(const char *tokStart) {
|
|||
return formToken(Token::at_identifier, tokStart);
|
||||
}
|
||||
|
||||
/// Lex an '@@foo' identifier.
|
||||
///
|
||||
/// function-id ::= `@@` bare-id
|
||||
///
|
||||
Token Lexer::lexDoubleAtIdentifier(const char *tokStart) {
|
||||
// These always start with a letter.
|
||||
if (!isalpha(*curPtr++))
|
||||
return emitError(curPtr - 1, "expected letter in @@ identifier");
|
||||
|
||||
while (isalpha(*curPtr) || isdigit(*curPtr) || *curPtr == '_')
|
||||
++curPtr;
|
||||
return formToken(Token::double_at_identifier, tokStart);
|
||||
}
|
||||
|
||||
/// Lex an identifier that starts with a prefix followed by suffix-id.
|
||||
///
|
||||
/// affine-map-id ::= `#` suffix-id
|
||||
|
|
|
@ -57,7 +57,6 @@ private:
|
|||
Token lexComment();
|
||||
Token lexBareIdentifierOrKeyword(const char *tokStart);
|
||||
Token lexAtIdentifier(const char *tokStart);
|
||||
Token lexDoubleAtIdentifier(const char *tokStart);
|
||||
Token lexPrefixedIdentifier(const char *tokStart);
|
||||
Token lexNumber(const char *tokStart);
|
||||
Token lexString(const char *tokStart);
|
||||
|
|
|
@ -200,6 +200,7 @@ public:
|
|||
ParseResult parseAttributeDict(SmallVectorImpl<NamedAttribute> &attributes);
|
||||
|
||||
// Polyhedral structures.
|
||||
void parseAffineStructureInline(AffineMap *map, IntegerSet *set);
|
||||
AffineMap parseAffineMapInline();
|
||||
AffineMap parseAffineMapReference();
|
||||
IntegerSet parseIntegerSetInline();
|
||||
|
@ -1169,8 +1170,9 @@ class AffineParser : public Parser {
|
|||
public:
|
||||
explicit AffineParser(ParserState &state) : Parser(state) {}
|
||||
|
||||
AffineMap parseAffineMapInline();
|
||||
IntegerSet parseIntegerSetInline();
|
||||
void parseAffineStructureInline(AffineMap *map, IntegerSet *set);
|
||||
AffineMap parseAffineMapRange(unsigned numDims, unsigned numSymbols);
|
||||
IntegerSet parseIntegerSetConstraints(unsigned numDims, unsigned numSymbols);
|
||||
|
||||
private:
|
||||
// Binary affine op parsing.
|
||||
|
@ -1558,29 +1560,99 @@ ParseResult AffineParser::parseDimIdList(unsigned &numDims) {
|
|||
return parseCommaSeparatedListUntil(Token::r_paren, parseElt);
|
||||
}
|
||||
|
||||
/// Parse an affine map definition.
|
||||
/// Parses either an affine map or an integer set definition inline. If both
|
||||
/// 'map' and 'set' are non-null, parses either an affine map or an integer set.
|
||||
/// If 'map' is set to nullptr, parses an integer set. If 'set' is set to
|
||||
/// nullptr, parses an affine map. 'map'/'set' are set to the parsed structure.
|
||||
///
|
||||
/// affine-map-inline ::= dim-and-symbol-id-lists `->` multi-dim-affine-expr
|
||||
/// (`size` `(` dim-size (`,` dim-size)* `)`)?
|
||||
/// dim-size ::= affine-expr | `min` `(` affine-expr ( `,` affine-expr)+ `)`
|
||||
///
|
||||
/// multi-dim-affine-expr ::= `(` affine-expr (`,` affine-expr)* `)
|
||||
AffineMap AffineParser::parseAffineMapInline() {
|
||||
///
|
||||
///
|
||||
/// integer-set-inline
|
||||
/// ::= dim-and-symbol-id-lists `:`
|
||||
/// affine-constraint-conjunction
|
||||
/// affine-constraint-conjunction ::= /*empty*/
|
||||
/// | affine-constraint (`,`
|
||||
/// affine-constraint)*
|
||||
///
|
||||
void AffineParser::parseAffineStructureInline(AffineMap *map, IntegerSet *set) {
|
||||
assert((map || set) && "one of map or set expected to be non-null");
|
||||
|
||||
unsigned numDims = 0, numSymbols = 0;
|
||||
|
||||
// List of dimensional identifiers.
|
||||
if (parseDimIdList(numDims))
|
||||
return AffineMap::Null();
|
||||
if (parseDimIdList(numDims)) {
|
||||
if (map)
|
||||
*map = AffineMap::Null();
|
||||
if (set)
|
||||
*set = IntegerSet::Null();
|
||||
return;
|
||||
}
|
||||
|
||||
// Symbols are optional.
|
||||
if (getToken().is(Token::l_square)) {
|
||||
if (parseSymbolIdList(numSymbols))
|
||||
return AffineMap::Null();
|
||||
if (parseSymbolIdList(numSymbols)) {
|
||||
if (map)
|
||||
*map = AffineMap::Null();
|
||||
if (set)
|
||||
*set = IntegerSet::Null();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (parseToken(Token::arrow, "expected '->' or '['") ||
|
||||
parseToken(Token::l_paren, "expected '(' at start of affine map range"))
|
||||
return AffineMap::Null();
|
||||
// This is needed for parsing attributes as we wouldn't know whether we would
|
||||
// be parsing an integer set attribute or an affine map attribute.
|
||||
if (map && set && getToken().isNot(Token::arrow) &&
|
||||
getToken().isNot(Token::colon)) {
|
||||
emitError("expected '->' or ':' or '['");
|
||||
*map = AffineMap::Null();
|
||||
*set = IntegerSet::Null();
|
||||
return;
|
||||
}
|
||||
|
||||
if (map && (!set || getToken().is(Token::arrow))) {
|
||||
// Parse an affine map.
|
||||
if (parseToken(Token::arrow, "expected '->' or '['")) {
|
||||
*map = AffineMap::Null();
|
||||
if (set)
|
||||
*set = IntegerSet::Null();
|
||||
return;
|
||||
}
|
||||
*map = parseAffineMapRange(numDims, numSymbols);
|
||||
if (set)
|
||||
*set = IntegerSet::Null();
|
||||
return;
|
||||
}
|
||||
|
||||
if (set && (!map || getToken().is(Token::colon))) {
|
||||
// Parse an integer set.
|
||||
if (parseToken(Token::colon, "expected ':' or '['")) {
|
||||
*set = IntegerSet::Null();
|
||||
if (map)
|
||||
*map = AffineMap::Null();
|
||||
return;
|
||||
}
|
||||
*set = parseIntegerSetConstraints(numDims, numSymbols);
|
||||
if (map)
|
||||
*map = AffineMap::Null();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse the range and sizes affine map definition inline.
|
||||
///
|
||||
/// affine-map-inline ::= dim-and-symbol-id-lists `->` multi-dim-affine-expr
|
||||
/// (`size` `(` dim-size (`,` dim-size)* `)`)?
|
||||
/// dim-size ::= affine-expr | `min` `(` affine-expr ( `,` affine-expr)+ `)`
|
||||
///
|
||||
/// multi-dim-affine-expr ::= `(` affine-expr (`,` affine-expr)* `)
|
||||
AffineMap AffineParser::parseAffineMapRange(unsigned numDims,
|
||||
unsigned numSymbols) {
|
||||
parseToken(Token::l_paren, "expected '(' at start of affine map range");
|
||||
|
||||
SmallVector<AffineExpr, 4> exprs;
|
||||
auto parseElt = [&]() -> ParseResult {
|
||||
|
@ -1636,8 +1708,14 @@ AffineMap AffineParser::parseAffineMapInline() {
|
|||
return builder.getAffineMap(numDims, numSymbols, exprs, rangeSizes);
|
||||
}
|
||||
|
||||
void Parser::parseAffineStructureInline(AffineMap *map, IntegerSet *set) {
|
||||
AffineParser(state).parseAffineStructureInline(map, set);
|
||||
}
|
||||
|
||||
AffineMap Parser::parseAffineMapInline() {
|
||||
return AffineParser(state).parseAffineMapInline();
|
||||
AffineMap map;
|
||||
AffineParser(state).parseAffineStructureInline(&map, nullptr);
|
||||
return map;
|
||||
}
|
||||
|
||||
AffineMap Parser::parseAffineMapReference() {
|
||||
|
@ -2873,7 +2951,7 @@ AffineExpr AffineParser::parseAffineConstraint(bool *isEq) {
|
|||
nullptr);
|
||||
}
|
||||
|
||||
/// Parse an integer set definition.
|
||||
/// Parse the constraints that are part of an integer set definition.
|
||||
/// integer-set-inline
|
||||
/// ::= dim-and-symbol-id-lists `:`
|
||||
/// affine-constraint-conjunction
|
||||
|
@ -2881,24 +2959,11 @@ AffineExpr AffineParser::parseAffineConstraint(bool *isEq) {
|
|||
/// | affine-constraint (`,`
|
||||
/// affine-constraint)*
|
||||
///
|
||||
IntegerSet AffineParser::parseIntegerSetInline() {
|
||||
unsigned numDims = 0, numSymbols = 0;
|
||||
|
||||
// List of dimensional identifiers.
|
||||
if (parseDimIdList(numDims))
|
||||
return IntegerSet();
|
||||
|
||||
// Symbols are optional.
|
||||
if (getToken().is(Token::l_square)) {
|
||||
if (parseSymbolIdList(numSymbols))
|
||||
return IntegerSet();
|
||||
}
|
||||
|
||||
if (parseToken(Token::colon, "expected ':' or '['") ||
|
||||
parseToken(Token::l_paren,
|
||||
"expected '(' at start of integer set constraint list"))
|
||||
return IntegerSet();
|
||||
IntegerSet AffineParser::parseIntegerSetConstraints(unsigned numDims,
|
||||
unsigned numSymbols) {
|
||||
|
||||
parseToken(Token::l_paren,
|
||||
"expected '(' at start of integer set constraint list");
|
||||
SmallVector<AffineExpr, 4> constraints;
|
||||
SmallVector<bool, 4> isEqs;
|
||||
auto parseElt = [&]() -> ParseResult {
|
||||
|
@ -2923,22 +2988,23 @@ IntegerSet AffineParser::parseIntegerSetInline() {
|
|||
}
|
||||
|
||||
IntegerSet Parser::parseIntegerSetInline() {
|
||||
return AffineParser(state).parseIntegerSetInline();
|
||||
IntegerSet set;
|
||||
AffineParser(state).parseAffineStructureInline(nullptr, &set);
|
||||
return set;
|
||||
}
|
||||
|
||||
/// Parse a reference to an integer set.
|
||||
/// integer-set ::= integer-set-id | integer-set-inline
|
||||
/// integer-set-id ::= `@@` suffix-id
|
||||
/// integer-set-id ::= `#` suffix-id
|
||||
///
|
||||
IntegerSet Parser::parseIntegerSetReference() {
|
||||
// TODO: change '@@' integer set prefix to '#'.
|
||||
if (getToken().is(Token::double_at_identifier)) {
|
||||
if (getToken().is(Token::hash_identifier)) {
|
||||
// Parse integer set identifier and verify that it exists.
|
||||
StringRef integerSetId = getTokenSpelling().drop_front(2);
|
||||
StringRef integerSetId = getTokenSpelling().drop_front(1);
|
||||
if (getState().integerSetDefinitions.count(integerSetId) == 0)
|
||||
return (emitError("undefined integer set id '" + integerSetId + "'"),
|
||||
IntegerSet());
|
||||
consumeToken(Token::double_at_identifier);
|
||||
consumeToken(Token::hash_identifier);
|
||||
return getState().integerSetDefinitions[integerSetId];
|
||||
}
|
||||
// Try to parse an inline integer set definition.
|
||||
|
@ -3063,8 +3129,7 @@ public:
|
|||
private:
|
||||
ParseResult finalizeModule();
|
||||
|
||||
ParseResult parseAffineMapDef();
|
||||
ParseResult parseIntegerSetDef();
|
||||
ParseResult parseAffineStructureDef();
|
||||
|
||||
// Functions.
|
||||
ParseResult parseMLArgumentList(SmallVectorImpl<Type *> &argTypes,
|
||||
|
@ -3078,19 +3143,28 @@ private:
|
|||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Parses either an affine map declaration or an integer set declaration.
|
||||
///
|
||||
/// Affine map declaration.
|
||||
///
|
||||
/// affine-map-def ::= affine-map-id `=` affine-map-inline
|
||||
///
|
||||
ParseResult ModuleParser::parseAffineMapDef() {
|
||||
/// Integer set declaration.
|
||||
///
|
||||
/// integer-set-decl ::= integer-set-id `=` integer-set-inline
|
||||
///
|
||||
ParseResult ModuleParser::parseAffineStructureDef() {
|
||||
assert(getToken().is(Token::hash_identifier));
|
||||
|
||||
StringRef affineMapId = getTokenSpelling().drop_front();
|
||||
StringRef affineStructureId = getTokenSpelling().drop_front();
|
||||
|
||||
// Check for redefinitions.
|
||||
auto &entry = getState().affineMapDefinitions[affineMapId];
|
||||
if (entry)
|
||||
return emitError("redefinition of affine map id '" + affineMapId + "'");
|
||||
if (getState().affineMapDefinitions.count(affineStructureId) > 0)
|
||||
return emitError("redefinition of affine map id '" + affineStructureId +
|
||||
"'");
|
||||
if (getState().integerSetDefinitions.count(affineStructureId) > 0)
|
||||
return emitError("redefinition of integer set id '" + affineStructureId +
|
||||
"'");
|
||||
|
||||
consumeToken(Token::hash_identifier);
|
||||
|
||||
|
@ -3099,37 +3173,16 @@ ParseResult ModuleParser::parseAffineMapDef() {
|
|||
"expected '=' in affine map outlined definition"))
|
||||
return ParseFailure;
|
||||
|
||||
entry = parseAffineMapInline();
|
||||
if (!entry)
|
||||
AffineMap map;
|
||||
IntegerSet set;
|
||||
parseAffineStructureInline(&map, &set);
|
||||
if (!map && !set)
|
||||
return ParseFailure;
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
/// Integer set declaration.
|
||||
///
|
||||
/// integer-set-decl ::= integer-set-id `=` integer-set-inline
|
||||
///
|
||||
ParseResult ModuleParser::parseIntegerSetDef() {
|
||||
assert(getToken().is(Token::double_at_identifier));
|
||||
|
||||
StringRef integerSetId = getTokenSpelling().drop_front(2);
|
||||
|
||||
// Check for redefinitions (a default entry is created if one doesn't exist)
|
||||
auto &entry = getState().integerSetDefinitions[integerSetId];
|
||||
if (entry)
|
||||
return emitError("redefinition of integer set id '" + integerSetId + "'");
|
||||
|
||||
consumeToken(Token::double_at_identifier);
|
||||
|
||||
// Parse the '='
|
||||
if (parseToken(Token::equal,
|
||||
"expected '=' in outlined integer set definition"))
|
||||
return ParseFailure;
|
||||
|
||||
entry = parseIntegerSetInline();
|
||||
if (!entry)
|
||||
return ParseFailure;
|
||||
if (map)
|
||||
getState().affineMapDefinitions[affineStructureId] = map;
|
||||
else
|
||||
getState().integerSetDefinitions[affineStructureId] = set;
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
@ -3466,12 +3519,7 @@ ParseResult ModuleParser::parseModule() {
|
|||
return ParseFailure;
|
||||
|
||||
case Token::hash_identifier:
|
||||
if (parseAffineMapDef())
|
||||
return ParseFailure;
|
||||
break;
|
||||
|
||||
case Token::double_at_identifier:
|
||||
if (parseIntegerSetDef())
|
||||
if (parseAffineStructureDef())
|
||||
return ParseFailure;
|
||||
break;
|
||||
|
||||
|
|
|
@ -52,10 +52,8 @@ TOK_MARKER(error)
|
|||
// Identifiers.
|
||||
TOK_IDENTIFIER(bare_identifier) // foo
|
||||
TOK_IDENTIFIER(at_identifier) // @foo
|
||||
TOK_IDENTIFIER(double_at_identifier) // @@foo
|
||||
TOK_IDENTIFIER(hash_identifier) // #foo
|
||||
TOK_IDENTIFIER(percent_identifier) // %foo
|
||||
// TODO: @@foo, etc.
|
||||
|
||||
// Literals
|
||||
TOK_LITERAL(floatliteral) // 2.0
|
||||
|
|
|
@ -604,27 +604,27 @@ mlfunc @invalid_bound_map(%N : i32) {
|
|||
}
|
||||
|
||||
// -----
|
||||
@@set0 = (i)[N] : (i >= 0, N - i >= 0)
|
||||
#set0 = (i)[N] : (i >= 0, N - i >= 0)
|
||||
|
||||
mlfunc @invalid_if_operands1(%N : index) {
|
||||
for %i = 1 to 10 {
|
||||
if @@set0(%i) {
|
||||
if #set0(%i) {
|
||||
// expected-error@-1 {{symbol operand count and integer set symbol count must match}}
|
||||
|
||||
// -----
|
||||
@@set0 = (i)[N] : (i >= 0, N - i >= 0)
|
||||
#set0 = (i)[N] : (i >= 0, N - i >= 0)
|
||||
|
||||
mlfunc @invalid_if_operands2(%N : index) {
|
||||
for %i = 1 to 10 {
|
||||
if @@set0()[%N] {
|
||||
if #set0()[%N] {
|
||||
// expected-error@-1 {{dim operand count and integer set dim count must match}}
|
||||
|
||||
// -----
|
||||
@@set0 = (i)[N] : (i >= 0, N - i >= 0)
|
||||
#set0 = (i)[N] : (i >= 0, N - i >= 0)
|
||||
|
||||
mlfunc @invalid_if_operands3(%N : index) {
|
||||
for %i = 1 to 10 {
|
||||
if @@set0(%i)[%i] {
|
||||
if #set0(%i)[%i] {
|
||||
// expected-error@-1 {{value '%i' cannot be used as a symbol}}
|
||||
|
||||
// -----
|
||||
|
@ -712,4 +712,4 @@ bb0:
|
|||
cfgfunc @elementsattr_malformed_opaque1() -> () {
|
||||
bb0:
|
||||
"foo"(){bar: opaque<tensor<1xi8>, "00abc">} : () -> () // expected-error {{opaque string should start with '0x'}}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
// CHECK: #map{{[0-9]+}} = (d0)[s0] -> (d0 + s0, d0 - s0)
|
||||
#bound_map2 = (i)[s] -> (i + s, i - s)
|
||||
|
||||
// CHECK-DAG: @@set0 = (d0)[s0, s1] : (d0 >= 0, d0 * -1 + s0 >= 0, s0 - 5 == 0, d0 * -1 + s1 + 1 >= 0)
|
||||
@@set0 = (i)[N, M] : (i >= 0, -i + N >= 0, N - 5 == 0, -i + M + 1 >= 0)
|
||||
// CHECK-DAG: #set0 = (d0)[s0, s1] : (d0 >= 0, d0 * -1 + s0 >= 0, s0 - 5 == 0, d0 * -1 + s1 + 1 >= 0)
|
||||
#set0 = (i)[N, M] : (i >= 0, -i + N >= 0, N - 5 == 0, -i + M + 1 >= 0)
|
||||
|
||||
// CHECK-DAG: @@set1 = (d0)[s0] : (d0 - 2 >= 0, d0 * -1 + 4 >= 0)
|
||||
// CHECK-DAG: #set1 = (d0)[s0] : (d0 - 2 >= 0, d0 * -1 + 4 >= 0)
|
||||
|
||||
// CHECK: extfunc @foo(i32, i64) -> f32
|
||||
extfunc @foo(i32, i64) -> f32
|
||||
|
@ -241,12 +241,12 @@ mlfunc @loop_bounds(%N : index) {
|
|||
mlfunc @ifstmt(%N: index) {
|
||||
%c = constant 200 : index // CHECK %c200 = constant 200
|
||||
for %i = 1 to 10 { // CHECK for %i0 = 1 to 10 {
|
||||
if @@set0(%i)[%N, %c] { // CHECK if @@set0(%i0)[%arg0, %c200] {
|
||||
if #set0(%i)[%N, %c] { // CHECK if #set0(%i0)[%arg0, %c200] {
|
||||
%x = constant 1 : i32
|
||||
// CHECK: %c1_i32 = constant 1 : i32
|
||||
%y = "add"(%x, %i) : (i32, index) -> i32 // CHECK: %0 = "add"(%c1_i32, %i0) : (i32, index) -> i32
|
||||
%z = "mul"(%y, %y) : (i32, i32) -> i32 // CHECK: %1 = "mul"(%0, %0) : (i32, i32) -> i32
|
||||
} else if (i)[N] : (i - 2 >= 0, 4 - i >= 0)(%i)[%N] { // CHECK } else if (@@set1(%i0)[%arg0]) {
|
||||
} else if (i)[N] : (i - 2 >= 0, 4 - i >= 0)(%i)[%N] { // CHECK } else if (#set1(%i0)[%arg0]) {
|
||||
// CHECK: %c1 = constant 1 : index
|
||||
%u = constant 1 : index
|
||||
// CHECK: %2 = affine_apply #map{{.*}}(%i0, %i0)[%c1]
|
||||
|
@ -262,7 +262,7 @@ mlfunc @ifstmt(%N: index) {
|
|||
mlfunc @simple_ifstmt(%N: index) {
|
||||
%c = constant 200 : index // CHECK %c200 = constant 200
|
||||
for %i = 1 to 10 { // CHECK for %i0 = 1 to 10 {
|
||||
if @@set0(%i)[%N, %c] { // CHECK if @@set0(%i0)[%arg0, %c200] {
|
||||
if #set0(%i)[%N, %c] { // CHECK if #set0(%i0)[%arg0, %c200] {
|
||||
%x = constant 1 : i32
|
||||
// CHECK: %c1_i32 = constant 1 : i32
|
||||
%y = "add"(%x, %i) : (i32, index) -> i32 // CHECK: %0 = "add"(%c1_i32, %i0) : (i32, index) -> i32
|
||||
|
@ -661,4 +661,4 @@ bb0:
|
|||
// CHECK: "foof320"() {bar: sparse<vector<0xf32>, {{\[}}], {{\[}}]>} : () -> ()
|
||||
"foof320"(){bar: sparse<vector<0 x f32>, [], []>} : () -> ()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,31 +22,31 @@
|
|||
// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0 - (d0 floordiv 8) * 8, (d1 floordiv 8) * 8)
|
||||
#map6 = (d0, d1) -> (d0 mod 8, d1 - d1 mod 8)
|
||||
|
||||
// CHECK: @@set0 = (d0, d1) : (1 == 0)
|
||||
// CHECK: @@set1 = (d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, d0 * -1 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)
|
||||
// CHECK: @@set2 = (d0, d1)[s0, s1] : (1 == 0)
|
||||
// CHECK: @@set3 = (d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0, d0 * 5 - d1 * 11 + s0 * 7 + s1 == 0, d0 * 11 + d1 * 7 - s0 * 5 + s1 == 0, d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0)
|
||||
// CHECK: @@set4 = (d0) : (1 == 0)
|
||||
// CHECK: @@set5 = (d0)[s0, s1] : (1 == 0)
|
||||
// CHECK: @@set6 = (d0, d1, d2) : (1 == 0)
|
||||
// CHECK: #set0 = (d0, d1) : (1 == 0)
|
||||
// CHECK: #set1 = (d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, d0 * -1 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)
|
||||
// CHECK: #set2 = (d0, d1)[s0, s1] : (1 == 0)
|
||||
// CHECK: #set3 = (d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0, d0 * 5 - d1 * 11 + s0 * 7 + s1 == 0, d0 * 11 + d1 * 7 - s0 * 5 + s1 == 0, d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0)
|
||||
// CHECK: #set4 = (d0) : (1 == 0)
|
||||
// CHECK: #set5 = (d0)[s0, s1] : (1 == 0)
|
||||
// CHECK: #set6 = (d0, d1, d2) : (1 == 0)
|
||||
|
||||
// Set for test case: test_gaussian_elimination_non_empty_set2
|
||||
// @@set2 = (d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, d0 * -1 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)
|
||||
@@set2 = (d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, -d0 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)
|
||||
// #set2 = (d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, d0 * -1 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)
|
||||
#set2 = (d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, -d0 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)
|
||||
|
||||
// Set for test case: test_gaussian_elimination_empty_set3
|
||||
// @@set3 = (d0, d1)[s0, s1] : (1 == 0)
|
||||
@@set3 = (d0, d1)[s0, s1] : (d0 - s0 == 0, d0 + s0 == 0, s0 - 1 == 0)
|
||||
// #set3 = (d0, d1)[s0, s1] : (1 == 0)
|
||||
#set3 = (d0, d1)[s0, s1] : (d0 - s0 == 0, d0 + s0 == 0, s0 - 1 == 0)
|
||||
|
||||
// Set for test case: test_gaussian_elimination_non_empty_set4
|
||||
@@set4 = (d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0,
|
||||
#set4 = (d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0,
|
||||
d0 * 5 - d1 * 11 + s0 * 7 + s1 == 0,
|
||||
d0 * 11 + d1 * 7 - s0 * 5 + s1 == 0,
|
||||
d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0)
|
||||
|
||||
// Add invalid constraints to previous non-empty set to make it empty.
|
||||
// Set for test case: test_gaussian_elimination_empty_set5
|
||||
@@set5 = (d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0,
|
||||
#set5 = (d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0,
|
||||
d0 * 5 - d1 * 11 + s0 * 7 + s1 == 0,
|
||||
d0 * 11 + d1 * 7 - s0 * 5 + s1 == 0,
|
||||
d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0,
|
||||
|
@ -71,7 +71,7 @@ mlfunc @test() {
|
|||
mlfunc @test_gaussian_elimination_empty_set0() {
|
||||
for %i0 = 1 to 10 {
|
||||
for %i1 = 1 to 100 {
|
||||
// CHECK: @@set0(%i0, %i1)
|
||||
// CHECK: #set0(%i0, %i1)
|
||||
if (d0, d1) : (2 == 0)(%i0, %i1) {
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ mlfunc @test_gaussian_elimination_empty_set0() {
|
|||
mlfunc @test_gaussian_elimination_empty_set1() {
|
||||
for %i0 = 1 to 10 {
|
||||
for %i1 = 1 to 100 {
|
||||
// CHECK: @@set0(%i0, %i1)
|
||||
// CHECK: #set0(%i0, %i1)
|
||||
if (d0, d1) : (1 >= 0, -1 >= 0) (%i0, %i1) {
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,8 @@ mlfunc @test_gaussian_elimination_empty_set1() {
|
|||
mlfunc @test_gaussian_elimination_non_empty_set2() {
|
||||
for %i0 = 1 to 10 {
|
||||
for %i1 = 1 to 100 {
|
||||
// CHECK: @@set1(%i0, %i1)
|
||||
if @@set2(%i0, %i1) {
|
||||
// CHECK: #set1(%i0, %i1)
|
||||
if #set2(%i0, %i1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ mlfunc @test_gaussian_elimination_empty_set3() {
|
|||
%c11 = constant 11 : index
|
||||
for %i0 = 1 to 10 {
|
||||
for %i1 = 1 to 100 {
|
||||
// CHECK: @@set2(%i0, %i1)[%c7, %c11]
|
||||
if @@set3(%i0, %i1)[%c7, %c11] {
|
||||
// CHECK: #set2(%i0, %i1)[%c7, %c11]
|
||||
if #set3(%i0, %i1)[%c7, %c11] {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,8 +123,8 @@ mlfunc @test_gaussian_elimination_non_empty_set4() {
|
|||
%c11 = constant 11 : index
|
||||
for %i0 = 1 to 10 {
|
||||
for %i1 = 1 to 100 {
|
||||
// CHECK: @@set3(%i0, %i1)[%c7, %c11]
|
||||
if @@set4(%i0, %i1)[%c7, %c11] {
|
||||
// CHECK: #set3(%i0, %i1)[%c7, %c11]
|
||||
if #set4(%i0, %i1)[%c7, %c11] {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ mlfunc @test_gaussian_elimination_empty_set5() {
|
|||
%c11 = constant 11 : index
|
||||
for %i0 = 1 to 10 {
|
||||
for %i1 = 1 to 100 {
|
||||
// CHECK: @@set2(%i0, %i1)[%c7, %c11]
|
||||
if @@set5(%i0, %i1)[%c7, %c11] {
|
||||
// CHECK: #set2(%i0, %i1)[%c7, %c11]
|
||||
if #set5(%i0, %i1)[%c7, %c11] {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,28 +149,28 @@ mlfunc @test_gaussian_elimination_empty_set5() {
|
|||
mlfunc @test_fourier_motzkin(%N : index) {
|
||||
for %i = 0 to 10 {
|
||||
for %j = 0 to 10 {
|
||||
// CHECK: if @@set0(%i0, %i1)
|
||||
// CHECK: if #set0(%i0, %i1)
|
||||
if (d0, d1) : (d0 - d1 >= 0, d1 - d0 - 1 >= 0)(%i, %j) {
|
||||
"foo"() : () -> ()
|
||||
}
|
||||
// CHECK: if @@set4(%i0)
|
||||
// CHECK: if #set4(%i0)
|
||||
if (d0) : (d0 >= 0, -d0 - 1 >= 0)(%i) {
|
||||
"bar"() : () -> ()
|
||||
}
|
||||
// CHECK: if @@set4(%i0)
|
||||
// CHECK: if #set4(%i0)
|
||||
if (d0) : (d0 >= 0, -d0 - 1 >= 0)(%i) {
|
||||
"foo"() : () -> ()
|
||||
}
|
||||
// CHECK: if @@set5(%i0)[%arg0, %arg0]
|
||||
// CHECK: if #set5(%i0)[%arg0, %arg0]
|
||||
if (d0)[s0, s1] : (d0 >= 0, -d0 + s0 - 1 >= 0, -s0 >= 0)(%i)[%N, %N] {
|
||||
"bar"() : () -> ()
|
||||
}
|
||||
// CHECK: if @@set6(%i0, %i1, %arg0)
|
||||
// CHECK: if #set6(%i0, %i1, %arg0)
|
||||
// The set below implies d0 = d1; so d1 >= d0, but d0 >= d1 + 1.
|
||||
if (d0, d1, d2) : (d0 - d1 == 0, d2 - d0 >= 0, d0 - d1 - 1 >= 0)(%i, %j, %N) {
|
||||
"foo"() : () -> ()
|
||||
}
|
||||
// CHECK: if @@set0(%i0, %i1)
|
||||
// CHECK: if #set0(%i0, %i1)
|
||||
// The set below has rational solutions but no integer solutions.
|
||||
if (d0, d1) : (d0 * 2 -d1 * 2 -1 == 0, d0 >= 0, -d0 + 100 >= 0, d1 >= 0, -d1 + 100 >= 0)(%i, %j) {
|
||||
"foo"() : () -> ()
|
||||
|
|
Loading…
Reference in New Issue