// fuseIntegerComparisons optimizes inequalities such as '1 <= x && x < 5', // which can be optimized to 'unsigned(x-1) < 4'. // // Look for branch structure like: // // p // |\ // | b // |/ \ // s0 s1 // // In our example, p has control '1 <= x', b has control 'x < 5', // and s0 and s1 are the if and else results of the comparison. // // This will be optimized into: // // p // \ // b // / \ // s0 s1 // // where b has the combined control value 'unsigned(x-1) < 4'. // Later passes will then fuse p and b. func fuseIntegerComparisons(b *Block) bool { … } // getConstIntArgIndex returns the index of the first argument that is a // constant integer or -1 if no such argument exists. func getConstIntArgIndex(v *Value) int { … } // isSignedInequality reports whether op represents the inequality < or ≤ // in the signed domain. func isSignedInequality(v *Value) bool { … } // isUnsignedInequality reports whether op represents the inequality < or ≤ // in the unsigned domain. func isUnsignedInequality(v *Value) bool { … } func areMergeableInequalities(x, y *Value) bool { … }