You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2022/11/18 20:30:51 UTC
[tvm] branch main updated: [TE] Remove binding to temporary variable (#13430)
This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 80f8e8bb74 [TE] Remove binding to temporary variable (#13430)
80f8e8bb74 is described below
commit 80f8e8bb74d8f4d026116d86a7b1d81a9e69fbcf
Author: Eric Lunderberg <Lu...@users.noreply.github.com>
AuthorDate: Fri Nov 18 14:30:42 2022 -0600
[TE] Remove binding to temporary variable (#13430)
The call to `analyzer->Simplify` returns a `PrimExpr` object. Binding
a `const PrimExpr&` to this temporary object results in a dangling
reference.
---
src/te/operation/create_primfunc.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/te/operation/create_primfunc.cc b/src/te/operation/create_primfunc.cc
index d797350eed..9f8d7d46a1 100644
--- a/src/te/operation/create_primfunc.cc
+++ b/src/te/operation/create_primfunc.cc
@@ -156,8 +156,8 @@ BlockRealize GenerateBlockFromTensors(const te::ComputeOp& compute_op,
Var new_var(iter_var->var->name_hint, iter_var->var->dtype);
var_map[iter_var->var.get()] = new_var;
- const PrimExpr& dom_min = analyzer->Simplify(iter_var->dom->min);
- const PrimExpr& dom_extent = analyzer->Simplify(iter_var->dom->extent);
+ PrimExpr dom_min = analyzer->Simplify(iter_var->dom->min);
+ PrimExpr dom_extent = analyzer->Simplify(iter_var->dom->extent);
iter_vars.push_back(IterVar(Range::FromMinExtent(dom_min, dom_extent), new_var,
iter_var->iter_type, iter_var->thread_tag, iter_var->span));
}