Towards Removing Undef Values from LLVM IR
Pedro Lobo, John McIver, George Mitenkov, Juneyoung Lee, Kirshanthan Sundararajah, Nuno P. Lopes
摘要
LLVM's intermediate representation (IR) has two deferred undefined behavior (UB) values: undef and poison. The existence of these two values has been a persistent source of bugs. Reasoning about the correctness of analyses and optimizations for the regular cases is already tricky; ensuring that these are sound for all UB cases is highly non-trivial.
Undef values, in particular, are one of the most misunderstood concepts of LLVM IR. On paper, the definition is simple: they represent an arbitrary value of the underlying type, and can yield a different value each time they are observed. However, this property makes even simple algebraic rewrites, such as replacing 2 × 𝑦 with 𝑦 + 𝑦, unsound in LLVM.
Because reasoning about undef is hard, and the benefits of having it are limited, we have set a roadmap to eliminate it altogether from LLVM IR. The last remaining use of undef is the value of uninitialized memory, which has implications on the lowering of bitfields, as well as raw data copies and comparisons.
In this paper, we propose an extension to LLVM IR that includes a raw memory value type and a freezing load. We show that these two constructs are sufficient to replace the remaining uses of undef in LLVM. Our implementation shows that these changes have minimal impact on both run-time and compile-time performance. By removing the final hurdle to eliminating undef from LLVM IR, this work paves the way for a simpler semantic model and easier reasoning about the soundness of IR analyses and optimizations.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了最后一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
它引用的顶会 Paper10
- Alive2: bounded translation validation for LLVMNuno P. Lopes, Juneyoung Lee, Chung-Kil Hur, Zhengyang Liu 等PLDI 2021 · 被引用 109 次
- Refined Input, Degraded Output: The Counterintuitive World of Compiler BehaviorTheodoros Theodoridis, Zhendong SuPLDI 2024 · 被引用 14 次
- VIP: verifying real-world C idioms with integer-pointer castsRodolphe Lepigre, Michael Sammler, Kayvan Memarian, Robbert Krebbers 等POPL 2022 · 被引用 11 次
- An SMT Encoding of LLVM's Memory Model for Bounded Translation ValidationJuneyoung Lee, Dongjoo Kim, Chung-Kil Hur, Nuno P. LopesCAV 2021 · 被引用 10 次
- OOElala: order-of-evaluation based alias analysis for compiler optimizationAnkush Phulia, Vaibhav Bhagee, Sorav BansalPLDI 2020 · 被引用 9 次
相关 Paper
- Exploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the Performance ImpactLucian Popescu, Nuno P. LopesPLDI 2025 · 被引用 2 次
- An Integer Overflow Endgame: Compiler and Architecture Support for Default-On Integer Overflow MitigationZheng Zhang, Qi Ling, Kian Kasad, Brendan Ryan Sweeney 等USENIX Security 2026
- IRFuzzer: Specialized Fuzzing for LLVM Backend Code GenerationYuyang Rong, Zhanghan Yu, Zhenkai Weng, Stephen Neuendorffer 等ICSE 2025 · 被引用 1 次
- Translation Validation for LLVM's AArch64 BackendRyan Berger, Mitch Briles, Nader Boushehrinejad Moradi, Nicholas Coughlin 等OOPSLA 2025 · 被引用 3 次
- Type-Alias Analysis: Enabling LLVM IR with Accurate TypesJinmeng Zhou, Ziyue Pan, Wenbo Shen, Xingkai Wang 等ISSTA 2025 · 被引用 1 次
