Machine-translated by Google. Questions are authored in English.
Top

Discussion

In peephole optimization, what is loop unrolling aimed at achieving ?

  • A.Reducing the number of loops
  • B.Eliminating conditional statements within loops
  • C.Decreasing the size of loops by removing redundant instructions
  • D.Expanding the body of a loop to reduce over head and improve parallelism

Answer: D

Loop unrolling aims at expanding the body of a loop to reduce overhead and improve parallelism.

Unrolling replicates the loop body several times and adjusts the loop counter, so the test, increment and branch are executed less often. The longer straight-line body also gives the scheduler more independent instructions to overlap.

It does not reduce the number of loops in the program, it does not remove conditionals inside the body, and it makes the loop larger, not smaller.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.