[PATCH vkd3d v8 2/4] vkd3d-shader/hlsl: Handle conditionals in copy propagation.
Matteo Bruni
matteo.mystral at gmail.com
Wed Dec 1 03:00:31 CST 2021
On Tue, Nov 30, 2021 at 7:10 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>
> So this is failing to optimize the following program, and I can't see why:
>
> uniform int i;
>
> float main() : sv_target
> {
> float x = 0;
> if (0){}
> return x;
> }
>
> It generates the following code:
>
> 2: float | 0.00000000e+00
> 3: | = (x.x @2)
> 4: int | 0
> 5: | if (@4) {
> } else {
> }
> 6: float | x
> 7: | = (<retval-0x5620633a6280>.x @6)
> 8: | return
> 9: uint | 0
> 10: float | <retval-0x5620633a6280>[@9]
> 11: | = (<output-sv_target0>.x @10)
>
> I'd expect @6 to be rewritten to @2.x, but that doesn't happen. Do you
> know why?
Good catch. It's caused by the return in the HLSL_IR_IF case in
copy_propagation_transform_block(), we want to turn that to a break.
I'll make that change, among others, before resending.
More information about the wine-devel
mailing list