From: Matteo Bruni Subject: Re: [PATCH 2/5] d3dcompiler: Fold addition and multiplication of uint constants. Message-Id: Date: Thu, 2 Jul 2020 19:09:44 +0200 In-Reply-To: <29438019-3d6b-d5b8-bf39-006c91826ad1@codeweavers.com> References: <20200629235539.392976-1-zfigura@codeweavers.com> <20200629235539.392976-2-zfigura@codeweavers.com> <29438019-3d6b-d5b8-bf39-006c91826ad1@codeweavers.com> On Thu, Jul 2, 2020 at 6:47 PM Zebediah Figura wrote: > > On 7/2/20 11:15 AM, Matteo Bruni wrote: > > On Tue, Jun 30, 2020 at 1:56 AM Zebediah Figura wrote: > > > >> +{ > >> + struct hlsl_ir_node *instr, *next; > >> + BOOL progress = 0; > >> + > >> + LIST_FOR_EACH_ENTRY_SAFE(instr, next, instrs, struct hlsl_ir_node, entry) > >> + { > >> + if (instr->type == HLSL_IR_IF) > >> + { > >> + struct hlsl_ir_if *iff = if_from_node(instr); > >> + progress |= transform_ir(func, iff->then_instrs); > >> + if (iff->else_instrs) > >> + progress |= transform_ir(func, iff->else_instrs); > >> + } > > > > I like to have a blank line between declarations and other statements. > > Oops, missed that one :-/ No problem :) > > > >> + else if (instr->type == HLSL_IR_LOOP) > >> + progress |= transform_ir(func, loop_from_node(instr)->body); > > > > Unrelated to the patch: maybe we should always initialize else_instrs? > > I think that would get rid of a bunch of checks with no drawback. > > Besides another heap allocation (though maybe we could just store those > inline instead? I don't think there's any reason why not), but yes, > probably. Yeah, I don't see any problem with inlining them either.