SlideShare a Scribd company logo
3
Most read
11
Most read
13
Most read
PRINCIPAL SOURCES OF OPTIMAZATION
Presented by
S.Sivasathya
BP150510
INTRODUCTION
 The code produced by the straight forward compiling algorithms
can often be made to run faster or take less space, or both.
This improvement is achieved by program transformations that are
traditionally called optimizations.
Compilers that apply code-improving transformations are called
optimizing compilers.
 Optimizations are classified into two categories.
 Machine independent optimizations:
 Machine dependant optimizations:
Machine independent optimizations:
 Machine independent optimizations are program transformations
that improve the target code
 without taking into consideration any properties of the target
machine.
Machine dependant optimizations:
 Machine dependant optimizations are based on register allocation
and utilization of special.
 machine-instruction sequences.
The criteria for code improvement transformations:
 Simply stated, the best program transformations are those that
yield the most benefit for the least effort.
 Flow analysis is a fundamental prerequisite for many important
types of code improvement.
CONT.…..
 Generally control flow analysis precedes data flow analysis.
 Control flow analysis (CFA) represents flow of control usually in
form of graphs, CFA
 constructs such as
control flow graph
Call graph
 Data flow analysis (DFA) is the process of ascerting and collecting
information prior to program execution about the possible
modification, preservation, and use of certain entities (such as values
or attributes of variables) in a computer program.
PRINCIPAL SOURCES OF OPTIMIZATION
 A transformation of a program is called local if it can be
performed by looking only at the statements in a basic block;
otherwise, it is called global.
 Many transformations can be performed at both the local and
global levels. Local transformations are usually performed first.
Function-Preserving Transformations
 There are a number of ways in which a compiler can improve a
program without changing the function it computes.
CONT.…..
The transformations:
 Common sub expression elimination,
 Copy propagation,
 Dead-code elimination, and
 Constant folding
 are common examples of such function-preserving
transformations.
 The other transformations come up primarily when global
optimizations are performed.
 Frequently, a program will include several calculations of the
same value, such as an offset in an array. Some of the
duplicate calculations cannot be avoided by the programmer
because they lie below the level of detail accessible within the
source language.
Common Sub expressions elimination:
 An occurrence of an expression E is called a common sub-
expression if E was previously computed, and the values of
variables in E have not changed since the previous computation.
We can avoid recomputing the expression if we can use the
previously computed value.
 For example
 t1: = 4*i
 t2: = a [t1]
 t3: = 4*j
 t4: = 4*i
 t5: = n
 t6: = b [t4] +t5
CONT.……
 The above code can be optimized using the common sub-expression
elimination as
 t1: = 4*i
 t2: = a [t1]
 t3: = 4*j
 t5: = n
 t6: = b [t1] +t5
 The common sub expression t4: =4*i is eliminated as its
computation is already in t1. And value of i is not been changed
from definition to use.
Copy Propagation:
 Assignments of the form f : = g called copy statements, or copies for
short.
 The idea behind the copy-propagation transformation is to use g for
f, whenever possible after the copy statement f: = g.
 Copy propagation means use of one variable instead of another.
 This may not appear to be an improvement, but as we shall see it
gives us an opportunity to eliminate x.
CONT.….
For example:
 x=Pi;
 ……
 A=x*r*r;
 The optimization using copy propagation can be done as follows:
 A=Pi*r*r;
 Here the variable x is eliminated
Dead-Code Eliminations:
 A variable is live at a point in a program if its value can be used
subsequently; otherwise, it is dead at that point.
 A related idea is dead or useless code, statements that compute
values that never get used.
 While the programmer is unlikely to introduce any dead code
intentionally ,it may appear as the result of previous
transformations.
An optimization can be done by eliminating dead code.
 Example:
 i=0;
 if(i=1)
 {
 a=b+5;
 }
CONT.….
 Here, ‘if’ statement is dead code because this condition will never
get satisfied.
 We can eliminate both the test and printing from the object code.
More generally,
 deducing at compile time that the value of an expression is a
constant and using the
 constant instead is known as constant folding.
 One advantage of copy propagation is that it often turns the copy
statement into dead
 code.
 For example,
 a=3.14157/2 can be replaced by
 a=1.570 there by eliminating a division operation.
Loop Optimizations:
 We now give a brief introduction to a very important place for
optimizations, namely loops, especially the inner loops where
programs tend to spend the bulk of their time.
 The running time of a program may be improved if we decrease the
