GlobalISel lowers switches to a sequence of conditional branches spanning multiple basic blocks. This means that a single CFG edge at the IR level can change when the MIR has been generated. Successors are still well-behaved, but when querying the MachineBasicBlock predecessors (e.g. to translate a PHI), a more sophisticated analysis than getOrCreateBB is needed.
This adds a callback to IRTranslator that every translation which modifies the CFG (currently only switch translation) should be aware of. finishPendingPHIs then uses this extra information to create a correct PHI at the end of translation. If a switch instruction isn't involved in any of the PHI's predecessors then we fall back to the usually sufficient bijective map from BasicBlocks to MachineBasicBlocks.
This should fix at least one failure in the test-suite bot under GlobalISel (halide).
const CFGEdge &, MachineBasicBlock &