Skip to content

Commit 6780a6b

Browse files
committed
wasm backend: delete dead code in lowerConstant
1 parent ada0010 commit 6780a6b

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

src/arch/wasm/CodeGen.zig

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,51 +3067,6 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue {
30673067
}
30683068
if (val.isUndefDeep(mod)) return func.emitUndefined(ty);
30693069

3070-
if (val.ip_index == .none) switch (ty.zigTypeTag(mod)) {
3071-
.Array => |zig_type| return func.fail("Wasm TODO: LowerConstant for zigTypeTag {}", .{zig_type}),
3072-
.Struct => {
3073-
const struct_obj = mod.typeToStruct(ty).?;
3074-
assert(struct_obj.layout == .Packed);
3075-
var buf: [8]u8 = .{0} ** 8; // zero the buffer so we do not read 0xaa as integer
3076-
val.writeToPackedMemory(ty, func.bin_file.base.options.module.?, &buf, 0) catch unreachable;
3077-
const int_val = try mod.intValue(
3078-
struct_obj.backing_int_ty,
3079-
std.mem.readIntLittle(u64, &buf),
3080-
);
3081-
return func.lowerConstant(int_val, struct_obj.backing_int_ty);
3082-
},
3083-
.Vector => {
3084-
assert(determineSimdStoreStrategy(ty, mod) == .direct);
3085-
var buf: [16]u8 = undefined;
3086-
val.writeToMemory(ty, mod, &buf) catch unreachable;
3087-
return func.storeSimdImmd(buf);
3088-
},
3089-
.Frame,
3090-
.AnyFrame,
3091-
=> return func.fail("Wasm TODO: LowerConstant for type {}", .{ty.fmt(mod)}),
3092-
.Float,
3093-
.Union,
3094-
.Optional,
3095-
.ErrorUnion,
3096-
.ErrorSet,
3097-
.Int,
3098-
.Enum,
3099-
.Bool,
3100-
.Pointer,
3101-
=> unreachable, // handled below
3102-
.Type,
3103-
.Void,
3104-
.NoReturn,
3105-
.ComptimeFloat,
3106-
.ComptimeInt,
3107-
.Undefined,
3108-
.Null,
3109-
.Opaque,
3110-
.EnumLiteral,
3111-
.Fn,
3112-
=> unreachable, // comptime-only types
3113-
};
3114-
31153070
switch (ip.indexToKey(val.ip_index)) {
31163071
.int_type,
31173072
.ptr_type,

0 commit comments

Comments
 (0)