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

Test, what persistance shouold i use

what persistance shouold i use

Computer graphics, what isAdvantages of scan line algorithm, Computer Graph...

what isAdvantages of scan line algorithm, Computer Graphics?

Give the sequence of procedure calls for server and client, Give the sequen...

Give the sequence of procedure calls for both server and client for connect ion-oriented application.   In connection oriented communication the order of Procedure call

Dbms, what is cascading rolback?

what is cascading rolback?

?????, c program??????????

c program??????????

Name of all sap databases, All SAP Databases are Relational Databases ...

All SAP Databases are Relational Databases is the all sap databases.

Build data flow diagrams showing functional dependencies, Build data Flow d...

Build data Flow diagrams showing functional dependencies Data flow diagrams are very useful for showing functional dependencies. In data flow diagrams processes are indicated

Describe about relationships and look up fields, Relationships are imported...

Relationships are imported from the source to finish without any hindrance but once they land in the destination they can never be changed or changed and change of extensions canno

Fetching a word from memory - computer architecture, Fetching a word from m...

Fetching a word from memory: CPU transfers the address of the needed information word to the memory address register (MAR). Address of the needed word is transferred to the pr

Er diagrams, how can I draw er diagram for sell & storage section of a drug...

how can I draw er diagram for sell & storage section of a drugstore?

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