Document Open Access Logo

Constant-Loop Dominators for Single-Path Code Optimization

Authors Emad Jacob Maroun , Martin Schoeberl , Peter Puschner

Thumbnail PDF


  • Filesize: 0.59 MB
  • 13 pages

Document Identifiers

Author Details

Emad Jacob Maroun
  • Institute of Computer Engineering, TU Wien, Vienna, Austria
Martin Schoeberl
  • Department of Applied Mathematics and Computer Science, Technical University of Denmark, Lyngby, Denmark
Peter Puschner
  • Institute of Computer Engineering, TU Wien, Vienna, Austria


This work has been supported by the Doctoral College Resilient Embedded Systems, which is run jointly by the TU Wien’s Faculty of Informatics and the UAS Technikum Wien.

Cite AsGet BibTex

Emad Jacob Maroun, Martin Schoeberl, and Peter Puschner. Constant-Loop Dominators for Single-Path Code Optimization. In 21th International Workshop on Worst-Case Execution Time Analysis (WCET 2023). Open Access Series in Informatics (OASIcs), Volume 114, pp. 7:1-7:13, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023)


Single-path code is a code generation technique specifically designed for real-time systems. It guarantees that programs execute the same instruction sequence regardless of runtime conditions. Single-path code uses loop bounds to ensure all loops iterate a fixed number of times equal to their upper loop bound. When the lower and upper bounds are equal, the loop must iterate the same number of times, which we call a constant loop. In this paper, we present the constant-loop dominance relation on control-flow graphs. It is a variation of the traditional dominance relation that considers constant loops to find basic blocks that are always executed the same number of times. Using this relation, we present an optimization that reduces the code needed to manage single-path code. Our evaluation shows significant performance improvements, with one example of up to 90%, with mostly minor effects on code size.

Subject Classification

ACM Subject Classification
  • Computer systems organization → Real-time systems
  • Theory of computation → Graph algorithms analysis
  • Theory of computation → Control primitives
  • General and reference → Performance
  • single-path
  • dominators
  • algorithms
  • optimization
  • control-flow graph


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. On finding lowest common ancestors in trees. In Alfred V. Aho, Allan Borodin, Robert L. Constable, Robert W. Floyd, Michael A. Harrison, Richard M. Karp, and H. Raymond Strong, editors, Proceedings of the 5th Annual ACM Symposium on Theory of Computing, April 30 - May 2, 1973, Austin, Texas, USA, pages 253-265. ACM, 1973. URL:
  2. Alfred V. Aho and Jeffrey D. Ullman. Principles of Compiler Design (Addison-Wesley Series in Computer Science and Information Processing). Addison-Wesley Longman Publishing Co., Inc., USA, 1977. Google Scholar
  3. Stephen Alstrup, Dov Harel, Peter W. Lauridsen, and Mikkel Thorup. Dominators in linear time. SIAM J. Comput., 28(6):2117-2132, 1999. URL:
  4. Armelle Bonenfant, Marianne de Michiel, and Pascal Sainrat. oRange: A tool for static loop bound analysis. In Proceedings of the Workshop on Resource Analysis, volume 42, 2008. Google Scholar
  5. Adam L. Buchsbaum, Loukas Georgiadis, Haim Kaplan, Anne Rogers, Robert Endre Tarjan, and Jeffery R. Westbrook. Linear-time algorithms for dominators and other path-evaluation problems. SIAM J. Comput., 38(4):1533-1573, 2008. URL:
  6. Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst., 13(4):451-490, 1991. URL:
  7. Andreas Ermedahl, Christer Sandberg, Jan Gustafsson, Stefan Bygde, and Björn Lisper. Loop bound analysis based on a combination of program slicing, abstract interpretation, and invariant analysis. In Christine Rochange, editor, 7th Intl. Workshop on Worst-Case Execution Time (WCET) Analysis, Pisa, Italy, July 3, 2007, volume 6 of OASIcs. Internationales Begegnungs- und Forschungszentrum fuer Informatik (IBFI), Schloss Dagstuhl, Germany, 2007. URL:
  8. Heiko Falk, Sebastian Altmeyer, Peter Hellinckx, Björn Lisper, Wolfgang Puffitsch, Christine Rochange, Martin Schoeberl, Rasmus Bo Sørensen, Peter Wägemann, and Simon Wegener. TACLeBench: A benchmark collection to support worst-case execution time research. In Martin Schoeberl, editor, 16th International Workshop on Worst-Case Execution Time Analysis, WCET 2016, July 5, 2016, Toulouse, France, volume 55 of OASIcs, pages 2:1-2:10. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2016. URL:
  9. Dov Harel. A linear time algorithm for finding dominators in flow graphs and related problems. In Robert Sedgewick, editor, Proceedings of the 17th Annual ACM Symposium on Theory of Computing, May 6-8, 1985, Providence, Rhode Island, USA, pages 185-194. ACM, 1985. URL:
  10. Rebecca Hasti and Susan Horwitz. Using static single assignment form to improve flow-insensitive pointer analysis. In Jack W. Davidson, Keith D. Cooper, and A. Michael Berman, editors, Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation (PLDI), Montreal, Canada, June 17-19, 1998, pages 97-105. ACM, 1998. URL:
  11. Christopher A. Healy, Mikael Sjödin, Viresh Rustagi, David B. Whalley, and Robert van Engelen. Supporting timing analysis by automatic bounding of loop iterations. Real Time Syst., 18(2/3):129-156, 2000. URL:
  12. Paul Walton Purdom Jr. and Edward F. Moore. Immediate predominators in a directed graph [H] (algorithm 430). Commun. ACM, 15(8):777-778, 1972. URL:
  13. Dimitar Kazakov and Iain Bate. Towards new methods for developing real-time systems: Automatically deriving loop bounds using machine learning. In Proceedings of 11th IEEE International Conference on Emerging Technologies and Factory Automation, ETFA 2006, September 20-22, 2006, Diplomat Hotel Prague, Czech Republic, pages 421-428. IEEE, 2006. URL:
  14. Raimund Kirner, Jens Knoop, Adrian Prantl, Markus Schordan, and Albrecht Kadlec. Beyond loop bounds: comparing annotation languages for worst-case execution time analysis. Softw. Syst. Model., 10(3):411-437, 2011. URL:
  15. Chris Lattner and Vikram S. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In 2nd IEEE / ACM International Symposium on Code Generation and Optimization (CGO 2004), 20-24 March 2004, San Jose, CA, USA, pages 75-88. IEEE Computer Society, 2004. URL:
  16. Thomas Lengauer and Robert Endre Tarjan. A fast algorithm for finding dominators in a flowgraph. ACM Trans. Program. Lang. Syst., 1(1):121-141, 1979. URL:
  17. Edward S. Lowry and C. W. Medlock. Object code optimization. Commun. ACM, 12(1):13-22, 1969. URL:
  18. Salvador Lucas. The origins of the halting problem. J. Log. Algebraic Methods Program., 121:100687, 2021. URL:
  19. Emad J. Maroun, Martin Schoeberl, and Peter Puschner. Compiler-directed constant execution time on flat memory systems. In 2023 IEEE 26th International Symposium on Real-Time Distributed Computing (ISORC). IEEE, 2023. Google Scholar
  20. Emad J. Maroun, Martin Schoeberl, and Peter P. Puschner. Compiling for time-predictability with dual-issue single-path code. J. Syst. Archit., 118:102230, 2021. URL:
  21. Daniel Prokesch, Stefan Hepp, and Peter P. Puschner. A generator for time-predictable code. In IEEE 18th International Symposium on Real-Time Distributed Computing, ISORC 2015, Auckland, New Zealand, 13-17 April, 2015, pages 27-34. IEEE Computer Society, 2015. URL:
  22. Peter P. Puschner and Alan Burns. Writing temporally predictable code. In 7th IEEE International Workshop on Object-Oriented Real-Time Dependable Systems (WORDS 2002), 7-9 January 2002, San Diego, CA, USA, pages 85-94. IEEE Computer Society, 2002. URL:
  23. Ola Redell and Martin Sanfridson. Exact best-case response time analysis of fixed priority scheduled tasks. In 14th Euromicro Conference on Real-Time Systems (ECRTS 2002), 19-21 June 2002, Vienna, Austria, Proceedings, pages 165-172. IEEE Computer Society, 2002. URL:
  24. Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. Global value numbers and redundant computations. In Jeanne Ferrante and Peter Mager, editors, Conference Record of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, California, USA, January 10-13, 1988, pages 12-27. ACM Press, 1988. URL:
  25. Martin Schoeberl, Sahar Abbaspour, Benny Akesson, Neil C. Audsley, Raffaele Capasso, Jamie Garside, Kees Goossens, Sven Goossens, Scott Hansen, Reinhold Heckmann, Stefan Hepp, Benedikt Huber, Alexander Jordan, Evangelia Kasapaki, Jens Knoop, Yonghui Li, Daniel Prokesch, Wolfgang Puffitsch, Peter Puschner, André Rocha, Cláudio Silva, Jens Sparsø, and Alessandro Tocchi. T-CREST: time-predictable multi-core architecture for embedded systems. J. Syst. Archit., 61(9):449-471, 2015. URL:
  26. Martin Schoeberl, Florian Brandner, Stefan Hepp, Wolfgang Puffitsch, and Daniel Prokesch. Patmos reference handbook. Technical report, Technical University of Denmark, 2014. Google Scholar
  27. Martin Schoeberl, Wolfgang Puffitsch, Stefan Hepp, Benedikt Huber, and Daniel Prokesch. Patmos: a time-predictable microprocessor. Real Time Syst., 54(2):389-423, 2018. URL:
  28. Thomas Sewell, Felix Kam, and Gernot Heiser. Complete, high-assurance determination of loop bounds and infeasible paths for WCET analysis. In 2016 IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS), Vienna, Austria, April 11-14, 2016, pages 185-195. IEEE Computer Society, 2016. URL:
  29. Robert Endre Tarjan. Finding dominators in directed graphs. SIAM J. Comput., 3(1):62-89, 1974. URL:
  30. Mark N. Wegman and F. Kenneth Zadeck. Constant propagation with conditional branches. ACM Trans. Program. Lang. Syst., 13(2):181-210, 1991. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail