Patchwork Improve scan pattern in gcc.dg/tree-ssa/loop-31.c

login
register
mail settings
Submitter Kyrylo Tkachov
Date Dec. 6, 2013, 5:26 p.m.
Message ID <52A208D9.4010600@arm.com>
Download mbox | patch
Permalink /patch/298128/
State New
Headers show

Comments

Kyrylo Tkachov - Dec. 6, 2013, 5:26 p.m.
Hi all,

The testcase gcc.dg/tree-ssa/loop-31.c started failing on arm with r202165. The 
scan dump pattern looks for "+ 2" appearing exactly once. With r202165 the loop 
header is modified from:

   <bb 3>:
   ivtmp.5_10 = (unsigned int) &a[4294967295];
   _16 = (unsigned int) len_4(D);
   _17 = _16 * 2;
   _18 = (unsigned int) &a;
   _19 = _18 + 4294967294;
   _20 = _19 + _17;


to:

   <bb 3>:
   ivtmp.5_10 = (unsigned int) &a[4294967295];
   _16 = (sizetype) len_4(D);
   _17 = _16 + 2147483647;  <<<<  "+ 2" will match here.
   _18 = _17 * 2;
   _19 = &a + _18;
   _20 = (unsigned int) _19;


Since the strength reduction in the loop itself that this testcase is testing is 
unaffected, this patch just updates the pattern to be "+ 2;" to match the 
induction variable increment: ivtmp.5_11 = ivtmp.5_1 + 2;

Now the testcase passes on arm.

Ok for trunk?

Thanks,
Kyrill

2013-12-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.dg/tree-ssa/loop-31.c: Update scan pattern.
Jeff Law - Dec. 6, 2013, 6:16 p.m.
On 12/06/13 10:26, Kyrill Tkachov wrote:
> Hi all,
>
> The testcase gcc.dg/tree-ssa/loop-31.c started failing on arm with
> r202165. The scan dump pattern looks for "+ 2" appearing exactly once.
> With r202165 the loop header is modified from:
>
>    <bb 3>:
>    ivtmp.5_10 = (unsigned int) &a[4294967295];
>    _16 = (unsigned int) len_4(D);
>    _17 = _16 * 2;
>    _18 = (unsigned int) &a;
>    _19 = _18 + 4294967294;
>    _20 = _19 + _17;
>
>
> to:
>
>    <bb 3>:
>    ivtmp.5_10 = (unsigned int) &a[4294967295];
>    _16 = (sizetype) len_4(D);
>    _17 = _16 + 2147483647;  <<<<  "+ 2" will match here.
>    _18 = _17 * 2;
>    _19 = &a + _18;
>    _20 = (unsigned int) _19;
>
>
> Since the strength reduction in the loop itself that this testcase is
> testing is unaffected, this patch just updates the pattern to be "+ 2;"
> to match the induction variable increment: ivtmp.5_11 = ivtmp.5_1 + 2;
>
> Now the testcase passes on arm.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2013-12-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>      * gcc.dg/tree-ssa/loop-31.c: Update scan pattern.
OK.

Thanks,
Jeff

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c
index 4f22637..fa18f5e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c
@@ -15,7 +15,7 @@  short foo (int len, int v)
 
 /* When we do not have addressing mode including multiplication,
    the memory access should be strength-reduced.  */
-/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "optimized" { target arm*-*-* } } } */
-/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "optimized" { target { ia64-*-* && ilp32 } } } } */
-/* { dg-final { scan-tree-dump-times " \\+ 2" 2 "optimized" { target { ia64-*-* && lp64 } } } } */
+/* { dg-final { scan-tree-dump-times " \\+ 2;" 1 "optimized" { target arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times " \\+ 2;" 1 "optimized" { target { ia64-*-* && ilp32 } } } } */
+/* { dg-final { scan-tree-dump-times " \\+ 2;" 2 "optimized" { target { ia64-*-* && lp64 } } } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */