patch: make instcombine remove shuffles by reordering vector elements

Hal Finkel hfinkel at anl.gov
Sun May 5 20:36:56 PDT 2013


----- Original Message -----
> From: "Nadav Rotem" <nrotem at apple.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Owen Anderson" <resistor at mac.com>, llvm-commits at cs.uiuc.edu
> Sent: Sunday, May 5, 2013 10:11:36 PM
> Subject: Re: patch: make instcombine remove shuffles by reordering vector elements
> 
> 
> 
> 
> On May 5, 2013, at 7:50 PM, Hal Finkel < hfinkel at anl.gov > wrote:
> 
> 
> Alternatively, we could use TTI so that only inexpensive shuffles are
> formed by these optimizations.
> 
> 
> We can't estimate which shuffles are inexpensive. We have 1000 lines
> of c++ logic to figure this out during the x86 lowering. 

But all of that code is trying to solve a decomposition problem, and I doubt that is necessary here. We would only want to form shuffles that we knew would be profitable, and that probably means single-instruction shuffles. The logic for that is easy, no?

> The second
> problem is that InstCombine is a canonicalization pass and not a
> lowering pass. Only lowering passes should use TTI.

Fair enough.

> If we had a
> target independent way of estimating the cost of shuffles then
> DAGCombine would be the right place.

Except that it is basic-block local :( -- and so it is not the right place, it should really be done earlier. Maybe this will need to wait until our SDAG replacement arrives (so long as we have a good CSE pass afterward).

 -Hal

> 
> 
> Thanks,
> Nadav



More information about the llvm-commits mailing list