File tree Expand file tree Collapse file tree 3 files changed +45
-47
lines changed Expand file tree Collapse file tree 3 files changed +45
-47
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,10 @@ void LoopOpInterface::getLoopOpSuccessorRegions(
44
44
45
45
// / Verify invariants of the LoopOpInterface.
46
46
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'" );
52
51
return llvm::success ();
53
52
}
54
53
Original file line number Diff line number Diff line change @@ -1532,3 +1532,44 @@ cir.global external dsolocal @vfp = #cir.ptr<null> : !cir.ptr<!cir.func<(!s32i)
1532
1532
1533
1533
// expected-error @below {{integer or floating point type}}
1534
1534
!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
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments