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

Difference among activity and sequence diagram, a. Activity diagram: Activi...

a. Activity diagram: Activity diagram is used for functional modelling. Captures the process flow. b.  Sequence diagram :  Sequence diagram is  used for dynamic modeling.

Push and pop, Suupose a stack-oriented processor that haves the stack opera...

Suupose a stack-oriented processor that haves the stack operations PUSH and POP.  Arithmetic operations automatically involve the top one or two stack elements. Starting with an

What are the aspects of CAD, What are the aspects of CAD Increased use ...

What are the aspects of CAD Increased use of computers has led to many of the above affects. Other aspects to consider include: -  deskilling of the work force (for illustra

How to select valid lines for secondary list, How to select valid lines for...

How to select valid lines for secondary list? To stop the user from selecting invalid lines, ABAP/4 offers various possibilities.  At the end of the processing block END-OF-SEL

Restore the system defaults, In order to restore the system defaults for al...

In order to restore the system defaults for all changes made with the format statement is Format Reset

How can we send data to external programs, How can we send data to external...

How can we send data to external programs? Using SPA/GPA parameters(SAP memory). Using EXPORT/IMPORT data (ABAP/4 memory)

Choosing a micro-controller, There are many different forms of micro-contro...

There are many different forms of micro-controller and a manufacturer, selecting the proper micro-controller for your application is one of the critical decisions which controls th

Concurrently read exclusively write, Q. Concurrently read exclusively write...

Q. Concurrently read exclusively write? It's one of the models based on PRAM. In this model, processors access the memory location simultaneously for reading whereas exclusivel

Execution error and compilation error, Execution error and compilation erro...

Execution error and compilation error: Errors like as mismatch of data types or array out of bound error are called as execution errors or runtime errors. These errors are us

Explain about registers, Q. Explain about Registers? A register is a gr...

Q. Explain about Registers? A register is a group of flip-flops that store binary information and gates that controls when and how information is transferred to register. An n-

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