Llvm Remove Terminator Instruction
问题 I want to remove an UnreachableInst since a previous transformation has made it reachable. However, calling eraseFromParent() gives me a malformed BasicBlock since the UnreachableInst is the terminator of its BasicBlock. How do I fix the BasicBlock to terminate at the instruction previous to the UnreachableInst? 回答1: Every basic block must end with a terminator. I think that the most straightforward way to remove the unreachable instruction, then, is to replace it with another terminator -