Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code coverage breaks inline_const pass #10

Closed
Roger-luo opened this issue Feb 6, 2021 · 0 comments · Fixed by #11
Closed

code coverage breaks inline_const pass #10

Roger-luo opened this issue Feb 6, 2021 · 0 comments · Fixed by #11

Comments

@Roger-luo
Copy link
Member

Roger-luo commented Feb 6, 2021

currently, the test will fail when running test with julia --project --code-coverage. this is because the inserted Expr(:code_coverage_effect) somehow breaks it. to reproduce the problem, run following with julia --project --code-coverage:

using YaoCompiler

qasm"""OPENQASM 2.0;
include "test/compiler/qelib1.inc";

gate post q {x q;}
"""

@device function circuit()
           1:3 => ccx()
           (2, 3) => cx()
           2 => h()
           c = @measure 1
           if c == 1
               3 => post()
           end
           3 => rx(1.0)
           return (c=c, )
end

ci, = @code_yao optimize = true circuit()

and you will see

julia> ci.code[94]
:(%new(RoutineSpec{GenericRoutine{:tdg}, Tuple{}}, %90, ()))

where %90 is Main.tdg which is a constant, so %94 should be a constant too, but it isn't. I guess I need your help on this again @vchuravy I find out how to fix it in #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant