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

Connector of conventional keyboard, 5-pin DIN connector: It is the conn...

5-pin DIN connector: It is the connector of conventional keyboard which have 5 pins (2 IN, 2 OUT and one ground pin) used for transfer and synchronization.

Propositional truth tables, Propositional truth tables: There {X\t} is...

Propositional truth tables: There {X\t} is a substitution that replaces all occurances of variable X with a term representing an object t as:  ∀X. A is true if and only

What is data hazard, What is data hazard? Any condition that causes the...

What is data hazard? Any condition that causes the pipeline to stall is known as a hazard. A data hazard is any condition in which either the source or destination operands of

Challenges in changing information technology, Q: Challenges and Prospects ...

Q: Challenges and Prospects in Changing Information Technology? There is no doubt that information technology has made significant progress during the past two decades. Modern

Discuss the 5-level switching hierarchy recommended by ccitt, Discuss the 5...

Discuss the 5-level switching hierarchy recommended by CCITT. Hierarchical networks are able of handling heavy traffic where needed, and at similar time use minimal number of t

What is program controlled i/o, What is program controlled I/O? In prog...

What is program controlled I/O? In program controlled I/O the processor repeatedly checks a status flag to achieve the needed synchronization among the processor and an input a

Determining the error models that affect program execution, In critical com...

In critical computer applications the correctness of a delivered output and the continuity of the required service beside the speed of the used CPU are the most important measures

What is the chief advantage of using virtual packets, What is the chief adv...

What is the chief advantage of using virtual packets instead of frames? The router can't transfer a copy of a frame from one kind of network to another since the frame formats

Properties of e-cash, Properties: 1.  Monetary Value: Monetary value mu...

Properties: 1.  Monetary Value: Monetary value must be backed by either cash, bank - authorized credit cards or bank certified cashier's cheque. 2.  Interoperability: E-cash

Balanced trees and their operations, what is ment by avl tree n insertion n...

what is ment by avl tree n insertion n deletion ,2-3 tress insertion n deletion

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