Skip to content

Commit 1c1b169

Browse files
yaoyaodingCopilot
andcommitted
Update python/tilus/extensions/hidet/transforms/declare_to_let.py
Co-authored-by: Copilot <[email protected]> Signed-off-by: Yaoyao Ding <[email protected]>
1 parent 951557f commit 1c1b169

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/tilus/extensions/hidet/transforms/declare_to_let.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ def visit_SeqStmt(self, seq_stmt: SeqStmt) -> Stmt:
9797
let_stmt = LetStmt(bind_vars=[stmt.var], bind_values=[stmt.value], body=self.concat(seq[i + 1 :]))
9898
seq = seq[:i] + [let_stmt]
9999
self.declare_to_remove.add(stmt.var)
100-
elif isinstance(stmt, DeclareStmt) and stmt.var in self.declare_to_remove:
100+
elif (
101+
isinstance(stmt, DeclareStmt)
102+
and stmt.var in self.declare_to_remove
103+
and stmt.init is None
104+
):
101105
# declare var (var is never assigned)
102106
# ...
103107
# assign var = value (var is only assigned here and never modified later)

0 commit comments

Comments
 (0)