This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix two bugs in gimple-fold.c and/or folding (PR tree-optimization/46909)
On Tue, Dec 28, 2010 at 04:03:28PM -0500, Paul Koning wrote:
>
> On Dec 28, 2010, at 3:41 PM, Richard Guenther wrote:
>
> > On Tue, Dec 28, 2010 at 8:27 PM, Paul Koning <paul_koning@dell.com> wrote:
> >> I ran into an oddity with one of the testcases.
> >>
> >> The one that scans the tree dump (gcc.dg/pr46909.c) fails for pdp11 because the tree dump file says it's checking for != 6 (which should be != 4). But the generated code is correct.
> >>
> >> Also curious is that the tree dump looks very different from the tree dump generated by the same rev compiler (give or take a few hours) on linux-x86. Any idea what's going on here?
> >
> > dependent on BRANCH_COST &&s and ||s will be lowered to control flow
> > or and/ors. You don't provide source to make the point about the
> > !=6 vs !=4 issue.
>
> The program being compiled is gcc/testsuite/gcc.dg/pr46909.c. BRANCH_COST is constant 0 on the pdp11 target.
If ifcombine optimizes the testcase into != 6 instead of != 4, then
you are looking at what was happening before the fix.
--- pr46909.c.070t.ifcombine 2010-12-28 22:06:31.000000000 +0100
+++ pr46909.c.070t.ifcombine 2010-12-28 22:06:40.000000000 +0100
@@ -1,7 +1,7 @@
;; Function foo (foo)
-optimizing two comparisons to x_2(D) != 6
+optimizing two comparisons to x_2(D) != 4
Merging blocks 2 and 3
foo (unsigned int x)
{
@@ -20,7 +20,7 @@ foo (unsigned int x)
D.2691_6 = x_2(D) == 2;
D.2692_7 = x_2(D) == 6;
D.2693_8 = D.2691_6 | D.2692_7;
- if (x_2(D) != 6)
+ if (x_2(D) != 4)
goto <bb 4>;
else
goto <bb 3>;
is the difference from the broken compiler to correct one.
Jakub