Use llvm_unreachable instead of assert(0).

Also removed some unused functions.