Fix invalid LLVM IR generated for type conversion