In Module.cc, we have implemented basic functionality to resolve entry points and interpret metadata in a QIR file. However, we have not yet implemented anything that takes advantage of the true LLVM IR capabilities: namely, code simplification and modification through automated refactoring passes.
We want a new interface and example of using LLVM passes to interpret and refactor QIR code. For each case here, add a new helper class in src/qiree (and a new test) that takes a Module and:
- Add dead block elimination: if a block is unreachable or empty, branch statements should bypass it. Add a test using
teleport.ll.
- Eliminate dead blocks, and reorder blocks so that the only branching from block A is
br <cond>, label B, label C, and block B jumps directly to block C. If multiple branching or else statements are encountered, raise an error. (This condition is necessary for QIREE to reformulate blocks as predicates e.g. for connecting with XACC). Test that it works on teleport.ll, and add a new QIR example test where it fails.
In Module.cc, we have implemented basic functionality to resolve entry points and interpret metadata in a QIR file. However, we have not yet implemented anything that takes advantage of the true LLVM IR capabilities: namely, code simplification and modification through automated refactoring passes.
We want a new interface and example of using LLVM passes to interpret and refactor QIR code. For each case here, add a new helper class in
src/qiree(and a new test) that takes a Module and:teleport.ll.br <cond>, label B, label C, and blockBjumps directly to blockC. If multiple branching orelsestatements are encountered, raise an error. (This condition is necessary for QIREE to reformulate blocks as predicates e.g. for connecting with XACC). Test that it works onteleport.ll, and add a new QIR example test where it fails.