CP25C04 – Advanced Compiler Design
QUESTION & ANSWER GUIDE
UNIT 1 – Intermediate Representations & SSA
Q1. What is Static Single Assignment (SSA)?
A. SSA ensures every variable has a single assignment, enabling simpler data-flow analysis and
optimizations.
Q2. What is the purpose of Φ (phi) functions in SSA?
A. Phi functions select the correct variable version at control-flow merge points.
Q3. What is a Control Flow Graph?
A. A CFG is a graph where nodes are basic blocks and edges show the control flow of a program.
Q4. Why are Intermediate Representations used?
A. IRs help with portability, optimization, and clean separation between frontend and backend.
Q5. What is DAG representation used for?
A. DAGs eliminate common subexpressions and optimize repeated computations.
UNIT 2 – Data Flow Analysis & Loop Optimization
Q1. What is data-flow analysis?
A. It gathers information about how values propagate across program paths.
Q2. What are reaching definitions?
A. They identify which assignments can reach a particular program point.
Q3. What is live variable analysis?
A. It checks whether a variable's value will be needed in the future.
Q4. What is alias analysis?
A. It determines if two pointers refer to the same memory location.
Q5. What are common loop optimizations?
A. Unrolling, fusion, fission, tiling, and loop-invariant code motion.
UNIT 3 – Polyhedral & Loop Transformations
Q1. What is the polyhedral model?
A. A mathematical model to optimize affine loop nests using polyhedra.
Q2. What is loop tiling?
A. Breaking loops into smaller blocks to improve cache locality.
Q3. What is vectorization?
A. Transforming scalar operations to SIMD operations for speed.
UNIT 4 – JIT & LLVM
Q1. What is JIT compilation?
A. Compilation at runtime for better performance using profiling.
Q2. What is LLVM?
A. A modular compiler infrastructure with a powerful IR and JIT support.
Q3. What is GraalVM?
A. A polyglot virtual machine enabling high-performance execution of multiple languages.
UNIT 5 – Machine Learning in Compilers
Q1. How does ML help compiler optimization?
A. It predicts optimal passes, tunes parameters, and improves phase ordering.
Q2. What is autotuning?
A. Automatic selection of optimal configuration settings.
Q3. What is reinforcement learning used for in compilers?
A. To learn optimal optimization strategies through rewards.
UNIT 6 – DSLs & Accelerators
Q1. What is a DSL?
A. A domain-specific language designed for specific tasks (e.g., Halide, XLA).
Q2. What is Halide?
A. A DSL for image processing that separates algorithm from schedule.
Q3. What is XLA?
A. TensorFlow’s compiler for high-performance ML execution.
UNIT 7 – Verified & Secure Compilers
Q1. What is a verified compiler?
A. A compiler proven mathematically correct, e.g., CompCert.
Q2. What is secure IR?
A. IR designed to prevent undefined behavior and security vulnerabilities.
Q3. What is compiler fuzzing?
A. Testing compilers using random or mutated inputs to find bugs.