Skip to content

Commit f100c06

Browse files
fangyi-zhoulanza
authored andcommitted
Revert "[CIR] Add back LoopOpInterface verification (llvm#1635)" (llvm#1638)
This reverts commit 0c944f9. Reverting due to build failure reported in llvm/clangir#1635 (comment)
1 parent 343319a commit f100c06

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed

clang/lib/CIR/Interfaces/CIRLoopOpInterface.cpp

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

4545
/// Verify invariants of the LoopOpInterface.
4646
llvm::LogicalResult detail::verifyLoopOpInterface(mlir::Operation *op) {
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'");
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'");
5152
return llvm::success();
5253
}
5354

clang/test/CIR/IR/invalid.cir

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

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

clang/test/CIR/IR/invalid_xfail.cir

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Test attempts to build bogus CIR
2+
// RUN: cir-opt %s -verify-diagnostics -split-input-file
3+
// XFAIL: *
4+
5+
#false = #cir.bool<false> : !cir.bool
6+
#true = #cir.bool<true> : !cir.bool
7+
cir.func @b0() {
8+
cir.scope {
9+
cir.while { // expected-error {{expected condition region to terminate with 'cir.condition'}}
10+
cir.yield
11+
} do {
12+
cir.br ^bb1
13+
^bb1:
14+
cir.return
15+
}
16+
}
17+
cir.return
18+
}
19+
20+
// -----
21+
22+
cir.func @invalid_cond_region_terminator(%arg0 : !cir.bool) -> !cir.void {
23+
cir.do { // expected-error {{op expected condition region to terminate with 'cir.condition'}}
24+
cir.yield
25+
} while {
26+
cir.yield
27+
}
28+
cir.return
29+
}
30+
31+
// -----
32+
33+
cir.func @invalidConditionTerminator (%arg0 : !cir.bool) -> !cir.void {
34+
cir.for : cond { // expected-error {{op expected condition region to terminate with 'cir.condition'}}
35+
cir.yield
36+
} body {
37+
cir.yield
38+
} step {
39+
cir.yield
40+
}
41+
cir.return
42+
}

0 commit comments

Comments
 (0)