406
Views
0
CrossRef citations to date
0
Altmetric
Research Article

The algorithm and implementation of an extension to LLVM for solving the blocking between instruction sink and division-modulo combine

ORCID Icon, &
Article: 2273219 | Received 01 Jan 2023, Accepted 16 Oct 2023, Published online: 30 Oct 2023
 

Abstract

Compiler optimization presents a formidable challenge, seeking to enhance code quality through various techniques. One significant obstacle is the phase-ordering problem, where the sequence of optimization algorithms can impact code quality and potentially lead to performance deterioration. While machine learning has shown promise in addressing this issue, it still encounters limitations in certain scenarios.

Instruction Sink is a machine-independent optimization that segregates instructions like modulo and division into separate basic blocks. This separation prevents the application of the machine-dependent optimization called Division-Modulo Combine at the backend, which could otherwise lead to a decline in program performance. However, reordering these optimizations to avoid conflicts can prove to be challenging. In this paper, we propose an algorithm to enhance Instruction Sink, resolving the blocking problem, and implements it within the LLVM optimizer. Leveraging the modularity of LLVM enables us to tackle all affected back-end issues simultaneously.

To assess the effectiveness of our algorithm, we conduct a comprehensive evaluation focusing on feasibility, compatibility, and targeted improvements. The results demonstrate that our approach effectively addresses the blocking problem without conflicting with other optimization algorithms, solely impacting problematic instructions while leaving normal ones unaffected.

Subject classification codes:

Disclosure statement

No potential conflict of interest was reported by the author(s).

Additional information

Funding

This work was supported by Ministry of Science and Technology, Taiwan: [Grant Number MOST 110-2221-E-008-020].