llvm-dimeta: A library for extracting source-level type information in LLVM IR using debug metadata
LLVM frontends like Clang preserve source-level type information in the intermediate representation (IR) primarily through debug metadata. Although intended for debuggers, this metadata benefits compiler tools like sanitizers, which need type information of stack, heap and global allocations for tasks such as verifying memory safety. We present llvm-dimeta, a library that extracts type information for memory allocations directly from LLVM IR via debug metadata. It handles the necessary IR analysis internally, enabling frontend-independent type queries. As a case study, we integrate llvm-dimeta into a type correctness checker for MPI-parallelized HPC applications. Using llvm-dimeta, the checker achieves 98% accuracy on an MPI correctness benchmark, up from 76% when relying solely on LLVM IR’s more limited type system. Code is available at https://github.com/ahueck/llvm-dimeta
Authors
- Christian Bischof (ORCID: https://orcid.org/0000-0003-2711-3032)
- Sebastian Kreutzer (ORCID: https://orcid.org/0000-0002-1641-4342)
- Alexander Hück (ORCID: https://orcid.org/0000-0003-1931-773X)
Institutions
- Technische Universität Darmstadt (DE)
Publication Details
- Published
- 2025-09-08
- DOI
- https://doi.org/10.1109/scam67354.2025.00019
- Primary Topic
- Advanced Computational Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00