diff mbox series

[2/2] RISC-V/testsuite: Also verify if-conversion runs for pr105314.c

Message ID alpine.DEB.2.20.2401112325170.5892@tpp.orcam.me.uk
State New
Headers show
Series RISC-V/testsuite: A couple of improvements for pr105314.c | expand

Commit Message

Maciej W. Rozycki Jan. 11, 2024, 11:35 p.m. UTC
Verify that if-conversion succeeded through noce_try_store_flag_mask, as 
per PR rtl-optimization/105314, tightening the test case and making it 
explicit.

	gcc/testsuite/
	* gcc.target/riscv/pr105314.c: Scan the RTL "ce1" pass too.
---
 gcc/testsuite/gcc.target/riscv/pr105314.c |    2 ++
 1 file changed, 2 insertions(+)

gcc-test-riscv-pr105314-rtl.diff

Comments

Kito Cheng Jan. 12, 2024, 9:53 a.m. UTC | #1
LGTM

On Fri, Jan 12, 2024 at 7:37 AM Maciej W. Rozycki <macro@embecosm.com> wrote:
>
> Verify that if-conversion succeeded through noce_try_store_flag_mask, as
> per PR rtl-optimization/105314, tightening the test case and making it
> explicit.
>
>         gcc/testsuite/
>         * gcc.target/riscv/pr105314.c: Scan the RTL "ce1" pass too.
> ---
>  gcc/testsuite/gcc.target/riscv/pr105314.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> gcc-test-riscv-pr105314-rtl.diff
> Index: gcc/gcc/testsuite/gcc.target/riscv/pr105314.c
> ===================================================================
> --- gcc.orig/gcc/testsuite/gcc.target/riscv/pr105314.c
> +++ gcc/gcc/testsuite/gcc.target/riscv/pr105314.c
> @@ -1,6 +1,7 @@
>  /* PR rtl-optimization/105314 */
>  /* { dg-do compile } */
>  /* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
> +/* { dg-options "-fdump-rtl-ce1" } */
>
>  long
>  foo (long a, long b, long c)
> @@ -10,4 +11,5 @@ foo (long a, long b, long c)
>    return a;
>  }
>
> +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_store_flag_mask" 1 "ce1" } } */
>  /* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */
Andrew Pinski Jan. 12, 2024, 10:04 a.m. UTC | #2
On Thu, Jan 11, 2024 at 3:37 PM Maciej W. Rozycki <macro@embecosm.com> wrote:
>
> Verify that if-conversion succeeded through noce_try_store_flag_mask, as
> per PR rtl-optimization/105314, tightening the test case and making it
> explicit.
>
>         gcc/testsuite/
>         * gcc.target/riscv/pr105314.c: Scan the RTL "ce1" pass too.

I have an objection for this, if we are checking the RTL pass and not
overall code generation, then maybe we change the testcase so that it
is a RTL testcase instead.
Especially when there might be improvements going into GCC 15
specifically targeting ifcvt on the gimple level (I am planning on
doing some).

Thanks,
Andrew Pinski

> ---
>  gcc/testsuite/gcc.target/riscv/pr105314.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> gcc-test-riscv-pr105314-rtl.diff
> Index: gcc/gcc/testsuite/gcc.target/riscv/pr105314.c
> ===================================================================
> --- gcc.orig/gcc/testsuite/gcc.target/riscv/pr105314.c
> +++ gcc/gcc/testsuite/gcc.target/riscv/pr105314.c
> @@ -1,6 +1,7 @@
>  /* PR rtl-optimization/105314 */
>  /* { dg-do compile } */
>  /* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
> +/* { dg-options "-fdump-rtl-ce1" } */
>
>  long
>  foo (long a, long b, long c)
> @@ -10,4 +11,5 @@ foo (long a, long b, long c)
>    return a;
>  }
>
> +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_store_flag_mask" 1 "ce1" } } */
>  /* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */
Maciej W. Rozycki Jan. 12, 2024, 1:59 p.m. UTC | #3
On Fri, 12 Jan 2024, Andrew Pinski wrote:

> > Verify that if-conversion succeeded through noce_try_store_flag_mask, as
> > per PR rtl-optimization/105314, tightening the test case and making it
> > explicit.
> >
> >         gcc/testsuite/
> >         * gcc.target/riscv/pr105314.c: Scan the RTL "ce1" pass too.
> 
> I have an objection for this, if we are checking the RTL pass and not
> overall code generation, then maybe we change the testcase so that it
> is a RTL testcase instead.

 It's not clear to me what you mean by an "RTL testcase", i.e. how you'd 
see the testcase changed (or an additional one produced instead) and why, 
please elaborate.  Right now we verify that branches are absent from 
output, but not how that happens.

