NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Iterating Pointers: Enabling Static Analysis for Loop-based Pointers

Andrea Lepori, Alexandru Calotoiu, Torsten Hoefler · DOI

Abstract

In C programming, pointers offer low-level memory control but complicate static analysis due to aliasing and complex arithmetic. This paper introduces pointer disaggregation, a transformation that splits pointers into a fixed data container and an integer "adjunct" offset. By making pointer movements explicit as integer arithmetic, this approach allows compilers to leverage scalar evolution analysis for automatic parallelization and vectorization. We evaluate this technique on real-world benchmarks, achieving up to 11x speedup in OpenSSL's PBKDF2 implementation.

Introduction

Modern compilers often fail to parallelize loops in legacy C code because they cannot statically prove the absence of memory dependencies. Pointer arithmetic, such as p++, is particularly problematic; compilers must assume conservative dependencies to ensure correctness, often preventing optimizations like vectorization or multi-threading. While polyhedral optimizers like Polly or Pluto exist, they are frequently limited to simple, affine control parts and fail when faced with the flexible pointer patterns common in real-world C codebases.

Methods: Pointer Disaggregation

The core contribution is a source-to-source transformation called pointer disaggregation. This technique separates a pointer's dual role as both a memory handle and an iterator.

  1. The Adjunct Variable: For every pointer p, an associated signed integer p_adj (the adjunct) is created to track movement.
  2. Transformation Rules: Pointer increments are converted to adjunct increments (e.g., p_adj++), and dereferences become array-style accesses (e.g., p[p_adj]). Pointer assignments also copy the adjunct state.
  3. Data-Centric Integration: The transformed code is processed by the DaCe (Data-Centric Parallel Programming) framework, which uses dataflow analysis to identify parallelization opportunities.
Conceptual visualization of pointer disaggregation, separating the pointer into a container and an adjunct offset.

By converting pointer movement into integer offsets, the transformation enables the compiler to use Scalar Evolution (SCEV) logic—a highly refined tool for analyzing integer arithmetic—on memory access patterns that were previously opaque. As shown in the comparison below, this allows compilers like GCC to statically decide on vectorization rather than relying on expensive runtime checks.

Comparison of standard pointer code versus disaggregated code, showing how the latter allows GCC to statically decide on vectorization.

Key Results

The authors evaluated their approach on several significant real-world targets:

  • OpenSSL (PBKDF2): The transformation enabled automatic parallelization of a previously serial algorithm, resulting in up to an 11x speedup with 24 threads.
  • Mantevo (HPCCG): The automated workflow matched or exceeded hand-tuned implementations, showing an 18% improvement over reference code in some scenarios.
  • LZO Compression: Even without full parallelization due to dependencies, the transformation improved single-threaded performance by 4% through enhanced vectorization.

Prevalence analysis across the Linux kernel and OpenSSL repositories confirmed that single-level pointers—the primary target of this work—are orders of magnitude more common than higher-order pointers, suggesting broad applicability for this technique.

Conclusion

Pointer disaggregation provides a vital bridge between legacy C code and modern optimization pipelines. By representing pointer movement as integer arithmetic, it unlocks the full power of static analysis tools, enabling significant performance gains through automatic parallelization and vectorization. Future work includes integrating this transformation into the MLIR (Multi-Level Intermediate Representation) ecosystem to allow for more seamless integration with the broader LLVM infrastructure.

Summary updated

BibTeX
@article{lepori2025iterating,
  author = {Andrea Lepori and Alexandru Calotoiu and Torsten Hoefler},
  title = {{Iterating Pointers: Enabling Static Analysis for Loop-based Pointers}},
  journal = {ACM Trans. Archit. Code Optim.},
  year = {2025},
  doi = {10.1145/3701993},
}
Figure