Abstract:Compiler optimization options serve as a core interface between the compiler and developers, and their proper configuration directly impacts software quality and development efficiency. However, there are a large number of options with complex interrelations, and their optimization effects are dynamically influenced by program features and target machines. The official documentation is also insufficient to provide the configuration guidance needed for practical application scenarios. To address these challenges, this study combines static and dynamic analysis techniques applied to the GCC source code and investigates two types of relationships that affect the effectiveness of compiler options: internal constraint relationships and external environment dependencies. First, 68 pairs of internal constraint relationships (involving 84 options) and 103 pairs of external environment dependencies (including 51 architecture-sensitive options and 52 program feature-sensitive options) are identified through static analysis, and the effectiveness of these options in different external environments is further validated through dynamic analysis. Finally, the analysis results of option relationships are applied to three compiler-related scenarios: 1) improving the effectiveness of compiler auto-tuning by designing a relationship-aware genetic auto-tuning algorithm, which achieves an average performance improvement of 3.65% compared with algorithms that do not consider option relationships, such as the genetic algorithm; 2) improving the effectiveness of compiler testing by proposing a option sequence test case generation method based on option relationships, achieving a 51.7% increase in generation efficiency compared to random methods; 3) providing developers with more effective option configuration schemes to help them use options properly to achieve their desired optimization goals. These three applications demonstrate the key role of compiler option relationships in compiler auto-tuning, compiler testing, and practical configuration.