CQCL / guppylang

Pythonic quantum-classical programming language
https://pypi.org/project/guppylang
Apache License 2.0
18 stars 2 forks source link

Use True/False constants for cfg branching if known at compile time #131

Open ss2165 opened 6 months ago

ss2165 commented 6 months ago

avoid needless Tag(0, MakeTuple()) calls

mark-koch commented 6 months ago

This Tag(0, MakeTuple()) is also needed if there is only a single successor. Do we also want to use a constant in that case?

If the True/False value of a branch is known at compile-time, I think an even better solution would be to just remove the unreachable branch. This should also make our program analysis a bit smarter

ss2165 commented 6 months ago

This Tag(0, MakeTuple()) is also needed if there is only a single successor. Do we also want to use a constant in that case?

Yes

If the True/False value of a branch is known at compile-time, I think an even better solution would be to just remove the unreachable branch.

Perhaps, but any HUGR compiler should do that as a normalisation pass pretty early on