Compiler Design
Consider the following program.
for (i = 1;i <= n;i++)
{
a = b + c;
}
for (i = 1;i <= n;i++)
{
a = b * d;
}
This code has problem of ?
(a) Dead code
(b) Constant folding
(c) Loop Jamming
(d) Loop unrolling
Answer
(c)
Because this can be done single loop.
for (i = 1; i <= n; i++)
{
a = b + c;
a = b * d; }
0Comment