Skip to content

Commit da59957

Browse files
authored
[MLIR][Python] Fix detached operation coming from IfOp constructor (#107286)
Without this fix, `scf.if` operations would be created without a parent. Since `scf.if` operations often have no results, this caused silent bugs where the generated code was straight-up missing the operation.
1 parent eba6c40 commit da59957

File tree

1 file changed

+1
-1
lines changed
  • mlir/python/mlir/dialects

1 file changed

+1
-1
lines changed

mlir/python/mlir/dialects/scf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__(self, cond, results_=None, *, hasElse=False, loc=None, ip=None):
8787
operands.append(cond)
8888
results = []
8989
results.extend(results_)
90-
super().__init__(results, cond)
90+
super().__init__(results, cond, loc=loc, ip=ip)
9191
self.regions[0].blocks.append(*[])
9292
if hasElse:
9393
self.regions[1].blocks.append(*[])

0 commit comments

Comments
 (0)