Generated QIR is not valid when doing multi-qubit measurement inside a repeat statement.
To Reproduce
Steps to reproduce the behavior:
Compiling a Q# project with the following code and setting the projects <QirGeneration>true</QirGeneration> property generates QIR that fails verification:
namespace Issue {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
@EntryPoint()
operation Main() : Int {
use register = Qubit[5];
mutable count = 0;
repeat {
let results = MultiM(register);
if (results[0] == Zero)
{
set count += 1;
}
} until (count < 5);
return count;
}
}
After the QIR code is generated, use the llvm-as command on to generate bitcode:
llvm-as-13 qir/Program.ll -o qir/Program.bc
The following error is produced:
llvm-as-13: assembly parsed, but does not verify as correct!
Instruction does not dominate all uses!
%10 = call i64 @__quantum__rt__array_get_size_1d(%Array* %results)
%9 = sub i64 %10, 1
Describe the bug
Generated QIR is not valid when doing multi-qubit measurement inside a
repeat
statement.To Reproduce
Steps to reproduce the behavior:
Compiling a Q# project with the following code and setting the projects
<QirGeneration>true</QirGeneration>
property generates QIR that fails verification:After the QIR code is generated, use the
llvm-as
command on to generate bitcode:llvm-as-13 qir/Program.ll -o qir/Program.bc
The following error is produced: