| Through compilation optimization analysis,it is found that the invalid code deletion and automatic vectorization optimization strategies adopted by the GCC compiler are relatively conservative.When the function call layer is too many and the complexity is too high,the invalid code deletion optimization has certain limitations;in addition,the efficiency of loop automatic vectorization optimization is greatly affected by the layout of different data structures.To this end,this thesis studies the optimization principles and implementation methods of invalid code deletion and automatic vectorization in the compiler,and proposes an aggressive butterfly optimization method solution,focusing on solving the branch path dependent dynamic parameter values and the automatic vectorization in the loop structure.Optimization.Through compilation analysis,study the principles and different optimization modes of GCC and AOCC,ICC and LLVM three compilers,and find out the main factors affecting performance;take GCC compiler as the target platform,and its general optimization ability and special optimization ability Defects are analyzed and summarized,and then optimized and improved.The main research work of this thesis includes the following parts:(1)A regional butterfly optimization method based on data flow analysis is proposed.This method relies on the use of GCC’s existing mature profiling feedback optimization and constant propagation technology to identify and locate the optimization mode and obtain key information of the program.And automatically generate two or more branch codes with a shape similar to a butterfly for the program:one branch Maintain the original conservative design to ensure the correctness of the process branches under non-constant parameter conditions;the remaining branches undergo aggressive redundancy deletion under corresponding conditions.Make the compiler provide feasible optimization basis for related optimization in the program compilation stage.(2)Use butterfly as the basic structure to optimize the memory layout of the structure in the loop.Convert the GCC default structure array(Ao S)layout method to the array structure array(Ao So A)layout method.By optimizing and improving the layout of the data structure,the full-width vector register is effectively used to improve the vectorization optimization ability.(3)The aggressive butterfly optimization method was verified on SPEC CPU2017.The experimental results show that the expected intermediate representations and instructions can be generated through regional butterfly optimization and data structure layout optimization.And the performance acceleration ratio of test cases is effectively improved,which verifies the correctness and effectiveness of the scheme proposed in this paper.At the same time,the experimental results on Intel and AMD architectures also show that the aggressive butterfly optimization method proposed in this thesis has a certain universality. |