Type-Alias Analysis: Enabling LLVM IR with Accurate Types
LLVM Intermediate Representation (IR) underpins the LLVM compiler infrastructure, offering a strong type system and a static single-assignment (SSA) form that are well-suited for program analysis. However, its single-type design assigns exactly one type to each IR variable, even when the variable may legitimately correspond to multiple types. The recent introduction of opaque pointers exacerbates this limitation: all pointers in the IR are uniformly represented with a generic pointer type (ptr) that erases concrete pointee type information, making many type-based analyses ineffective. To address the limitations of single-type design, we introduce type-alias analysis, a multiple-type design that maintains type-alias sets for IR variables and infers types across IR instructions. We have developed TypeCopilot, a prototype that recovers concrete pointee types for opaque-pointer-enabled LLVM IR generated from C programs. TypeCopilot achieves 98.57% accuracy with 94.98% coverage, allowing existing analysis tools to retain their effectiveness despite the adoption of opaque pointers. To foster further research and security applications, we have open-sourced TypeCopilot, providing the community with a practical foundation for precise, type-aware security analyses on modern LLVM IR.
Authors
- Zhiyun Qian (ORCID: https://orcid.org/0000-0003-1506-2522)
- Ziyue Pan (ORCID: https://orcid.org/0000-0003-0700-6571)
- Wenbo Shen (ORCID: https://orcid.org/0000-0003-2899-6121)
- Kangjie Lu (ORCID: https://orcid.org/0000-0002-4763-7354)
- X.-D. Wang
- Jinmeng Zhou
Institutions
- University of California, Riverside (US)
- University of Minnesota (US)
- Twin Cities Orthopedics (US)
- Zhejiang University (CN)
Publication Details
- Journal
- Proceedings of the ACM on software engineering.
- Published
- 2025-06-22
- DOI
- https://doi.org/10.1145/3728974
- Citations
- 1
- Primary Topic
- Security and Verification in Computing
- Type
- article
- Field-Weighted Citation Impact
- 2.48