Question: Given the following code, apply basic and loop optimization technique to simplify the code. while ( i 1 0 0 ) { a = Sin

Given the following code, apply basic and loop optimization technique to simplify the
code.
while (i100)
{
a=SinxCos(x)+i
b=a3+i**3
i++;
3
Instructions:
Construct a three-address code and then detect loops.
Follow the slides on how to detect loops (show all steps, finding leaders, creating
basic blocks and constructing program flow graph)
Once the loop is identified, optimize it using loop unrolling and frequency reduction
techniques also basic optimization techniques if needed.
Provide the optimized version of the loop after each optimization step.
Explain the rationale behind each optimization technique and how it improves the
efficiency of the loop.
Given the following code, apply basic and loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!