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

Exponentiation of constants should be evaluated at compile time #1582

Open
swernli opened this issue Dec 13, 2022 · 0 comments
Open

Exponentiation of constants should be evaluated at compile time #1582

swernli opened this issue Dec 13, 2022 · 0 comments
Labels
enhancement New request or suggestion for an improvement needs triage An initial review by a maintainer is needed

Comments

@swernli
Copy link
Contributor

swernli commented Dec 13, 2022

QIR generation makes use of some limited constant folding to enable features like loop unrolling and array access. However, exponentiation is not constant folded even when both parts of the call are known to be constant. This can cause otherwise valid loops to fail unrolling for hardware execution.

For example:

let limit = 4;
for _ in 1 .. 2^(limit) {
  ...
}

will not be unrolled while the equivalent:

let limit = 4;
for _ in 1 .. 2 <<< limit {
  ...
}

will be unrolled fully.

@swernli swernli added enhancement New request or suggestion for an improvement needs triage An initial review by a maintainer is needed labels Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New request or suggestion for an improvement needs triage An initial review by a maintainer is needed
Projects
None yet
Development

No branches or pull requests

1 participant