On 10/12/2016 02:48 AM, Richard Biener wrote:
On Tue, Oct 11, 2016 at 11:34 PM, Marc Glisse <marc.gli...@inria.fr> wrote:
On Tue, 11 Oct 2016, Bin Cheng wrote:

We missed folding (convert)(X op const) -> (convert)X op (convert)const
for unsigned narrowing because of reason reported at
This patch fixes the issue by adding new match&simplify pattern, it also
adds a test case.  This is the prerequisite patch for next patch adding new
vectorization pattern.

Some technical comments below. I am sure Jeff and/or Richi will have more to
say on the approach. I am a bit surprised to see it as adding a new
transformation, instead of moving an old one.

The "old one" would be c-family/c-common.c:shorten_binary_op.  It's generally
prefered to move stuff, preserving semantics.
Right. Kai and I hadn't looked much at shorten_binary_op (focusing more on shorten_compare). But the same principles apply to both.

Namely that the existing routines should be twiddled to handle warnings only, but not modify the underlying IL. IL modifications (canonicalization and optimization) should be moved into the match.pd framework.

When Kai left Red Hat, that work stalled. I've got bits and pieces of that work lying around, but I don't think they'd help Bin's work right now.

There is also already a bunch of similar match.pd patterns here:
[ ... ]
Right. Those were a first start at handling some of the desired narrowing, focused primarily on BZs that required narrowing to resolve. Like Kai's work, I have some generalizations and improvements in a half-completed state here, but haven't had time to work on them.


Reply via email to