pub fn fusable(
func: &Func,
insts: &BranchInsts,
names: &mut Interner,
) -> HashSet<Inst>Expand description
The comparisons a branch on their answer is the whole of what reads, which blocks may fold
the test out of.
Run before allocation, on the same function blocks is later given. What it answers is
whether anything but the branch reads the byte a comparison wrote, and that is a question about
a virtual register: a physical one is written many times in a function and counting its readers
would mean asking which of the writes each reader belongs to. So it is asked here, where a
register is written once, and the answer is carried to the pass that can use it.
Being on this list is necessary and not sufficient. Allocation may put a reload between the
comparison and the branch, and a comparison that is no longer the instruction in front of the
branch is not one the flags survive to, so blocks checks that again on what it finds.