This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tcb] Merge PHI nodes -- 7.4% reduction of PHI nodes (Take 2)
On Mon, 2004-09-20 at 17:10, Kazu Hirata wrote:
> Hi Jeff,
>
> > BB3:
> > x1 = PHI (0 (BB0), 1 (BB1))
> >
> > BB4:
> > x2 = PHI (x1 (BB3), x0 (BB2))
> > if (x2 == 0)
> > goto BB5;
> > else
> > goto BB6;
>
> Thanks for detailed explanation. By the way, I'd like to point out
> that I often see a variant of your example like so:
>
> BB3:
> x1 = PHI (0 (BB0), 1 (BB1))
> x2 = (_Bool) x1; <- Notice this cast!
>
> BB4:
> x2 = PHI (x1 (BB3), x0 (BB2))
> if (x2)
> goto BB5;
> else
> goto BB6;
>
> Notice that my PHI merge pass cannot get at this king as the two PHI
> nodes are separated by a cast to _Bool, meaning that we miss a jump
> threading opportunities.
Yes. That's the kind of thing I'd like to fix with a tree combiner
pass. It's not a 100% perfect fit, but it's pretty close. That's
the primary reason why I haven't dove into your pass to kill those
casts.
jeff