blob: 4317e5a5a810263e18c20f42431a1dcf5bc7d752 [file] [edit]
// RUN: mlir-opt --lift-cf-to-scf -verify-diagnostics -split-input-file %s
// Verify that --lift-cf-to-scf does not crash when it encounters an
// unreachable blocks (dead code). Instead it should emit a clean error.
// See: https://github.com/llvm/llvm-project/issues/206086
module {
func.func @single_return_statement(%arg0: i32) -> i32 {
return %arg0 : i32
^bb1: // pred: ^bb1
// expected-error@below {{'arith.constant' op transformation does not support unreachable blocks}}
%true = arith.constant true
cf.cond_br %true, ^bb2, ^bb1
^bb2: // pred: ^bb1
return %arg0 : i32
}
}