number of instructions in an inner loop, even if we increase the
amount of code outside that loop.
 Three techniques are important for loop optimization:
 code motion, which moves code outside a loop;
 Induction-variable elimination, which we apply to replace
variables from inner loop.
 Reduction in strength, which replaces and expensive operation by
a cheaper one, such as a multiplication by an addition.
Code Motion:
 An important modification that decreases the amount of code in a
loop is code motion.
 This transformation takes an expression that yields the same result
independent of the number of times a loop is executed ( a loop-
invariant computation) and places the expression before the loop.
 Note that the notion “before the loop” assumes the existence of an
entry for the loop.
 For example, evaluation of limit-2 is a loop-invariant computation in
the following while-statement:
 while (i <= limit-2) /* statement does not change limit*/
 Code motion will result in the equivalent of
 t= limit-2;
 while (i<=t) /* statement does not change limit or t */
Induction Variables :
 Loops are usually processed inside out. For example consider the loop
around B3.
 Note that the values of j and t4 remain in lock-step; every time the
value of j decreases by 1, that of t4 decreases by 4 because 4*j is
assigned to t4. Such identifiers are called induction variables.
 When there are two or more induction variables in a loop, it may be
possible to get rid of all but one, by the process of induction-variable
elimination. For the inner loop around B3 in Fig. we cannot get rid of
either j or t4 completely; t4 is used in B3 and j in B4.
 However, we can illustrate reduction in strength and illustrate a part of
the process of induction-variable elimination.
 Eventually j will be eliminated when the outer loop of B2- B5 is
considered.
Example:
 As the relationship t4:=4*j surely holds after such an assignment to
t4 in Fig. and t4 is not changed elsewhere in the inner loop around
B3, it follows that just after the statement j:=j-1 the relationship t4:=
4*j-4 must hold.
 We may therefore replace the assignment t4:=4*j by t4:= t4-4. The
only problem is that t4 does not have a value when we enter block
B3 for the first time.
 Since we must maintain the relationship t4=4*j on entry to the
block B3, we place an initializations of t4 at the end of the block
where j itself is The replacement of a multiplication by a subtraction
will speed up the object code if multiplication takes more time than
addition or subtraction, as is the case on many machines.
Principle source of optimazation
Thank You

More Related Content

What's hot (20)

PPTX
Peephole optimization techniques in compiler design
Anul Chaudhary
 
PPTX
Recognition-of-tokens
Dattatray Gandhmal
 
PPTX
Code generation
Aparna Nayak
 
PPT
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
PDF
I. AO* SEARCH ALGORITHM
vikas dhakane
 
PPTX
Peephole Optimization
United International University
 
PPT
Multi Head, Multi Tape Turing Machine
Radhakrishnan Chinnusamy
 
PDF
Address in the target code in Compiler Construction
Muhammad Haroon
 
PPTX
Generating code from dags
indhu mathi
 
PPTX
Heap Management
Jenny Galino
 
PPTX
Three Address code
Pooja Dixit
 
PPTX
Syntax Analysis in Compiler Design
MAHASREEM
 
PDF
Symbol table in compiler Design
Kuppusamy P
 
PPTX
Code Optimization
Akhil Kaushik
 
PPTX
Mobile Transport layer
Pallepati Vasavi
 
PPTX
Specification-of-tokens
Dattatray Gandhmal
 
PPTX
Type checking in compiler design
Sudip Singh
 
PPT
distributed shared memory
Ashish Kumar
 
PPTX
Analytical learning
swapnac12
 
PDF
Working principle of Turing machine
Karan Thakkar
 
Peephole optimization techniques in compiler design
Anul Chaudhary
 
Recognition-of-tokens
Dattatray Gandhmal
 
Code generation
Aparna Nayak
 
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
I. AO* SEARCH ALGORITHM
vikas dhakane
 
Peephole Optimization
United International University
 
Multi Head, Multi Tape Turing Machine
Radhakrishnan Chinnusamy
 
Address in the target code in Compiler Construction
Muhammad Haroon
 
Generating code from dags
indhu mathi
 
Heap Management
Jenny Galino
 
Three Address code
Pooja Dixit
 
Syntax Analysis in Compiler Design
MAHASREEM
 
Symbol table in compiler Design
Kuppusamy P
 
Code Optimization
Akhil Kaushik
 
Mobile Transport layer
Pallepati Vasavi
 
Specification-of-tokens
Dattatray Gandhmal
 
Type checking in compiler design
Sudip Singh
 
distributed shared memory
Ashish Kumar
 
Analytical learning
swapnac12
 
Working principle of Turing machine
Karan Thakkar
 

Viewers also liked (20)

PDF
How One Billion Salesforce records Can Be Replicated with Minimal API Usage
Baruch Oxman
 
PPTX
Process Optimization & Slop Oil Reduction( Fahad Khan)
Fahad Khan([email protected])
 
PPT
2008 IFAC World Congress: Oil and gas production optimization - lost potentia...
Steinar Elgsæter
 
PDF
Smart Process Operations in Fuels Industries: Applications and Opportunities ...
Brenno Menezes
 
PDF
Modelling, Simulation and Optimization of Refining Processes
CTBE - Brazilian Bioethanol Sci&Tech Laboratory
 
PDF
Chemical Engineering Design II Final Project - Optimization of Heavy Oil Stri...
Ryan Dinn
 
PDF
Supply chain
Sachin Gawle
 
PPTX
Modeling and Optimization of In-Situ Oil Production
Alvaro Gil
 
PDF
Inside the Force.com Query Optimizer Webinar
Salesforce Developers
 
PDF
Biogas technology - A renewable source of energy
Janak Shah
 
PDF
Crude-Oil Scheduling Technology: moving from simulation to optimization
Brenno Menezes
 
PDF
INTEGRATED COW FARM-BIOGAS-ORGANIC FERTILIZER
MARROS LESTARI
 
PDF
Biogas technology
H Janardan Prabhu
 
PDF
Understanding the Salesforce Architecture: How We Do the Magic We Do
Salesforce Developers
 
PPTX
Oil & gas
Johhny Bravo
 
PPTX
A Study Of Production Optimization Of An Oil Copy
aadrish
 
PPTX
Biogas plant designs and engery calculations by ali saqlain
ali saqlain
 
PDF
BIOGAS for Everyone : Simplified for all
Centre for Application of renewable Energy
 
PDF
Crude-Oil Blend Scheduling Optimization: An Application with Multi-Million D...
Alkis Vazacopoulos
 
PDF
Oil-Refinery Planning & Scheduling Optimization
Alkis Vazacopoulos
 
How One Billion Salesforce records Can Be Replicated with Minimal API Usage
Baruch Oxman
 
Process Optimization & Slop Oil Reduction( Fahad Khan)
Fahad Khan([email protected])
 
2008 IFAC World Congress: Oil and gas production optimization - lost potentia...
Steinar Elgsæter
 
Smart Process Operations in Fuels Industries: Applications and Opportunities ...
Brenno Menezes
 
Modelling, Simulation and Optimization of Refining Processes
CTBE - Brazilian Bioethanol Sci&Tech Laboratory
 
Chemical Engineering Design II Final Project - Optimization of Heavy Oil Stri...
Ryan Dinn
 
Supply chain
Sachin Gawle
 
Modeling and Optimization of In-Situ Oil Production
Alvaro Gil
 
Inside the Force.com Query Optimizer Webinar
Salesforce Developers
 
Biogas technology - A renewable source of energy
Janak Shah
 
Crude-Oil Scheduling Technology: moving from simulation to optimization
Brenno Menezes
 
INTEGRATED COW FARM-BIOGAS-ORGANIC FERTILIZER
MARROS LESTARI
 
Biogas technology
H Janardan Prabhu
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Salesforce Developers
 
Oil & gas
Johhny Bravo
 
A Study Of Production Optimization Of An Oil Copy
aadrish
 
Biogas plant designs and engery calculations by ali saqlain
ali saqlain
 
BIOGAS for Everyone : Simplified for all
Centre for Application of renewable Energy
 
Crude-Oil Blend Scheduling Optimization: An Application with Multi-Million D...
Alkis Vazacopoulos
 
Oil-Refinery Planning & Scheduling Optimization
Alkis Vazacopoulos
 
Ad

Similar to Principle source of optimazation (20)

PPTX
Code optmize.pptx which is related to coding
vamami6395
 
PPT
basics of optimizations presentation s
AnkitKumarSharma26
 
PPTX
complier design unit 5 for helping students
aniketsugandhi1
 
PDF
Optimization
Royalzig Luxury Furniture
 
PDF
Optimization
Royalzig Luxury Furniture
 
PPT
457418.-Compiler-Design-Code-optimization.ppt
Incredible20
 
PPTX
Compiler Design theory and various phases of compiler.pptx
aabbpy249
 
PPTX
Compiler Design_Code Optimization tech.pptx
RushaliDeshmukh2
 
PPT
Code Optimization Lec#7.ppt Code Optimizer
zeeshanmubeen1
 
PPTX
Code optimization
Pradip Bhattarai
 
PPTX
Introduction to code optimization by dipankar
Dipankar Nalui
 
PPTX
UNIT V - Compiler Design notes power point presentation
KowsalyaG17
 
PDF
TSR CLASS CD-UNIT 5.pdf sddfsfdsfqweqdew
vtu21524
 
PDF
TSR CLASS CD-UNIT 5.pdf sddfsfdsfqweqdew
vtu21524
 
PDF
Compiler Design- Machine Independent Optimizations
Jyothishmathi Institute of Technology and Science Karimnagar
 
PPTX
Machine_Learning_JNTUH_R18_UNIT5_CONCEPTS.pptx
Hemavanth1
 
PPTX
Principal Sources of Optimization in compiler design
LogsAk
 
PPTX
Bp150513(compiler)
indhu mathi
 
PPT
code optimization
Sanjeev Raaz
 
PPT
code optimization 1...code optimization-1221849738688969-9
Sanjeev Raaz
 
Code optmize.pptx which is related to coding
vamami6395
 
basics of optimizations presentation s
AnkitKumarSharma26
 
complier design unit 5 for helping students
aniketsugandhi1
 
457418.-Compiler-Design-Code-optimization.ppt
Incredible20
 
Compiler Design theory and various phases of compiler.pptx
aabbpy249
 
Compiler Design_Code Optimization tech.pptx
RushaliDeshmukh2
 
Code Optimization Lec#7.ppt Code Optimizer
zeeshanmubeen1
 
Code optimization
Pradip Bhattarai
 
Introduction to code optimization by dipankar
Dipankar Nalui
 
UNIT V - Compiler Design notes power point presentation
KowsalyaG17
 
TSR CLASS CD-UNIT 5.pdf sddfsfdsfqweqdew
vtu21524
 
TSR CLASS CD-UNIT 5.pdf sddfsfdsfqweqdew
vtu21524
 
Compiler Design- Machine Independent Optimizations
Jyothishmathi Institute of Technology and Science Karimnagar
 
Machine_Learning_JNTUH_R18_UNIT5_CONCEPTS.pptx
Hemavanth1
 
Principal Sources of Optimization in compiler design
LogsAk
 
Bp150513(compiler)
indhu mathi
 
code optimization
Sanjeev Raaz
 
code optimization 1...code optimization-1221849738688969-9
Sanjeev Raaz
 
Ad

Recently uploaded (20)

PDF
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
PPTX
infertility, types,causes, impact, and management
Ritu480198
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PPTX
Difference between write and update in odoo 18
Celine George
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
infertility, types,causes, impact, and management
Ritu480198
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
Horarios de distribución de agua en julio
pegazohn1978
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Difference between write and update in odoo 18
Celine George
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 

Principle source of optimazation

  • 1. PRINCIPAL SOURCES OF OPTIMAZATION Presented by S.Sivasathya BP150510
  • 2. INTRODUCTION  The code produced by the straight forward compiling algorithms can often be made to run faster or take less space, or both. This improvement is achieved by program transformations that are traditionally called optimizations. Compilers that apply code-improving transformations are called optimizing compilers.  Optimizations are classified into two categories.  Machine independent optimizations:  Machine dependant optimizations:
  • 3. Machine independent optimizations:  Machine independent optimizations are program transformations that improve the target code  without taking into consideration any properties of the target machine. Machine dependant optimizations:  Machine dependant optimizations are based on register allocation and utilization of special.  machine-instruction sequences. The criteria for code improvement transformations:  Simply stated, the best program transformations are those that yield the most benefit for the least effort.  Flow analysis is a fundamental prerequisite for many important types of code improvement.
  • 4. CONT.…..  Generally control flow analysis precedes data flow analysis.  Control flow analysis (CFA) represents flow of control usually in form of graphs, CFA  constructs such as control flow graph Call graph  Data flow analysis (DFA) is the process of ascerting and collecting information prior to program execution about the possible modification, preservation, and use of certain entities (such as values or attributes of variables) in a computer program.
  • 5. PRINCIPAL SOURCES OF OPTIMIZATION  A transformation of a program is called local if it can be performed by looking only at the statements in a basic block; otherwise, it is called global.  Many transformations can be performed at both the local and global levels. Local transformations are usually performed first. Function-Preserving Transformations  There are a number of ways in which a compiler can improve a program without changing the function it computes.
  • 6. CONT.….. The transformations:  Common sub expression elimination,  Copy propagation,  Dead-code elimination, and  Constant folding  are common examples of such function-preserving transformations.  The other transformations come up primarily when global optimizations are performed.  Frequently, a program will include several calculations of the same value, such as an offset in an array. Some of the duplicate calculations cannot be avoided by the programmer because they lie below the level of detail accessible within the source language.
  • 7. Common Sub expressions elimination:  An occurrence of an expression E is called a common sub- expression if E was previously computed, and the values of variables in E have not changed since the previous computation. We can avoid recomputing the expression if we can use the previously computed value.  For example  t1: = 4*i  t2: = a [t1]  t3: = 4*j  t4: = 4*i  t5: = n  t6: = b [t4] +t5
  • 8. CONT.……  The above code can be optimized using the common sub-expression elimination as  t1: = 4*i  t2: = a [t1]  t3: = 4*j  t5: = n  t6: = b [t1] +t5  The common sub expression t4: =4*i is eliminated as its computation is already in t1. And value of i is not been changed from definition to use.
  • 9. Copy Propagation:  Assignments of the form f : = g called copy statements, or copies for short.  The idea behind the copy-propagation transformation is to use g for f, whenever possible after the copy statement f: = g.  Copy propagation means use of one variable instead of another.  This may not appear to be an improvement, but as we shall see it gives us an opportunity to eliminate x.
  • 10. CONT.…. For example:  x=Pi;  ……  A=x*r*r;  The optimization using copy propagation can be done as follows:  A=Pi*r*r;  Here the variable x is eliminated
  • 11. Dead-Code Eliminations:  A variable is live at a point in a program if its value can be used subsequently; otherwise, it is dead at that point.  A related idea is dead or useless code, statements that compute values that never get used.  While the programmer is unlikely to introduce any dead code intentionally ,it may appear as the result of previous transformations. An optimization can be done by eliminating dead code.  Example:  i=0;  if(i=1)  {  a=b+5;  }
  • 12. CONT.….  Here, ‘if’ statement is dead code because this condition will never get satisfied.  We can eliminate both the test and printing from the object code. More generally,  deducing at compile time that the value of an expression is a constant and using the  constant instead is known as constant folding.  One advantage of copy propagation is that it often turns the copy statement into dead  code.  For example,  a=3.14157/2 can be replaced by  a=1.570 there by eliminating a division operation.
  • 13. Loop Optimizations:  We now give a brief introduction to a very important place for optimizations, namely loops, especially the inner loops where programs tend to spend the bulk of their time.  The running time of a program may be improved if we decrease the number of instructions in an inner loop, even if we increase the amount of code outside that loop.  Three techniques are important for loop optimization:  code motion, which moves code outside a loop;  Induction-variable elimination, which we apply to replace variables from inner loop.  Reduction in strength, which replaces and expensive operation by a cheaper one, such as a multiplication by an addition.
  • 14. Code Motion:  An important modification that decreases the amount of code in a loop is code motion.  This transformation takes an expression that yields the same result independent of the number of times a loop is executed ( a loop- invariant computation) and places the expression before the loop.  Note that the notion “before the loop” assumes the existence of an entry for the loop.  For example, evaluation of limit-2 is a loop-invariant computation in the following while-statement:  while (i <= limit-2) /* statement does not change limit*/  Code motion will result in the equivalent of  t= limit-2;  while (i<=t) /* statement does not change limit or t */
  • 15. Induction Variables :  Loops are usually processed inside out. For example consider the loop around B3.  Note that the values of j and t4 remain in lock-step; every time the value of j decreases by 1, that of t4 decreases by 4 because 4*j is assigned to t4. Such identifiers are called induction variables.  When there are two or more induction variables in a loop, it may be possible to get rid of all but one, by the process of induction-variable elimination. For the inner loop around B3 in Fig. we cannot get rid of either j or t4 completely; t4 is used in B3 and j in B4.  However, we can illustrate reduction in strength and illustrate a part of the process of induction-variable elimination.  Eventually j will be eliminated when the outer loop of B2- B5 is considered.
  • 16. Example:  As the relationship t4:=4*j surely holds after such an assignment to t4 in Fig. and t4 is not changed elsewhere in the inner loop around B3, it follows that just after the statement j:=j-1 the relationship t4:= 4*j-4 must hold.  We may therefore replace the assignment t4:=4*j by t4:= t4-4. The only problem is that t4 does not have a value when we enter block B3 for the first time.  Since we must maintain the relationship t4=4*j on entry to the block B3, we place an initializations of t4 at the end of the block where j itself is The replacement of a multiplication by a subtraction will speed up the object code if multiplication takes more time than addition or subtraction, as is the case on many machines.