# Control flow graph based code optimization using graph neural networks

**Authors:** Melih Peker, Ozcan Ozturk

PMC · DOI: 10.3389/frobt.2026.1731740 · Frontiers in Robotics and AI · 2026-03-11

## TL;DR

This paper uses graph neural networks to optimize code by finding the best optimization flags, achieving significant speed improvements.

## Contribution

A novel approach combining static, spatial features, and graph neural networks for code optimization.

## Key findings

- A dataset of 12,000 graphs was created using 256 optimization flag combinations on 47 benchmarks.
- The model achieved up to 48.6% speed-up compared to enabling all optimization flags.

## Abstract

Selecting a good set of optimization flags requires extensive effort and expert input. While most of the prior research considers using static, spatial, or dynamic features, some of the latest research directly applied deep neural networks to source code. We combined the static features, spatial features, and deep neural networks by representing source code as graphs and trained Graph Neural Network for automatically finding suitable optimization flags. We created a dataset of 12000 graphs using 256 optimization flag combinations on 47 benchmarks. We trained and tested our model using these benchmarks, and our results show that we can achieve a maximum of 48.6% speed-up compared to the case where all optimization flags are enabled.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC13012953/full.md

## Figures

17 figures with captions in the complete paper: https://tomesphere.com/paper/PMC13012953/full.md

## References

60 references — full list in the complete paper: https://tomesphere.com/paper/PMC13012953/full.md

---
Source: https://tomesphere.com/paper/PMC13012953