This revision update function removeUndefIntroducingPredecessor in SImplifyCFG.
Adding processing of SwitchInst cases.
How it works:
main: x = random(1, 2); switch (x) { case 1: br BB1 case 2: br BB2 case 3: br BB3 ---------------------------> UnreachebleBlock case 4: br BB4 ---------------------------> UnreachebleBlock } BB1 and BB2: phi = [...], ... todo something BB3 and BB4:---------------------------------> UnreachebleBlock: phi = [undef, main] --------------------------> CreateUnreacheble()
Better