The QIR spec specifically calls out the Range struct as passed by value, as seen here:
https://github.com/microsoft/qsharp-language/blob/9cb9b91a49341d691c4fdc7d3f464453cc8eae36/Specifications/QIR/Data-Types.md#simple-types
This makes implementation difficult as other LLVM languages, notable C, C++, and Rust, do not have a mechanism to achieve that, requiring a forwarding function to written in raw LLVM that can allocate memory, copy the struct, and then pass the struct as a pointer to the underlying implementation. If this line is change to instead indicate that the struct is passed by pointer, then it will line up with the way struct passing is translated in C, C++, and Rust and make direct implementation of the QIR functions that use Range possible where today they are not.
The QIR spec specifically calls out the
Range
struct as passed by value, as seen here: https://github.com/microsoft/qsharp-language/blob/9cb9b91a49341d691c4fdc7d3f464453cc8eae36/Specifications/QIR/Data-Types.md#simple-types This makes implementation difficult as other LLVM languages, notable C, C++, and Rust, do not have a mechanism to achieve that, requiring a forwarding function to written in raw LLVM that can allocate memory, copy the struct, and then pass the struct as a pointer to the underlying implementation. If this line is change to instead indicate that the struct is passed by pointer, then it will line up with the way struct passing is translated in C, C++, and Rust and make direct implementation of the QIR functions that useRange
possible where today they are not.@alan-geller @bettinaheim @kuzminrobin FYI