diff --git a/lib/std/enums.zig b/lib/std/enums.zig index 6e21713e6d28c33e2088e88b3c98e5b75a2e5756..406869082e0bd039c1b8bf3a8003047bc1e42a17 100644 --- a/lib/std/enums.zig +++ b/lib/std/enums.zig @@ -42,6 +42,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def /// The result array is in the same order as the input. pub inline fn valuesFromFields(comptime E: type, comptime fields: []const EnumField) []const E { comptime { + @setEvalBranchQuota(@typeInfo(E).@"enum".fields.len + eval_branch_quota_cushion); var result: [fields.len]E = undefined; for (&result, fields) |*r, f| { r.* = @enumFromInt(f.value); @@ -53,7 +54,7 @@ pub inline fn valuesFromFields(comptime E: type, comptime fields: []const EnumFi /// Returns the set of all named values in the given enum, in /// declaration order. -pub fn values(comptime E: type) []const E { +pub inline fn values(comptime E: type) []const E { return comptime valuesFromFields(E, @typeInfo(E).@"enum".fields); } diff --git a/src/codegen/x86_64/CodeGen.zig b/src/codegen/x86_64/CodeGen.zig index 5032a5128998c96891cfe39f56cd5a040562bb2c..6144a421c8cb132aebd77f745bff78618a3e7a0f 100644 --- a/src/codegen/x86_64/CodeGen.zig +++ b/src/codegen/x86_64/CodeGen.zig @@ -177113,7 +177113,7 @@ fn airBr(self: *CodeGen, inst: Air.Inst.Index) !void { } fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void { - @setEvalBranchQuota(1_100); + @setEvalBranchQuota(1_100 + @typeInfo(Mir.Inst.Fixes).@"enum".fields.len); const pt = self.pt; const zcu = pt.zcu; const unwrapped_asm = self.air.unwrapAsm(inst);