Consider a loop with the following structure:
for(i = 0; i < n; i++) {
for(j = 0; j < n; j++) {
A[i][j] = A[i][j] + B[j][i];
}
}
Which optimization improves cache performance for this code?
GATE CSE · Compiler Design
Master topic for Matching. Includes Code Generation, Code Optimization.
61 questions · 0 PYQs · 20 AI practice · GATE CSE 2027
Consider a loop with the following structure:
for(i = 0; i < n; i++) {
for(j = 0; j < n; j++) {
A[i][j] = A[i][j] + B[j][i];
}
}
Which optimization improves cache performance for this code?
Which of the following is the primary goal of a code generator in a compiler?
Loop unrolling is an optimization that replicates the loop body multiple times. Which of the following are benefits of loop unrolling?
Consider the given control flow graph. Which of the following options correctly lists the set of redundant expressions (common sub-expressions) in the basic blocks B4 and B5? Note: All the variables are integers.

Available expressions analysis determines which expressions have already been computed and can be reused. An expression e is available at point p if:
A variable is said to be live at a statement in a program if the following three conditions hold simultaneously: The variables which are live both at the statement in basic block and at the statement in basic block of the above control flow graph are

Given the three-address code for a basic block:
(1) t1 = a * b
(2) t2 = t1 + c
(3) t3 = t1 * d
(4) e = t2 + t3
Assume a machine with 2 registers R0 and R1. What is the minimum number of STORE (spill) instructions needed to generate correct code for this block?
Consider the control flow graph shown. Which one of the following choices correctly lists the set of live variables at the exit point of each basic block?

Which of the following correctly classifies code optimization techniques?
Dataflow analysis is used to collect information about programs. Which of the following correctly describes the reaching definitions dataflow problem?
Which of the following correctly describes the difference between 'may' analysis and 'must' analysis in dataflow?
Which of the following correctly describes copy propagation as a code optimization performed before or during code generation?
The simple code generator algorithm for a basic block uses a register descriptor and an address descriptor. Which of the following correctly describes these descriptors?
Common Subexpression Elimination (CSE) optimizes code by avoiding redundant computation. Which of the following is a necessary condition for an expression to be a common subexpression that can be eliminated?
Which of the following dataflow analyses are backward analyses (information flows from program exit toward entry)?
Function inlining is an interprocedural optimization. Which of the following correctly describes the benefits and costs of function inlining?
Which of the following are TRUE about the relationship between code optimization and code generation phases in a compiler?
Loop-invariant code motion (LICM) is an important loop optimization. Which of the following correctly describes LICM?
Global value numbering (GVN) is an optimization that assigns numbers to values. Which of the following correctly describes GVN and how it differs from local value numbering?
Partial redundancy elimination (PRE) is a more powerful optimization than CSE. Which of the following correctly describes PRE?
Want unlimited AI-generated Matching questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →