mirror of
https://github.com/danog/ir.git
synced 2024-12-03 10:08:29 +01:00
Fixed LLVM "ptrtoint" and "inttoptr" conversion
This commit is contained in:
parent
f78fa1a042
commit
1fa3f2b6ae
@ -303,6 +303,8 @@ static ir_ref llvm2ir_cast_op(ir_ctx *ctx, LLVMValueRef expr, ir_op op)
|
||||
dst_type = llvm2ir_type(LLVMTypeOf(expr));
|
||||
if (op == IR_ZEXT && src_type == IR_BOOL && (dst_type == IR_I8 || dst_type == IR_U8)) {
|
||||
op = IR_BITCAST;
|
||||
} else if (op == IR_BITCAST && ir_type_size[src_type] != ir_type_size[dst_type]) {
|
||||
op = (ir_type_size[src_type] < ir_type_size[dst_type]) ? IR_ZEXT : IR_TRUNC;
|
||||
}
|
||||
ref = llvm2ir_op(ctx, op0, src_type);
|
||||
ref = ir_fold1(ctx, IR_OPT(op, dst_type), ref);
|
||||
|
Loading…
Reference in New Issue
Block a user