Explain loop-invariant code motion, Computer Engineering

Assignment Help:

Explain briefly Loop-invariant code motion of the commonly used code optimization techniques.

Loop-invariant code motion

If a quantity is calculated inside a loop during iteration and its value is similar for iteration, this can vastly improve efficiency to hoist this outside the loop and calculate its value just once before the loop begins. It is particularly significant with the address-calculation expressions generated through loops over arrays. For accurate implementation, such technique must be utilized with loop inversion, since not all code is safe to be hoisted outside the loop.

For illustration:

 for (i=1; i≤10, i++){

x=y*2-(1)

.

.

.

}

statement 1 can be hoisted outside the loop assuming value of x and y does not modify in the loop.


Related Discussions:- Explain loop-invariant code motion

Describe data transfer instructions, Q. Describe Data Transfer Instructions...

Q. Describe Data Transfer Instructions? These instructions transfer data from one location in the computer to another location without altering the data content. Most common tr

Subtract, Write the Add/subtract rule for floating point numbers. Ans:...

Write the Add/subtract rule for floating point numbers. Ans: a. Select the number with the smaller exponent and shift its mantissa right a number of steps equal to the differe

By which MTU is specified, MTU is specified by? MTU is specified by har...

MTU is specified by? MTU is specified by hardware technology.

How can we read .doc document in asp.net, How can I read .doc document in A...

How can I read .doc document in ASP.Net? You can read from a text file like this.   Private void Button12_Click(object sender, System.EventArgs e) { string path="C:

Which function type is used for using "at exit-command", Which Function typ...

Which Function type has to be used for using "at exit-command" ? To Use AT EXIT - COMMAND, We must assign a function Type "E" to the relevant function in the MENU Painter OR S

Sort, quick sort working

quick sort working

Visibility, hidden edge/surface removal

hidden edge/surface removal

Types of buses, different types of buses with diagram

different types of buses with diagram

Show basic concepts of permutation, Q. Show Basic concepts of permutation? ...

Q. Show Basic concepts of permutation? Let us look at the basic concepts of permutation with respect to interconnection network.  Let us say the network has set of n input node

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd