File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
frontend/catalyst/python_interface/visualization Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -357,12 +357,16 @@ def _flatten_if_op(op: scf.IfOp) -> list[Region]:
357357 has_quantum_ops = False
358358 nested_if_op = None
359359 for op in else_block .ops :
360+ if isinstance (op , scf .IfOp ):
361+ nested_if_op = op
362+ # No need to walk this op as this will be
363+ # recursively handled down below
364+ continue
360365 for internal_op in op .walk ():
361- if isinstance (internal_op , scf .IfOp ):
362- nested_if_op = internal_op
363- break
364- if "quantum" in internal_op .name :
366+ if type (internal_op ) in quantum .Quantum .operations :
365367 has_quantum_ops = True
368+ # No need to check anything else
369+ break
366370
367371 if nested_if_op and not has_quantum_ops :
368372 # Recursively flatten any IfOps found in said block
You can’t perform that action at this time.
0 commit comments