Skip to content Skip to navigation

Alive-Infer: Data Driven Precondition Inference for Peephole Optimizations in LLVM

Alive-Infer: Data Driven Precondition Inference for Peephole Optimizations in LLVM

Author Name: 

David Menendez and Santosh Nagarakatte

Publication Type: 
Conference Publications
Journal/Volume: 
2017 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017)
Publication Date: 
June, 2017
Abstract: 

Peephole optimizations are a common source of compiler bugs. Compiler developers typically transform an incorrect peephole optimization into a valid one by strengthening the precondition. This process is challenging and tedious. This paper proposes ALIVE-INFER, a data-driven approach that infers preconditions for peephole optimizations expressed in Alive. ALIVE-INFER generates positive and negative examples for an optimization, enumerates predicates ondemand, and learns a set of predicates that separate the positive and negative examples. ALIVE-INFER repeats this process until it finds a precondition that ensures the validity of the optimization. ALIVE-INFER reports both a weakest precondition and a set of succinct partial preconditions to the developer. Our prototype generates preconditions that are weaker than LLVM’s preconditions for 73 optimizations in the Alive suite. We also demonstrate the applicability of this technique to generalize 54 optimization patterns generated by Souper, an LLVM IR–based superoptimizer