Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- sparse-llvm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sparse-llvm.c b/sparse-llvm.c index 135b9e001..ad69124e1 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -408,6 +408,14 @@ static LLVMValueRef pseudo_to_value(struct function *fn, struct instruction *ins return result; } +static LLVMValueRef pseudo_to_rvalue(struct function *fn, struct instruction *insn, pseudo_t pseudo) +{ + LLVMValueRef val = pseudo_to_value(fn, insn, pseudo); + LLVMTypeRef dtype = symbol_type(insn->type); + + return LLVMBuildBitCast(fn->builder, val, dtype, ""); +} + static LLVMValueRef calc_gep(LLVMBuilderRef builder, LLVMValueRef base, LLVMValueRef off) { LLVMTypeRef type = LLVMTypeOf(base); @@ -655,7 +663,7 @@ static void output_op_store(struct function *fn, struct instruction *insn) addr = calc_memop_addr(fn, insn); - target_in = pseudo_to_value(fn, insn, insn->target); + target_in = pseudo_to_rvalue(fn, insn, insn->target); /* perform store */ LLVMBuildStore(fn->builder, target_in, addr); @@ -744,7 +752,7 @@ static void output_op_call(struct function *fn, struct instruction *insn) i = 0; FOR_EACH_PTR(insn->arguments, arg) { - args[i++] = pseudo_to_value(fn, arg, arg->src); + args[i++] = pseudo_to_rvalue(fn, arg, arg->src); } END_FOR_EACH_PTR(arg); func = pseudo_to_value(fn, insn, insn->func); -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html