mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-22 08:32:23 +00:00
Emit a parser error when the min/max prefix is missing from a multi value AffineFor loop bound AffineMap.
PiperOrigin-RevId: 232609693
This commit is contained in:
parent
10237de8eb
commit
423715056d
@ -578,6 +578,10 @@ static bool parseBound(bool isLower, OperationState *result, OpAsmParser *p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the attribute location.
|
||||
llvm::SMLoc attrLoc;
|
||||
p->getCurrentLocation(&attrLoc);
|
||||
|
||||
Attribute boundAttr;
|
||||
if (p->parseAttribute(boundAttr, builder.getIndexType(), boundAttrName.data(),
|
||||
result->attributes))
|
||||
@ -607,13 +611,11 @@ static bool parseBound(bool isLower, OperationState *result, OpAsmParser *p) {
|
||||
// prefix.
|
||||
if (map.getNumResults() > 1 && failedToParsedMinMax) {
|
||||
if (isLower) {
|
||||
return p->emitError(p->getNameLoc(),
|
||||
"lower loop bound affine map with multiple results "
|
||||
"requires 'max' prefix");
|
||||
return p->emitError(attrLoc, "lower loop bound affine map with "
|
||||
"multiple results requires 'max' prefix");
|
||||
}
|
||||
return p->emitError(p->getNameLoc(),
|
||||
"upper loop bound affine map with multiple results "
|
||||
"requires 'min' prefix");
|
||||
return p->emitError(attrLoc, "upper loop bound affine map with multiple "
|
||||
"results requires 'min' prefix");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -819,3 +819,21 @@ func @invalid_affine_structure() {
|
||||
%idx = affine_apply (d0, d1) (%c0, %c0) // expected-error {{expected '->' or ':'}}
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @missing_for_max(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
|
||||
// expected-error @+1 {{lower loop bound affine map with multiple results requires 'max' prefix}}
|
||||
for %i0 = ()[s]->(0,s-1)()[%arg0] to %arg1 {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @missing_for_min(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
|
||||
// expected-error @+1 {{upper loop bound affine map with multiple results requires 'min' prefix}}
|
||||
for %i0 = %arg0 to ()[s]->(100,s+1)()[%arg1] {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user