On Tue, 25 Nov 2025, Jakub Jelinek wrote:

> Hi!
> 
> From what I can see, the vla-1.c test has been added to test the handling
> of debug info for optimized out parameters.  But recent changes don't make
> the argument optimized away, but optimized away and replaced by constant 5
> (even without IPA-VRP).  The function is noinline, but can't be noclone
> nor noipa exactly because we want to test how it behaves when it is cloned
> and the unused argument is dropped.
> 
> So, the following patch arranges to hide from the IPA optimizations the
> value of x in the caller (and even make sure it is preserved in a register
> or stack slot in the caller across the call).
> 
> Tested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2025-11-25  Jakub Jelinek  <[email protected]>
> 
>       PR testsuite/119931
>       * gcc.dg/vla-1.c (main): Hide x value from optimizers and use it after
>       the call as well.
> 
> --- gcc/testsuite/gcc.dg/vla-1.c.jj   2023-12-01 08:10:43.980306583 +0100
> +++ gcc/testsuite/gcc.dg/vla-1.c      2025-11-24 11:11:12.364719774 +0100
> @@ -16,11 +16,12 @@ main ()
>  {
>    volatile int j;
>    int x = 5;
> +  asm volatile ("" : "+r" (x));
>    j = f1 (x);
> +  asm volatile ("" : "+r" (x));
>    return 0;
>  }
>  
>  /* One debug source bind is generated for the parameter, and one to describe 
> the
>     sizes of a and b.  */
>  /* { dg-final { scan-tree-dump-times " s=> i" 2 "optimized" } } */
> -
> 
>       Jakub
> 
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to