diff --git a/src/relax/ir/expr_functor.cc b/src/relax/ir/expr_functor.cc index 14a704d729e3..26ce952626ef 100644 --- a/src/relax/ir/expr_functor.cc +++ b/src/relax/ir/expr_functor.cc @@ -670,7 +670,15 @@ void ExprMutator::ReEmitBinding(const VarBindingNode* binding, Expr new_value) { return; } - Var temp = WithStructInfo(new_var, GetStructInfo(new_value)); + auto new_sinfo = new_value->struct_info_.as(); + + ICHECK(new_sinfo) + << "InternalError: " + << "In binding of variable " << binding->var << ", the value " << new_value + << " does not have StructInfo. " + << "This typically occurs when ReEmitBinding is called without first calling Normalize."; + + Var temp = WithStructInfo(new_var, new_sinfo.value()); if (!temp.same_as(new_var)) { new_var = temp; }