From a9216ce6f76008711ef6d18da6c9310e93cb3cc7 Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Mon, 28 Aug 2023 15:43:51 -0700 Subject: [PATCH] Don't return an undefined Stmt() from IfThenElse visitor Fixes #7815 --- src/Simplify_Stmts.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Simplify_Stmts.cpp b/src/Simplify_Stmts.cpp index b1bac9f361d3..5be05e42e6c6 100644 --- a/src/Simplify_Stmts.cpp +++ b/src/Simplify_Stmts.cpp @@ -63,7 +63,11 @@ Stmt Simplify::visit(const IfThenElse *op) { if (else_unreachable) { return then_case; } else if (then_unreachable) { - return else_case; + if (else_case.defined()) { + return else_case; + } else { + return Evaluate::make(0); + } } if (is_no_op(else_case)) {