mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix to OdinLLVMBuildTransmute to goto general_end on different sized data
This commit is contained in:
@@ -2832,10 +2832,12 @@ LLVMValueRef OdinLLVMBuildTransmute(lbProcedure *p, LLVMValueRef val, LLVMTypeRe
|
|||||||
return LLVMBuildZExtOrBitCast(p->builder, val, dst_type, "");
|
return LLVMBuildZExtOrBitCast(p->builder, val, dst_type, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_size != dst_size && (lb_is_type_kind(src_type, LLVMVectorTypeKind) ^ lb_is_type_kind(dst_type, LLVMVectorTypeKind))) {
|
if (src_size != dst_size) {
|
||||||
// Okay
|
if ((lb_is_type_kind(src_type, LLVMVectorTypeKind) ^ lb_is_type_kind(dst_type, LLVMVectorTypeKind))) {
|
||||||
} else {
|
// Okay
|
||||||
GB_ASSERT_MSG(src_size == dst_size, "%s == %s", LLVMPrintTypeToString(src_type), LLVMPrintTypeToString(dst_type));
|
} else {
|
||||||
|
goto general_end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMTypeKind src_kind = LLVMGetTypeKind(src_type);
|
LLVMTypeKind src_kind = LLVMGetTypeKind(src_type);
|
||||||
@@ -2856,6 +2858,7 @@ LLVMValueRef OdinLLVMBuildTransmute(lbProcedure *p, LLVMValueRef val, LLVMTypeRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
general_end:;
|
||||||
if (LLVMIsALoadInst(val) && src_size <= dst_size) {
|
if (LLVMIsALoadInst(val) && src_size <= dst_size) {
|
||||||
LLVMValueRef val_ptr = LLVMGetOperand(val, 0);
|
LLVMValueRef val_ptr = LLVMGetOperand(val, 0);
|
||||||
val_ptr = LLVMBuildPointerCast(p->builder, val_ptr, LLVMPointerType(dst_type, 0), "");
|
val_ptr = LLVMBuildPointerCast(p->builder, val_ptr, LLVMPointerType(dst_type, 0), "");
|
||||||
|
|||||||
Reference in New Issue
Block a user