Handle switch without cases
This commit is contained in:
parent
dce464e271
commit
f5b6c2b9cf
|
@ -650,6 +650,13 @@ ValueCategory MLIRScanner::VisitSwitchStmt(clang::SwitchStmt *stmt) {
|
|||
}
|
||||
}
|
||||
|
||||
if (caseVals.size() == 0) {
|
||||
delete &exitB;
|
||||
er.erase();
|
||||
builder.setInsertionPoint(oldblock2, oldpoint2);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (inCase)
|
||||
loops.pop_back();
|
||||
builder.create<mlir::BranchOp>(loc, &exitB);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: mlir-clang %s --function=foo -S | FileCheck %s
|
||||
|
||||
int foo(int t) {
|
||||
switch (t) {
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
// TODO the select should be canonicalized better
|
||||
// CHECK: func @foo(%arg0: i32) -> i32 attributes {llvm.linkage = #llvm.linkage<external>} {
|
||||
// CHECK-NEXT: return %arg0 : i32
|
||||
// CHECK-NEXT: }
|
Loading…
Reference in New Issue