diff --git a/src/tir/ir/data_type_rewriter.cc b/src/tir/ir/data_type_rewriter.cc index b0457a12398a..346f1ab63250 100644 --- a/src/tir/ir/data_type_rewriter.cc +++ b/src/tir/ir/data_type_rewriter.cc @@ -373,18 +373,17 @@ Map IndexDataTypeRewriter::VisitBlockAnnotations( const Map& annotations) { auto new_annotations = annotations; - std::function f_mutate_obj = - [this, &f_mutate_obj](const ObjectRef& obj) -> ObjectRef { - if (!obj.defined()) { + std::function f_mutate_obj = [this, &f_mutate_obj](const Any& obj) -> Any { + if (obj == nullptr) { return obj; } - if (obj->IsInstance()) { + if (obj.as()) { Buffer buffer = Downcast(obj); if (Buffer new_buffer = GetRemappedBuffer(buffer); !new_buffer.same_as(buffer)) { return new_buffer; } - } else if (obj->IsInstance()) { - return Downcast>(obj).Map(f_mutate_obj); + } else if (obj.as()) { + return Downcast>(obj).Map(f_mutate_obj); } return obj; };