Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

QIR: returning %Range type by value is problematic for native integration #31

@IrinaYatsenko

Description

@IrinaYatsenko

While returning composite types by value (i.e. ret %Range %r) seems to be valid LLVM's IR, Clang doesn't generate correct assembly code from it and returned value isn't placed on the stack where the caller expects to find it. For C++ functions that return custom types by value, Clang generates IR with an output parameter:

struct Foo { long long a; long long b; long long c; };
Foo ReturnByValue(long long x) { return {x, 3, 7}; }
define void @ReturnByValue(%struct.Foo* noalias sret %0, i64 %1) {
  ...
  ret void
} 

However, the spec requires to always pass and return %Range by value.

Metadata

Metadata

Assignees

Labels

DocumentationIssues related to the specs or documentation maintained on this repositoryQIRIssues for discussions around the Quantum Intermediate Representation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions