Skip to content

code coverage breaks inline_const pass #10

@Roger-luo

Description

@Roger-luo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions