Skip to Main content Skip to Navigation
Conference papers

Handling Multi-Versioning in LLVM: Code Tracking and Cloning

Abstract : Instrumentation by sampling, adaptive computing and dynamic optimization can be efficiently implemented using multiple versions of a code region. Ideally, compilers should automatically handle the generation of such multiple versions. In this work we discuss the problem of multi-versioning in the situation where each version requires a different intermediate representation. We expose the limits of nowadays compilers regarding these aspects and provide our solutions to overcome them, using the LLVM compiler as our research platform. The paper is focused on three main aspects: tracking code in LLVM IR, cloning, and communication between low-level and high-level representations. Aiming at performance and minimal impact on the behavior of the original code, we describe our strategies to guide the interaction between the newly inserted code and the optimization passes, from annotating code using metadata to inlining assembly code in LLVM IR. Our target is performing code instrumentation and optimization, with an interest in loops. We build a version in x86_64 assembly code to acquire low-level information, and multiple versions in LLVM IR for performing high-level code transformations. The selection mechanism consists in callbacks to a generic runtime system. Preliminary results on the SPEC CPU 2006 and the Pointer Intensive Benchmark suite show that our framework has a negligible overhead in most cases, when instrumenting the most time consuming loop nests.
Document type :
Conference papers
Complete list of metadata

Cited literature [21 references]  Display  Hide  Download
Contributor : Philippe Clauss Connect in order to contact the contributor
Submitted on : Wednesday, October 5, 2011 - 4:37:17 PM
Last modification on : Wednesday, November 18, 2020 - 5:18:06 PM
Long-term archiving on: : Friday, January 6, 2012 - 2:20:12 AM


Files produced by the author(s)


  • HAL Id : inria-00572785, version 1



Alexandra Jimborean, Vincent Loechner, Philippe Clauss. Handling Multi-Versioning in LLVM: Code Tracking and Cloning. WIR 2011: Workshop on Intermediate Representations, in conjunction with CGO 2011, Florent Bouchez, Sebastian Hack, Eelco Visser, Apr 2011, Chamonix, France. ⟨inria-00572785⟩



Record views


Files downloads