Skip to content

Instantly share code, notes, and snippets.

@bryant
Created August 5, 2016 14:05
Show Gist options
  • Save bryant/844db7a7bd3135261c75a1704a06d75f to your computer and use it in GitHub Desktop.
Save bryant/844db7a7bd3135261c75a1704a06d75f to your computer and use it in GitHub Desktop.

Understanding LLVM's undef

- value domain is:
    n => {n} where n is a numeric value
    undef => {B} where B is all possible bit sequences
    use dom(x) to denote domain of x

- a `op` b = {m `op` n` | m <- dom(a), n <- dom(b)}

- during optimization, it counts as safe to assume that a binding takes on one
  specific value (or more) in its domain. so if a binding takes on a range of
  values, it could be assumed to take on a specific value in this range, which
  is why this is considered safe in LangRef.rst:

    undef `or` 0x8000 == 0x8000, since all {m `or` n | m <- {B}, n <- {0x8000}}
    == {0x8000, 0x8001, ... 0xFFFF} != {B}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment