# stage2: optional comparison and 0-bit payloads · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/682cdeceaa7f55a14ad88ce01030888a9c18960e)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 682cdeceaa7f55a14ad88ce01030888a9c18960e

Requested commit: 682cdeceaa7f55a14ad88ce01030888a9c18960e

Commit: 682cdeceaa7f55a14ad88ce01030888a9c18960e

Tree: 1cc955c9090e9084509831491c70b3bcbdef02b3

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: optional comparison and 0-bit payloads

 * Sema: implement peer type resolution for optionals and null.
 * Rename `Module.optionalType` to `Type.optional`.
 * LLVM backend: re-use anonymous values. This is especially useful when
   isByRef()=true because it means re-using the same generated LLVM globals.
 * LLVM backend: rework the implementation of is_null and is_non_null
   AIR instructions. Generate slightly better LLVM code, and also fix
   the behavior for optionals whose payload type is 0-bit.
 * LLVM backend: improve `cmp` AIR instruction lowering to support
   pointer-like optionals.
 * `Value`: implement support for equality-checking optionals.

```

## Parents

- [186126c2a4032424e1b1cdb8ac379fb2beab7429](https://git.cafe/gitcafe/zig/commit/186126c2a4032424e1b1cdb8ac379fb2beab7429?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/682cdeceaa7f55a14ad88ce01030888a9c18960e?format=markdown)
