Lune

OOPSLA2023顶会

The Bounded Pathwidth of Control-Flow Graphs

Giovanna Kobus Conrado, Amir Kafshdar Goharshady, Chun Kit Lam

摘要

Pathwidth and treewidth are standard and well-studied graph sparsity parameters which intuitively model the degree to which a given graph resembles a path or a tree, respectively. It is well-known that the control-flow graphs of structured goto-free programs have a tree-like shape and bounded treewidth. This fact has been exploited to design considerably more efficient algorithms for a wide variety of static analysis and compiler optimization problems, such as register allocation, 𝜇-calculus model-checking and parity games, data-flow analysis, cache management, and liftetime-optimal redundancy elimination. However, there is no bound in the literature for the pathwidth of programs, except the general inequality that the pathwidth of a graph is at most 𝑂 (lg 𝑛) times its treewidth, where 𝑛 is the number of vertices of the graph.

In this work, we prove that control-flow graphs of structured programs have bounded pathwidth and provide a linear-time algorithm to obtain a path decomposition of small width. Specifically, we establish a bound of 2 • 𝑑 on the pathwidth of programs with nesting depth 𝑑. Since real-world programs have small nesting depth, they also have bounded pathwidth. This is significant for a number of reasons: (i) pathwidth is a strictly stronger parameter than treewidth, i.e. any graph family with bounded pathwidth has bounded treewidth, but the converse does not hold; (ii) any algorithm that is designed with treewidth in mind can be applied to bounded-pathwidth graphs with no change; (iii) there are problems that are fixed-parameter tractable with respect to pathwidth but not treewidth; (iv) verification algorithms that are designed based on treewidth would become significantly faster when using pathwidth as the parameter; and (v) it is easier to design algorithms based on bounded pathwidth since one does not have to consider the often-challenging case of merge nodes in treewidth-based dynamic programming. Thus, we invite the static analysis and compiler optimization communities to adopt pathwidth as their parameter of choice instead of, or in addition to, treewidth. Intuitively, control-flow graphs are not only tree-like, but also path-like and one can obtain simpler and more scalable algorithms by relying on path-likeness instead of tree-likeness.

As a motivating example, we provide a simpler and more efficient algorithm for spill-free register allocation using bounded pathwidth instead of treewidth. Our algorithm reduces the runtime from 𝑂 (𝑛 • 𝑟 2•tw•𝑟 +2•𝑟 ) to 𝑂 (𝑛 • pw • 𝑟 pw•𝑟 +𝑟 +1 ), where 𝑛 is the number of lines of code, 𝑟 is the number of registers, pw is the pathwidth of the control-flow graph and tw is its treewidth. We provide extensive experimental results showing that our approach is applicable to a wide variety of real-world embedded benchmarks from SDCC and obtains runtime improvements of 2-3 orders of magnitude. This is because the pathwidth is equal to the treewidth, or one more, in the overwhelming majority of real-world CFGs and thus our algorithm provides an exponential runtime improvement. As such, the benefits of using pathwidth are not limited to the theoretical side and simplicity in algorithm design, but are also apparent in practice.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Efficient approximations for cache-conscious data placement 引用了 Reachability Analysis Using Message Passing over Tree Decompositions
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper2

  1. Exploiting the Sparseness of Control-Flow and Call Graphs for Efficient and On-Demand Algebraic Program AnalysisGiovanna Kobus Conrado, Amir Kafshdar Goharshady, Kerim Kochekov, Yun Chen Tsai 等OOPSLA 2023 · 12 次引用
  2. One for All and All for One: GNN-based Control-Flow Attestation for Embedded DevicesMarco Chilese, Richard Mitev, Meni Orenbach, Robert Thorburn 等S&P 2024 · 11 次引用

它引用的 Paper3

  1. Exploiting the Sparseness of Control-Flow and Call Graphs for Efficient and On-Demand Algebraic Program AnalysisGiovanna Kobus Conrado, Amir Kafshdar Goharshady, Kerim Kochekov, Yun Chen Tsai 等OOPSLA 2023 · 12 次引用
  2. Efficient approximations for cache-conscious data placementAli Ahmadi, Majid Daliri, Amir Kafshdar Goharshady, Andreas PavlogiannisPLDI 2022 · 9 次引用
  3. Reachability Analysis Using Message Passing over Tree DecompositionsSriram SankaranarayananCAV 2020 · 6 次引用

相关 Paper

  1. Faster Chaitin-like Register Allocation via Grammatical Decompositions of Control-Flow GraphsXuran Cai, Amir Kafshdar Goharshady, S. Hitarth, Chun Kit LamASPLOS 2025 · 2 次引用
  2. Approximating Pathwidth for Graphs of Small TreewidthCarla Groenland, Gwenaël Joret, Wojciech Nadara, Bartosz WalczakSODA 2021 · 6 次引用
  3. A nearly-linear time algorithm for linear programs with small treewidth: a multiscale representation of robust central pathSally Dong, Yin Tat Lee, Guanghao YeSTOC 2021 · 18 次引用
  4. Finding irrelevant vertices in linear time on bounded-genus graphsPetr A. Golovach, Stavros G. Kolliopoulos, Giannos Stamoulis, Dimitrios M. ThilikosSODA 2025
  5. Sparsifying, Shrinking and Splicing for Minimum Path Cover in Parameterized Linear TimeManuel Cáceres, Massimo Cairo, Brendan Mumey, Romeo Rizzi 等SODA 2022 · 20 次引用
黄昏的海面,两侧是细线勾勒的悬崖