Content-Length: 365548 | pFad | http://github.com/llvm/clangir/commit/0c944f9968fdd004af42048e129a646b057da275

D8 [CIR] Add back LoopOpInterface verification (#1635) · llvm/clangir@0c944f9 · GitHub
Skip to content

Commit 0c944f9

Browse files
authored
[CIR] Add back LoopOpInterface verification (#1635)
This commit essentially is a revert of 656151f. It appears that the underlying issues are resolved. Closes #425 and #927
1 parent be501d5 commit 0c944f9

File tree

3 files changed

+45
-47
lines changed

3 files changed

+45
-47
lines changed

clang/lib/CIR/Interfaces/CIRLoopOpInterface.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ void LoopOpInterface::getLoopOpSuccessorRegions(
4444

4545
/// Verify invariants of the LoopOpInterface.
4646
llvm::LogicalResult detail::verifyLoopOpInterface(mlir::Operation *op) {
47-
// FIXME: fix this so the conditionop isn't requiring MLIRCIR
48-
// auto loopOp = mlir::cast<LoopOpInterface>(op);
49-
// if (!mlir::isa<ConditionOp>(loopOp.getCond().back().getTerminator()))
50-
// return op->emitOpError(
51-
// "expected condition region to terminate with 'cir.condition'");
47+
auto loopOp = mlir::cast<LoopOpInterface>(op);
48+
if (!mlir::isa<ConditionOp>(loopOp.getCond().back().getTerminator()))
49+
return op->emitOpError(
50+
"expected condition region to terminate with 'cir.condition'");
5251
return llvm::success();
5352
}
5453

clang/test/CIR/IR/invalid.cir

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,3 +1532,44 @@ cir.global external dsolocal @vfp = #cir.ptr<null> : !cir.ptr<!cir.func<(!s32i)
15321532

15331533
// expected-error @below {{integer or floating point type}}
15341534
!complex = !cir.complex<!cir.ptr<!cir.void>>
1535+
1536+
// -----
1537+
1538+
#false = #cir.bool<false> : !cir.bool
1539+
#true = #cir.bool<true> : !cir.bool
1540+
cir.func @b0() {
1541+
cir.scope {
1542+
cir.while { // expected-error {{expected condition region to terminate with 'cir.condition'}}
1543+
cir.yield
1544+
} do {
1545+
cir.br ^bb1
1546+
^bb1:
1547+
cir.return
1548+
}
1549+
}
1550+
cir.return
1551+
}
1552+
1553+
// -----
1554+
1555+
cir.func @invalid_cond_region_terminator(%arg0 : !cir.bool) -> !cir.void {
1556+
cir.do { // expected-error {{op expected condition region to terminate with 'cir.condition'}}
1557+
cir.yield
1558+
} while {
1559+
cir.yield
1560+
}
1561+
cir.return
1562+
}
1563+
1564+
// -----
1565+
1566+
cir.func @invalidConditionTerminator (%arg0 : !cir.bool) -> !cir.void {
1567+
cir.for : cond { // expected-error {{op expected condition region to terminate with 'cir.condition'}}
1568+
cir.yield
1569+
} body {
1570+
cir.yield
1571+
} step {
1572+
cir.yield
1573+
}
1574+
cir.return
1575+
}

clang/test/CIR/IR/invalid_xfail.cir

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/llvm/clangir/commit/0c944f9968fdd004af42048e129a646b057da275

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy