[QIR] Alias management on arrays can have major perf impact #975
Description
Whenever an array in QIR is set to a new variable, the alias counts on each item have to be incremented for the new alias and later decremented if the previous variable goes out of scope. This can also happen when returning an array from a callable, such that the return results in a loop over each element decrementing alias count and then the caller will have a loop over every element incrementing the alias count when capturing the returned value in a variable. In some testing, we have algorithms where list sizes can get very large (up to 500k), and the repeated looping over the elements for alias count management noticeably impacts perf as the array is passed around. We should investigate a way to optimize alias and reference counting for contained items to avoid having to scale by array size.