# Sema: improved AIR when one operand of bool cmp is known · gitcafe/zig

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

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

Visibility: public

Requested revision: 6e78c007dff96de98c44c52da890cdae3d6e1389

Requested commit: 6e78c007dff96de98c44c52da890cdae3d6e1389

Commit: 6e78c007dff96de98c44c52da890cdae3d6e1389

Tree: f01868c88c8a045906a0b868243b5df094afe3c6

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: improved AIR when one operand of bool cmp is known

When doing `x == true` or `x == false` it is now lowered as either a
no-op or a not, respectively, rather than a cmp instruction.

This commit also extracts a zirCmpEq function out from zirCmp, reducing
the amount of branching (on is_equality_cmp) in both functions.

```

## Parents

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

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