aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-13 22:22:19 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-14 00:11:46 -0700
commit7a477a1110c9bf7b4a83a87dcbd5b160842b29e7 (patch)
treece77e2c389d37dd7068a32d12b19bd1fc8507e46 /src/codegen/llvm.zig
parentd42d31f72f38165f70c2850e9cc63da44b3b470c (diff)
downloadzig-7a477a1110c9bf7b4a83a87dcbd5b160842b29e7.tar.gz
zig-7a477a1110c9bf7b4a83a87dcbd5b160842b29e7.zip
LLVM: fix int_to_float signedness detection
It was checking if the result (float) type was a signed int rather than checking the operand (integer) type.
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 723516fc77..42e94a3528 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -3709,10 +3709,11 @@ pub const FuncGen = struct {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
const operand = try self.resolveInst(ty_op.operand);
+ const operand_ty = self.air.typeOf(ty_op.operand);
const dest_ty = self.air.typeOfIndex(inst);
const dest_llvm_ty = try self.dg.llvmType(dest_ty);
- if (dest_ty.isSignedInt()) {
+ if (operand_ty.isSignedInt()) {
return self.builder.buildSIToFP(operand, dest_llvm_ty, "");
} else {
return self.builder.buildUIToFP(operand, dest_llvm_ty, "");