[Mesa-dev] [PATCH] gallivm: fix returning unconditionally from main on TGSI_OPCODE_RET

Brian Paul brianp at vmware.com
Fri Mar 15 11:57:59 PDT 2013


On 03/15/2013 12:34 PM, sroland at vmware.com wrote:
> From: Roland Scheidegger<sroland at vmware.com>
>
> If we're in some conditional we must not return, or the code after
> the condition is never executed.
> (Probably the same for loops.)
> This fixes https://bugs.freedesktop.org/show_bug.cgi?id=62357.
>
> Note: This is a candidate for the stable branches.
> ---
>   src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 0dc26b5..b5f0ace 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -348,7 +348,9 @@ static void lp_exec_mask_ret(struct lp_exec_mask *mask, int *pc)
>      LLVMBuilderRef builder = mask->bld->gallivm->builder;
>      LLVMValueRef exec_mask;
>
> -   if (mask->call_stack_size == 0) {
> +   if (mask->call_stack_size == 0&&
> +       mask->cond_stack_size == 0&&
> +       mask->loop_stack_size == 0) {
>         /* returning from main() */
>         *pc = -1;
>         return;

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list