Finding Missed Compiler Optimizations by Differential Testing

被引:26
作者
Barany, Gergo [1 ]
机构
[1] INRIA, Paris, France
来源
CC'18: PROCEEDINGS OF THE 27TH INTERNATIONAL CONFERENCE ON COMPILER CONSTRUCTION | 2018年
关键词
optimization; differential testing; randomized testing;
D O I
10.1145/3178372.3179521
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Randomized differential testing of compilers has had great success in finding compiler crashes and silent miscompilations. In this paper we investigate whether we can use similar techniques to improve the quality of the generated code: Can we compare the code generated by different compilers to find optimizations performed by one but missed by another? We have developed a set of tools for running such tests. We compile C code generated by standard random program generators and use a custom binary analysis tool to compare the output programs. Depending on the optimization of interest, the tool can be configured to compare features such as the number of total instructions, multiply or divide instructions, function calls, stack accesses, and more. A standard test case reduction tool produces minimal examples once an interesting difference has been found. We have used our tools to compare the code generated by GCC, Clang, and CompCert. We have found previously unreported missing arithmetic optimizations in all three compilers, as well as individual cases of unnecessary register spilling, missed opportunities for register coalescing, dead stores, redundant computations, and missing instruction selection patterns.
引用
收藏
页码:82 / 92
页数:11
相关论文
共 27 条
  • [1] Balestrat Antoine, 2016, CCG RANDOM C CODE GE
  • [2] Barany Gergo, 2017, PREP LOPSTR 2017
  • [3] Beyer Dirk, 2011, Computer Aided Verification. Proceedings 23rd International Conference, CAV 2011, P184, DOI 10.1007/978-3-642-22110-1_16
  • [4] Structuring Abstract Interpreters Through State and Value Abstractions
    Blazy, Sandrine
    Buehler, David
    Yakobowski, Boris
    [J]. VERIFICATION, MODEL CHECKING, AND ABSTRACT INTERPRETATION, VMCAI 2017, 2017, 10145 : 112 - 130
  • [5] OPTGEN: A Generator for Local Optimizations
    Buchwald, Sebastian
    [J]. COMPILER CONSTRUCTION (CC 2015), 2015, 9031 : 171 - 189
  • [6] Chen Yang, 2010, BLOG POST
  • [7] Cuoq Pascal, 2012, P 4 NASA FORM METH S
  • [8] Eide E, 2008, P 8 ACM INT C EMB SO, P255, DOI [DOI 10.1145/1450058.1450093, 10.1145/1450058.1450093]
  • [9] George Lal., 1996, Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL'96, V18, P208, DOI [10.1145/237721.237777, DOI 10.1145/237721.237777]
  • [10] Hashimoto A., 2016, IPSJ Trans. System LSI Design Methodology, V9, P21