You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When lowering hamiltonians, we first create an aggregate value and then store this aggregate value to an alloca pointer. We can avoid creating the aggregate value and store individual fields in the alloca pointer. In other words
Avoid creating values of aggregate types (i.e. structs and arrays). In particular, avoid loading and storing them, or manipulating them with insertvalue and extractvalue instructions. Instead, only load and store individual fields of the aggregate.
There are some exceptions to this rule:
It is fine to use values of aggregate type in global variable initializers.
It is fine to return structs, if this is done to represent the return of multiple values in registers.
It is fine to work with structs returned by LLVM intrinsics, such as the with.overflow family of intrinsics.
It is fine to use aggregate types without creating values. For example, they are commonly used in getelementptr instructions or attributes like sret.
The text was updated successfully, but these errors were encountered:
erick-xanadu
changed the title
Avoid using aggregate types when lowering Hamiltonian
[chore] Avoid using aggregate types when lowering Hamiltonian
Feb 10, 2025
When lowering hamiltonians, we first create an aggregate value and then store this aggregate value to an alloca pointer. We can avoid creating the aggregate value and store individual fields in the alloca pointer. In other words
Produces
when we could produce:
This appears to be more in line with what is stated in Performance Tips for Frontend Authors
The text was updated successfully, but these errors were encountered: