Towards Removing Undef Values from LLVM IR
summary
LLVM adds a new byte type and a freezing load that let uninitialized memory become poison instead of undef, fixing raw-copy and bitfield miscompilations. Alive2 finds 136 miscompilations today; 25 (≈18%) become correct if undef vanishes and the prototype already fixes 11 tests (≈8%) with no new failures. Benchmarks show ~0.8% average run-time regression (worst ≈4%) reduced to ~0.2% after simple folds, compile-time impact ≈0.2%, and the first patch is upstreamed.
AI-written summary · about
chapters (9)
- 0:00Undef in LLVM IR
- 1:07Undef causes miscompilations
- 3:31Removing undef challenges
- 7:01Byte type for raw memory
- 10:35Freezing loads for bit fields
- 11:17Evaluating byte type and freezing
- 12:45Performance impact of optimizations
- 14:29Upstreaming progress
- 15:33Q&A
related talks
22mReconciling High-level Optimizations and Low-level Code in LLVM
46m“My Little Optimizer: Undefined Behavior is Magic"
49mUndefined Behavior in 2017 (part 1 of 2)
54mUndefined Behaviour is awesome!
24mTowards Understanding the Costs of Avoiding Out-of-Thin-Air Results
19mExploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the(…)
21mWeak Memory Demands Model-based Compiler Testing
59mCompiler-assisted Translation Validation