> Especially when there might be improvements going into GCC 15
> specifically targeting ifcvt on the gimple level (I am planning on
> doing some).

 How are the improvements going to affect the testcase?

 If they make it no longer relevant (in which case a replacement testcase 
for the new arrangement will be needed) or require updates, then I think 
it's an expected situation: one of the purposes of the testsuite is to 
make sure we're in control and understand what the consequences of changes 
made are.  It's not that the testsuite is cast in stone and not expected 
to change.

 I.e. if we expect noce_try_store_flag_mask no longer to trigger, then 
we'll see that in the test results (good!) and we can update the relevant 
test case(s). e.g. by reversing the pass criteria so that we're still in 
control.

  Maciej
Jeff Law Jan. 16, 2024, 2:22 p.m. UTC | #4
On 1/12/24 06:59, Maciej W. Rozycki wrote:
> On Fri, 12 Jan 2024, Andrew Pinski wrote:
> 
>>> Verify that if-conversion succeeded through noce_try_store_flag_mask, as
>>> per PR rtl-optimization/105314, tightening the test case and making it
>>> explicit.
>>>
>>>          gcc/testsuite/
>>>          * gcc.target/riscv/pr105314.c: Scan the RTL "ce1" pass too.
>>
>> I have an objection for this, if we are checking the RTL pass and not
>> overall code generation, then maybe we change the testcase so that it
>> is a RTL testcase instead.
> 
>   It's not clear to me what you mean by an "RTL testcase", i.e. how you'd
> see the testcase changed (or an additional one produced instead) and why,
> please elaborate.  Right now we verify that branches are absent from
> output, but not how that happens.
What I'm guessing Andrew is suggesting is the testcase be adjusted so 
that its source is RTL rather than C.  With that framework you can skip 
most of the pipeline and make the test more stable if something changes 
earlier in the pipeline.

There aren't a lot of great examples of this and the RTL parser is 
probably less stable than the gimple parser.  But if you look in 
gcc.dg/rtl you should see examples.

In theory you can take the RTL dump from a pass, massage it and feed it 
back into the compiler.  Perhaps a good example is rtl/x86_64/ira.c


> 
>> Especially when there might be improvements going into GCC 15
>> specifically targeting ifcvt on the gimple level (I am planning on
>> doing some).
> 
>   How are the improvements going to affect the testcase?
> 
>   If they make it no longer relevant (in which case a replacement testcase
> for the new arrangement will be needed) or require updates, then I think
> it's an expected situation: one of the purposes of the testsuite is to
> make sure we're in control and understand what the consequences of changes
> made are.  It's not that the testsuite is cast in stone and not expected
> to change.
> 
>   I.e. if we expect noce_try_store_flag_mask no longer to trigger, then
> we'll see that in the test results (good!) and we can update the relevant
> test case(s). e.g. by reversing the pass criteria so that we're still in
> control.
I think Andrew's point is that we can still test that the pass does what 
we want when presented with RTL in a particular form and isolate the 
pass from depending on prior passes in the pipeline either creating or 
not destroying the particular form we want to ensure is properly handled.

I don't have a strong opinion on this.  I certainly see Andrew's point, 
but it's also the case that if some work earlier in the RTL or gimple 
pipeline comes along and compromises the test, then we'd see the failure 
and deal with it.  It's pretty standard procedure.

Jeff
Maciej W. Rozycki Jan. 16, 2024, 3:33 p.m. UTC | #5
On Tue, 16 Jan 2024, Jeff Law wrote:

> >   It's not clear to me what you mean by an "RTL testcase", i.e. how you'd
> > see the testcase changed (or an additional one produced instead) and why,
> > please elaborate.  Right now we verify that branches are absent from
> > output, but not how that happens.
> What I'm guessing Andrew is suggesting is the testcase be adjusted so that its
> source is RTL rather than C.  With that framework you can skip most of the
> pipeline and make the test more stable if something changes earlier in the
> pipeline.
> 
> There aren't a lot of great examples of this and the RTL parser is probably
> less stable than the gimple parser.  But if you look in gcc.dg/rtl you should
> see examples.
> 
> In theory you can take the RTL dump from a pass, massage it and feed it back
> into the compiler.  Perhaps a good example is rtl/x86_64/ira.c

 Thanks, I wasn't aware of this feature.

> >   How are the improvements going to affect the testcase?
> > 
> >   If they make it no longer relevant (in which case a replacement testcase
> > for the new arrangement will be needed) or require updates, then I think
> > it's an expected situation: one of the purposes of the testsuite is to
> > make sure we're in control and understand what the consequences of changes
> > made are.  It's not that the testsuite is cast in stone and not expected
> > to change.
> > 
> >   I.e. if we expect noce_try_store_flag_mask no longer to trigger, then
> > we'll see that in the test results (good!) and we can update the relevant
> > test case(s). e.g. by reversing the pass criteria so that we're still in
> > control.
> I think Andrew's point is that we can still test that the pass does what we
> want when presented with RTL in a particular form and isolate the pass from
> depending on prior passes in the pipeline either creating or not destroying
> the particular form we want to ensure is properly handled.

 It makes sense to me.

