From 7994e7030976f9fcd321a4d1d5f76f4582e01905 Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Tue, 16 Apr 2024 14:27:43 -0700 Subject: [PATCH] Fix corner case in if_then_else simplification (#8189) Co-authored-by: Steven Johnson --- src/Simplify_Call.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Simplify_Call.cpp b/src/Simplify_Call.cpp index 33d11ccb8d06..29bc75aa2bb2 100644 --- a/src/Simplify_Call.cpp +++ b/src/Simplify_Call.cpp @@ -576,7 +576,11 @@ Expr Simplify::visit(const Call *op, ExprInfo *bounds) { } in_unreachable = false; if (true_unreachable) { - return false_value; + if (false_value.defined()) { + return false_value; + } else { + return make_zero(op->type); + } } else if (false_unreachable) { return true_value; }