Skip to content

Commit c368eff

Browse files
committed
only support walkresult as return type
1 parent e19c29c commit c368eff

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

mlir/lib/Ion/Transforms/ion-to-rtio.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ enum class TraceMode {
7676
template <TraceMode ModeT, typename CallbackT>
7777
auto traceValueWithCallback(Value value, CallbackT &&callback)
7878
{
79+
static_assert(std::is_same_v<std::invoke_result_t<CallbackT, Value>, WalkResult>,
80+
"Callback must return WalkResult");
81+
7982
WalkResult walkResult = WalkResult::advance();
8083
std::queue<Value> worklist;
8184
worklist.push(value);
@@ -84,14 +87,9 @@ auto traceValueWithCallback(Value value, CallbackT &&callback)
8487
Value value = worklist.front();
8588
worklist.pop();
8689

87-
if constexpr (std::is_same_v<std::invoke_result_t<CallbackT, Value>, WalkResult>) {
88-
if (callback(value).wasInterrupted()) {
89-
walkResult = WalkResult::interrupt();
90-
continue;
91-
}
92-
}
93-
else {
94-
callback(value);
90+
if (callback(value).wasInterrupted()) {
91+
walkResult = WalkResult::interrupt();
92+
continue;
9593
}
9694

9795
if (auto arg = mlir::dyn_cast<BlockArgument>(value)) {

0 commit comments

Comments
 (0)