fix llvm assertion failures due to instruction deletion