Revisiting PR40815, in particular the attached supposedly bad dump shows: D.2021_14 = (unsigned int) rite_2; D.2022_9 = (unsigned int) element_5(D); D.2023_15 = -D.2022_9; D.2024_16 = D.2021_14 + D.2023_15; rite_17 = (char *) D.2024_16;
while now we have _7 = (sizetype) element_6(D); _8 = -_7; rite_9 = rite_1 + _8; which TER will happily forward into the POINTER_PLUS_EXPR. Thus the following adjusts the dump-scanning to expect exactly that simplified form. Tested on x86_64-unknown-linux-gnu, applied. Richard. 2012-12-18 Richard Biener <rguent...@suse.de> * gcc.dg/tree-ssa/reassoc-19.c: Adjust. Index: gcc/testsuite/gcc.dg/tree-ssa/reassoc-19.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/reassoc-19.c (revision 194578) +++ gcc/testsuite/gcc.dg/tree-ssa/reassoc-19.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-Os -fdump-tree-reassoc2" } */ +/* { dg-options "-Os -fdump-tree-optimized" } */ /* Slightly changed testcase from PR middle-end/40815. */ void bar(char*, char*, int); @@ -8,14 +8,15 @@ void foo(char* left, char* rite, int ele while (left <= rite) { /* This should expand into - D.zzzz = D.zzzz - D.xxxx; - and NOT to - D.D.yyyy = -D.xxxx; D.zzzz = D.zzzz + D.yyyy; */ + _7 = (sizetype) element_6(D); + _8 = -_7; + rite_9 = rite_1 + _8; */ rite -= element; bar(left, rite, element); } } -/* There should be no " + " in the dump. */ -/* { dg-final { scan-tree-dump-times " \\\+ " 0 "reassoc2" } } */ -/* { dg-final { cleanup-tree-dump "reassoc2" } } */ +/* { dg-final { scan-tree-dump-times "= \\\(sizetype\\\) element" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "= -" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\\+ " 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */