# Alive2 Part 3: Things You Can and Can't Do with Undef in LLVM

DevFeed: [Alive2 Part 3: Things You Can and Can't Do with Undef in LLVM](<https://devfeed.tech/articles/alive2-part-3-things-you-can-and-can-t-do-with-undef-in-llvm-39743.md>)

Original publisher: [Read original article](<https://blog.regehr.org/archives/1837>)

Author: regehr

Published: 2020-07-31T20:33:05Z

Content type: tutorial

Language: en

Sources: [Embedded in Academia](<https://devfeed.tech/sources/embedded-in-academia.md>)

Topics: [LLVM](<https://devfeed.tech/topics/llvm.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [functions](<https://devfeed.tech/topics/functions.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [computer-science](<https://devfeed.tech/tags/computer-science.md>), [functions](<https://devfeed.tech/tags/functions.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [software-correctness](<https://devfeed.tech/tags/software-correctness.md>), [transformation](<https://devfeed.tech/tags/transformation.md>), [undef](<https://devfeed.tech/tags/undef.md>)

## AI overview

This article explains how LLVM handles undef and poison values and why they complicate compiler transformations. It uses equivalent C and C++ functions to show that LLVM can replace addition with a shift under refinement, but cannot generally reverse that transformation.

## Source excerpt

[Also see Part 1 and Part 2 in this series.] Let's talk about these functions: unsigned add(unsigned x) { return x + x; } unsigned shift(unsigned x) { return x << 1; } From the point of view of the C and C++ abstract machines, their behavior is equivalent: in a program you're writing, you [...]