> I don't have a strong opinion on this.  I certainly see Andrew's point, but
> it's also the case that if some work earlier in the RTL or gimple pipeline
> comes along and compromises the test, then we'd see the failure and deal with
> it.  It's pretty standard procedure.

 I'll be happy to add an RTL test case, also for my recent complementary 
cset-sext.c addition and maybe other if-conversion pieces recently added.  
I think that does not preclude arming pr105314.c with RTL scanning though.

  Maciej
Maciej W. Rozycki Jan. 24, 2024, 11:26 a.m. UTC | #6
On Tue, 16 Jan 2024, Maciej W. Rozycki wrote:

> > I don't have a strong opinion on this.  I certainly see Andrew's point, but
> > it's also the case that if some work earlier in the RTL or gimple pipeline
> > comes along and compromises the test, then we'd see the failure and deal with
> > it.  It's pretty standard procedure.
> 
>  I'll be happy to add an RTL test case, also for my recent complementary 
> cset-sext.c addition and maybe other if-conversion pieces recently added.  
> I think that does not preclude arming pr105314.c with RTL scanning though.

 I have made a buch of testcases as we discussed at the meeting last week 
and the RTL parser did not blow up, so I have now submitted them.  See: 
<patches-gcc/https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643802.html> 
and the next two messages (threading broke with this submission for some 
reason, probably due to a glitch in my mail client I've seen from time to 
time; I guess it's not worth it to get the patch series resubmitted as 
they are independent from each other really and can be applied in any 
order).

 I haven't heard back from Andrew beyond his initial message, so it's not 
clear to me whether he maintains his objection in spite the arguments 
given.  Andrew?

 Do we have consensus now to move forward with this change as posted?  I'd 
like to get these patches ticked off ASAP.

  Maciej
Jeff Law Jan. 24, 2024, 5:24 p.m. UTC | #7
On 1/24/24 04:26, Maciej W. Rozycki wrote:
> On Tue, 16 Jan 2024, Maciej W. Rozycki wrote:
> 
>>> I don't have a strong opinion on this.  I certainly see Andrew's point, but
>>> it's also the case that if some work earlier in the RTL or gimple pipeline
>>> comes along and compromises the test, then we'd see the failure and deal with
>>> it.  It's pretty standard procedure.
>>
>>   I'll be happy to add an RTL test case, also for my recent complementary
>> cset-sext.c addition and maybe other if-conversion pieces recently added.
>> I think that does not preclude arming pr105314.c with RTL scanning though.
> 
>   I have made a buch of testcases as we discussed at the meeting last week
> and the RTL parser did not blow up, so I have now submitted them.  See:
> <patches-gcc/https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643802.html>
> and the next two messages (threading broke with this submission for some
> reason, probably due to a glitch in my mail client I've seen from time to
> time; I guess it's not worth it to get the patch series resubmitted as
> they are independent from each other really and can be applied in any
> order).
> 
>   I haven't heard back from Andrew beyond his initial message, so it's not
> clear to me whether he maintains his objection in spite the arguments
> given.  Andrew?
> 
>   Do we have consensus now to move forward with this change as posted?  I'd
> like to get these patches ticked off ASAP.
I think it should move forward.  I think having the RTL tests deals with 
Andrew's concern and the testcase adjustment has value as well.

I ACK's the RTL tests a few minutes ago and we should consider the 1/2 
and 2/2 of the original OK now as well.

Thanks,
Jeff
Maciej W. Rozycki Jan. 26, 2024, 9:49 p.m. UTC | #8
On Wed, 24 Jan 2024, Jeff Law wrote:

> >   Do we have consensus now to move forward with this change as posted?  I'd
> > like to get these patches ticked off ASAP.
> I think it should move forward.  I think having the RTL tests deals with
> Andrew's concern and the testcase adjustment has value as well.
> 
> I ACK's the RTL tests a few minutes ago and we should consider the 1/2 and 2/2
> of the original OK now as well.

 I have committed both patch series now, thank you for your assistance and 
review.

  Maciej
diff mbox series

Patch

Index: gcc/gcc/testsuite/gcc.target/riscv/pr105314.c
===================================================================
--- gcc.orig/gcc/testsuite/gcc.target/riscv/pr105314.c
+++ gcc/gcc/testsuite/gcc.target/riscv/pr105314.c
@@ -1,6 +1,7 @@ 
 /* PR rtl-optimization/105314 */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
+/* { dg-options "-fdump-rtl-ce1" } */
 
 long
 foo (long a, long b, long c)
@@ -10,4 +11,5 @@  foo (long a, long b, long c)
   return a;
 }
 
+/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_store_flag_mask" 1 "ce1" } } */
 /* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */