SlideShare a Scribd company logo
1 of 16
LOOPS IN FLOW
GRAPHS
BP150511
R. RAMYA
LOOPS IN FLOW GRAPHS
 We shall use the notion of a node “Dominating”
another to define “Natural Loop” and the
important special class of “Reducible” of flow
graphs.
 An algorithm for finding dominators and
checking reducibility of flow graphs.
i. Dominators
ii. Natural loops
iii. Inner loops
iv. Pre-Headers
v. Reducible flow graphs
DOMINATORS
 d dom n – Node d of a CFG dominates node n if
every path from the initial node of the CFG to n
goes through d– The loop entry dominates all
nodes in the loop
 The immediate dominator m of a node n is the
last dominator on the path from the initial node
to n – If d ≠ n and d dom n then d dom m
 Build a dominator tree as follows:
 – Root is CFG entry node n0
 – m is child of node n iff n=Idom (m)
NATURAL LOOPS
 A back edge is is an edge a → b whose head b
dominates its tail a Given a back edge n → d
1. The natural loop consists of d plus the nodes
that can reach n without going through d
2. The loop header is node d
• Unless two loops have the same header, they are
disjoint or one is nested within the other – A nested
loop is an inner loop if it contains no other loops
NATURAL INNER LOOPS EXAMPLE
NATURAL OUTER LOOPS EXAMPLE
PRE-HEADERS
 To facilitate loop transformations, a
compiler often adds a pre-header to a loop
• Code motion, strength reduction, and other
loop transformations populate the pre-header
REDUCIBLE FLOW GRAPHS
 Reducible graph = disjoint partition in forward
and back edges such that the forward edges form
an acyclic (sub)graph.
 VIDEO
 video1
THANKYOU

More Related Content

What's hot

Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler designKuppusamy P
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingR Islam
 
Block Cipher and its Design Principles
Block Cipher and its Design PrinciplesBlock Cipher and its Design Principles
Block Cipher and its Design PrinciplesSHUBHA CHATURVEDI
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Optimization of basic blocks
Optimization of basic blocksOptimization of basic blocks
Optimization of basic blocksishwarya516
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler designSudip Singh
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OSMsAnita2
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitivesStudent
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionSHIKHA GAUTAM
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptarunsingh660
 
Partial redundancy elimination
Partial redundancy eliminationPartial redundancy elimination
Partial redundancy eliminationIshucs
 
knowledge representation using rules
knowledge representation using rulesknowledge representation using rules
knowledge representation using rulesHarini Balamurugan
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 

What's hot (20)

Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsing
 
Block Cipher and its Design Principles
Block Cipher and its Design PrinciplesBlock Cipher and its Design Principles
Block Cipher and its Design Principles
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Run time storage
Run time storageRun time storage
Run time storage
 
Optimization of basic blocks
Optimization of basic blocksOptimization of basic blocks
Optimization of basic blocks
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler design
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitives
 
Code generation
Code generationCode generation
Code generation
 
Loop optimization
Loop optimizationLoop optimization
Loop optimization
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
 
Partial redundancy elimination
Partial redundancy eliminationPartial redundancy elimination
Partial redundancy elimination
 
knowledge representation using rules
knowledge representation using rulesknowledge representation using rules
knowledge representation using rules
 
Stack organization
Stack organizationStack organization
Stack organization
 

Viewers also liked

Sexualidad+ +2do---
Sexualidad+ +2do---Sexualidad+ +2do---
Sexualidad+ +2do---Margaretlu
 
Corneal degenerations
Corneal degenerationsCorneal degenerations
Corneal degenerationsAkshay Nayak
 
Ciclomobilidade e o PDDU de Salvador
Ciclomobilidade e o PDDU de SalvadorCiclomobilidade e o PDDU de Salvador
Ciclomobilidade e o PDDU de SalvadorPablo Florentino
 
Learn and enjoy at RSAC 2017
Learn and enjoy at RSAC 2017Learn and enjoy at RSAC 2017
Learn and enjoy at RSAC 2017Sridhar Karnam
 
Ben Rothwell Flagged By USADA For Potential Doping Violation
Ben Rothwell Flagged By USADA For Potential Doping ViolationBen Rothwell Flagged By USADA For Potential Doping Violation
Ben Rothwell Flagged By USADA For Potential Doping Violationisteroidscom
 
Rpp pertidaksamaan rasional dan irasional kurikulum 2013
Rpp pertidaksamaan rasional dan irasional kurikulum 2013Rpp pertidaksamaan rasional dan irasional kurikulum 2013
Rpp pertidaksamaan rasional dan irasional kurikulum 2013Fardyani Narwis
 
Презентація Іршанської ОТГ Житомирської області
Презентація Іршанської ОТГ Житомирської областіПрезентація Іршанської ОТГ Житомирської області
Презентація Іршанської ОТГ Житомирської областіCSIUKRAINE
 
Curso de teclado Aprenda a Tocar Teclado
Curso de teclado  Aprenda a Tocar TecladoCurso de teclado  Aprenda a Tocar Teclado
Curso de teclado Aprenda a Tocar TecladoCleber Lucas
 
EMAAR Vida Residences - Dubai Marina +971 4553 8725
EMAAR Vida Residences - Dubai Marina +971 4553 8725EMAAR Vida Residences - Dubai Marina +971 4553 8725
EMAAR Vida Residences - Dubai Marina +971 4553 8725Sandeepnextgen
 

Viewers also liked (17)

Informe padres y alumnos 2017
Informe padres y alumnos 2017Informe padres y alumnos 2017
Informe padres y alumnos 2017
 
Sexualidad+ +2do---
Sexualidad+ +2do---Sexualidad+ +2do---
Sexualidad+ +2do---
 
El coltan
El coltanEl coltan
El coltan
 
OYSTER STORY
OYSTER STORYOYSTER STORY
OYSTER STORY
 
Corneal degenerations
Corneal degenerationsCorneal degenerations
Corneal degenerations
 
Ciclomobilidade e o PDDU de Salvador
Ciclomobilidade e o PDDU de SalvadorCiclomobilidade e o PDDU de Salvador
Ciclomobilidade e o PDDU de Salvador
 
Learn and enjoy at RSAC 2017
Learn and enjoy at RSAC 2017Learn and enjoy at RSAC 2017
Learn and enjoy at RSAC 2017
 
Rpp nilai mutlak K13
Rpp nilai mutlak K13Rpp nilai mutlak K13
Rpp nilai mutlak K13
 
Oyster health
Oyster healthOyster health
Oyster health
 
Ben Rothwell Flagged By USADA For Potential Doping Violation
Ben Rothwell Flagged By USADA For Potential Doping ViolationBen Rothwell Flagged By USADA For Potential Doping Violation
Ben Rothwell Flagged By USADA For Potential Doping Violation
 
Expected questions in Artificial Intelligence
Expected questions in Artificial IntelligenceExpected questions in Artificial Intelligence
Expected questions in Artificial Intelligence
 
Rpp pertidaksamaan rasional dan irasional kurikulum 2013
Rpp pertidaksamaan rasional dan irasional kurikulum 2013Rpp pertidaksamaan rasional dan irasional kurikulum 2013
Rpp pertidaksamaan rasional dan irasional kurikulum 2013
 
Презентація Іршанської ОТГ Житомирської області
Презентація Іршанської ОТГ Житомирської областіПрезентація Іршанської ОТГ Житомирської області
Презентація Іршанської ОТГ Житомирської області
 
Sml p
Sml pSml p
Sml p
 
kablosuz ağlar
kablosuz ağlarkablosuz ağlar
kablosuz ağlar
 
Curso de teclado Aprenda a Tocar Teclado
Curso de teclado  Aprenda a Tocar TecladoCurso de teclado  Aprenda a Tocar Teclado
Curso de teclado Aprenda a Tocar Teclado
 
EMAAR Vida Residences - Dubai Marina +971 4553 8725
EMAAR Vida Residences - Dubai Marina +971 4553 8725EMAAR Vida Residences - Dubai Marina +971 4553 8725
EMAAR Vida Residences - Dubai Marina +971 4553 8725
 

Recently uploaded

Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Loops in flow

  • 2. LOOPS IN FLOW GRAPHS  We shall use the notion of a node “Dominating” another to define “Natural Loop” and the important special class of “Reducible” of flow graphs.  An algorithm for finding dominators and checking reducibility of flow graphs.
  • 3. i. Dominators ii. Natural loops iii. Inner loops iv. Pre-Headers v. Reducible flow graphs
  • 4. DOMINATORS  d dom n – Node d of a CFG dominates node n if every path from the initial node of the CFG to n goes through d– The loop entry dominates all nodes in the loop  The immediate dominator m of a node n is the last dominator on the path from the initial node to n – If d ≠ n and d dom n then d dom m
  • 5.
  • 6.  Build a dominator tree as follows:  – Root is CFG entry node n0  – m is child of node n iff n=Idom (m)
  • 7. NATURAL LOOPS  A back edge is is an edge a → b whose head b dominates its tail a Given a back edge n → d 1. The natural loop consists of d plus the nodes that can reach n without going through d 2. The loop header is node d • Unless two loops have the same header, they are disjoint or one is nested within the other – A nested loop is an inner loop if it contains no other loops
  • 8.
  • 11. PRE-HEADERS  To facilitate loop transformations, a compiler often adds a pre-header to a loop • Code motion, strength reduction, and other loop transformations populate the pre-header
  • 12.
  • 13. REDUCIBLE FLOW GRAPHS  Reducible graph = disjoint partition in forward and back edges such that the forward edges form an acyclic (sub)graph.
  • 14.