Commit 894b732630

Alex Rønne Petersen <alex@alexrp.com>
2024-08-31 22:50:26
Partially revert "LLVM: work around `@floatFromInt` bug"
This partially reverts commit ab4d6bf468bd8cba4ffd2d700d83e9707f5307b1.
1 parent 8c0902b
Changed files (1)
src
codegen
src/codegen/llvm.zig
@@ -6796,29 +6796,11 @@ pub const FuncGen = struct {
         const zcu = pt.zcu;
         const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
 
-        const workaround_operand = try self.resolveInst(ty_op.operand);
+        const operand = try self.resolveInst(ty_op.operand);
         const operand_ty = self.typeOf(ty_op.operand);
         const operand_scalar_ty = operand_ty.scalarType(zcu);
         const is_signed_int = operand_scalar_ty.isSignedInt(zcu);
 
-        const operand = o: {
-            // Work around LLVM bug. See https://github.com/ziglang/zig/issues/17381.
-            const bit_size = operand_scalar_ty.bitSize(zcu);
-            for ([_]u8{ 8, 16, 32, 64, 128 }) |b| {
-                if (bit_size < b) {
-                    break :o try self.wip.cast(
-                        if (is_signed_int) .sext else .zext,
-                        workaround_operand,
-                        try o.builder.intType(b),
-                        "",
-                    );
-                } else if (bit_size == b) {
-                    break :o workaround_operand;
-                }
-            }
-            break :o workaround_operand;
-        };
-
         const dest_ty = self.typeOfIndex(inst);
         const dest_scalar_ty = dest_ty.scalarType(zcu);
         const dest_llvm_ty = try o.lowerType(dest_ty);