____ merges the bodies of two loops.
- Loop rolling
- Loop folding
- Loop merge
- Loop jamming
Answer: D
Explanation:
In loop jamming, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other. It reduces the time taken to compile the many number of loops.
Example:
Initial Code: for(int i=0; i<5; i++) a = i + 5; for(int i=0; i<5; i++) b = i + 10;
Using Loop jamming above code converted into below Optimized code :
for(int i=0; i<5; i++) { a = i + 5; b = i + 10; }
Practice unlimited Gate CSE Questions
Do U have Better Solution?
Contribute your Solution in the Comment Section below.
GATE, ISRO, BARC, UGC-NET, NIELIT
Online Test Series available.