HyBF: A Hybrid Branch Fusion Strategy for Code Size Reduction

PROCEEDINGS OF THE 32ND ACM SIGPLAN INTERNATIONAL CONFERENCE ON COMPILER CONSTRUCTION, CC 2023(2023)

引用 0|浏览4
暂无评分
摘要
Binary code size is a first-class design consideration in many computing domains and a critical factor in many more, but compiler optimizations targeting code size are few and often limited in functionality. When size reduction opportunities are left unexploited, it results in higher downstream costs such as memory, storage, bandwidth, or programmer time. We present HyBF, a framework to manage code merging techniques that target conditional branches (i.e., if-then-else) with similar code regions on both paths. While such code can be easily and profitably merged with little control flow overhead, existing techniques generally fail to fully handle it. Our work is inspired by branch fusion, a technique for merging similar code in if-then-else statements, which is aimed at reducing thread divergence in GPUs. We introduce two new branch fusion techniques that can be applied to almost any if-then-else statement and can uncover many more code merging opportunities. The two approaches are mostly orthogonal and have different limitations and strengths. We integrate them into a single framework, HyBF, which can choose the optimal approach on a per branch basis to maximize the potential of reducing code size. Our results show that we can achieve significant code savings on top of already heavily optimized binaries using state-of-the-art code size optimizations. Over 61 benchmarks, we reduce the code size on 43 of them. That reduction typically ranges from a few hundred to a few thousand bytes, but for specific benchmarks, it can be substantial and as high as 4.2% or 67 KB.
更多
查看译文
关键词
Branch Fusion, Function Merging, LLVM, Compiler Optimization, Code-Size Reduction
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要