mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Optimize multiple int casts on ptrtoint, into a single cast. Fixed incorrect widening cast from signed -> unsigned.
This commit is contained in:
@@ -1300,7 +1300,7 @@ void llvm_emit_cast(GenContext *c, CastKind cast_kind, BEValue *value, Type *to_
|
||||
llvm_value_rvalue(c, value);
|
||||
value->value = type_convert_will_trunc(to_type, from_type)
|
||||
? LLVMBuildTrunc(c->builder, value->value, llvm_get_type(c, to_type), "siuitrunc")
|
||||
: LLVMBuildZExt(c->builder, value->value, llvm_get_type(c, to_type), "siuiext");
|
||||
: LLVMBuildSExt(c->builder, value->value, llvm_get_type(c, to_type), "siuiext");
|
||||
break;
|
||||
case CAST_SIFP:
|
||||
llvm_value_rvalue(c, value);
|
||||
|
||||
Reference in New Issue
Block a user