Research

Paper

TESTING March 10, 2026

Idempotent Slices with Applications to Code-Size Reduction

Authors

Rafael Alvarenga de Azevedo, Daniel Augusto Costa de Sa, Rodrigo Caetano Rocha, Fernando Magno Quintão Pereira

Abstract

Given a value computed within a program, an idempotent backward slice with respect to this value is a maximal subprogram that computes it. An informal notion of an idempotent slice has previously been used by Guimaraes et al. to transform eager into strict evaluation in the LLVM intermediate representation. However, that algorithm is insufficient to be correctly applied to general control-flow graphs. This paper addresses these omissions by formalizing the notion of idempotent backward slices and presenting a sound and efficient algorithm for extracting them from programs in Gated Static Single Assignment (GSA) form. As an example of their practical use, the paper describes how identifying and extracting idempotent backward slices enables a sparse code-size reduction optimization; that is, one capable of merging non-contiguous sequences of instructions within the control-flow graph of a single function or across functions. Experiments with the LLVM test suite show that, in specific benchmarks, this new algorithm achieves code-size reductions up to -7.24% on programs highly optimized by the -Os sequence of passes from clang 17.

Metadata

arXiv ID: 2603.09726
Provider: ARXIV
Primary Category: cs.PL
Published: 2026-03-10
Fetched: 2026-03-11 06:02

Related papers

Raw Data (Debug)
{
  "raw_xml": "<entry>\n    <id>http://arxiv.org/abs/2603.09726v1</id>\n    <title>Idempotent Slices with Applications to Code-Size Reduction</title>\n    <updated>2026-03-10T14:32:33Z</updated>\n    <link href='https://arxiv.org/abs/2603.09726v1' rel='alternate' type='text/html'/>\n    <link href='https://arxiv.org/pdf/2603.09726v1' rel='related' title='pdf' type='application/pdf'/>\n    <summary>Given a value computed within a program, an idempotent backward slice with respect to this value is a maximal subprogram that computes it. An informal notion of an idempotent slice has previously been used by Guimaraes et al. to transform eager into strict evaluation in the LLVM intermediate representation. However, that algorithm is insufficient to be correctly applied to general control-flow graphs. This paper addresses these omissions by formalizing the notion of idempotent backward slices and presenting a sound and efficient algorithm for extracting them from programs in Gated Static Single Assignment (GSA) form. As an example of their practical use, the paper describes how identifying and extracting idempotent backward slices enables a sparse code-size reduction optimization; that is, one capable of merging non-contiguous sequences of instructions within the control-flow graph of a single function or across functions. Experiments with the LLVM test suite show that, in specific benchmarks, this new algorithm achieves code-size reductions up to -7.24% on programs highly optimized by the -Os sequence of passes from clang 17.</summary>\n    <category scheme='http://arxiv.org/schemas/atom' term='cs.PL'/>\n    <published>2026-03-10T14:32:33Z</published>\n    <arxiv:comment>23 pages, 4 tables, 12 figures</arxiv:comment>\n    <arxiv:primary_category term='cs.PL'/>\n    <author>\n      <name>Rafael Alvarenga de Azevedo</name>\n    </author>\n    <author>\n      <name>Daniel Augusto Costa de Sa</name>\n    </author>\n    <author>\n      <name>Rodrigo Caetano Rocha</name>\n    </author>\n    <author>\n      <name>Fernando Magno Quintão Pereira</name>\n    </author>\n  </entry>"
}