Quiz time
Now that you have completed reading this chapter, try answering the following questions to test your knowledge:
- Given the CLI name of an optimization, how can you check whether it is part of the middle end?
You can use the print-passes
option from opt
to check whether this name is part of one of the Module
, Function
, or Loop
pass categories.
See the Leveraging opt section for more details.
- Imagine that you have an existing pass that crashes on the output IR of one of your custom passes. What is one of the first things you can try before debugging the existing pass?
Start by putting the output IR through the verifier. Chances are your custom pass produces an invalid IR and this is what breaks the existing pass, since invalid IR must not be fed to passes.
See the The verifier section for more details.
- Where would you find the implementation of the common subexpression elimination (CSE) pass?
The CSE transformation...