1;; Rewrites for `select_spectre_guard` -- check these rules carefully!
2;;
3;; This instruction prohibits all speculation on the controlling value when
4;; determining which input to use as the result. Rewrites must respect that
5;; requirement.
6
7;; If we statically know which value will be the result, it's safe to just use
8;; that value. No speculation on the controlling value is possible if we simply
9;; don't depend on that value at all.
10(rule (simplify (select_spectre_guard _ _ x x))
11      (subsume x))
12(rule (simplify (select_spectre_guard _ (iconst_u _ (u64_when_non_zero)) x _))
13      (subsume x))
14(rule (simplify (select_spectre_guard _ (iconst_u _ 0) _ y))
15      (subsume y))
16