Fixed incorrect LLVM "getelementptr" conversion

This commit is contained in:
Dmitry Stogov 2023-12-14 12:40:19 +03:00
parent bc0db1432e
commit d04540e4dc

View File

@ -1185,13 +1185,8 @@ static void llvm2ir_element_ptr(ir_ctx *ctx, LLVMValueRef insn)
type_kind = LLVMGetTypeKind(type); type_kind = LLVMGetTypeKind(type);
IR_ASSERT(type_kind == LLVMPointerTypeKind); IR_ASSERT(type_kind == LLVMPointerTypeKind);
if (LLVMGetValueKind(op0) == LLVMGlobalVariableValueKind) { type = LLVMGetGEPSourceElementType(insn);
type = LLVMGlobalGetValueType(op0); type_kind = LLVMGetTypeKind(type);
type_kind = LLVMGetTypeKind(type);
} else {
type = LLVMGetGEPSourceElementType(insn);
type_kind = LLVMGetTypeKind(type);
}
op = LLVMGetOperand(insn, 1); op = LLVMGetOperand(insn, 1);
if (LLVMGetValueKind(op) == LLVMConstantIntValueKind) { if (LLVMGetValueKind(op) == LLVMConstantIntValueKind) {