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

Explain the importance of computer architecture, Explain the importance of ...

Explain the importance of Computer architecture Computer architecture courses cover application, organization, architecture, logic and transistor layers. However, four other la

Illustrate about compact disk rewritable, Q. Illustrate about Compact Disk ...

Q. Illustrate about Compact Disk Rewritable? CD-RW optical disk can be repeatedly written and overwritten same as with a magnetic disk. Even though a number of techniques have

Application area of artificial intelligence, 1. The State of the Art: What ...

1. The State of the Art: What can AI do today? A concise answer is difficult because there are so many activities in so many subfields. Here we sample a few applications other

What is uml, ? UML is called as Unified Modeling Language. ? it is used...

? UML is called as Unified Modeling Language. ? it is used to Graphical language for visualizing artifacts of the system. ? It Allow to make a blue print of all the aspects

Illustrate the cache memory operation, Q. Illustrate the Cache Memory Opera...

Q. Illustrate the Cache Memory Operation? It comprises a copy of a part of main memory contents. When a program is running and CPU tries to read a word of memory (instruction o

What are the requirements for a swapper to work, What are the requirements ...

What are the requirements for a swapper to work? The swapper works on the highest scheduling priority. Firstly it will look for any sleeping method, if not found then it will

How codes represent data for scientific calculations?, Q. How codes represe...

Q. How codes represent data for scientific calculations? How codes are in fact used to represent data for scientific calculations? The computer is a discrete digital device

Shell is the exclusive feature of, Shell is the exclusive feature of? A...

Shell is the exclusive feature of? Ans. Shell is the exclusive feature of UNIX.

Cache misses - computer architecture, Cache Misses Compulsory misse...

Cache Misses Compulsory misses -  it is caused by initial access to a block that has never been in the cache (also called cold start misses Capacity miss - it is cause

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