Added a case to deinterleave that works when transposing fixed sized blo...

Added a case to deinterleave that works when transposing fixed sized blocks of data. In this case we can safely interleave if the collected stores have unit stride, and each store is simply a load with a stride equal to the vector width. Adding this case makes this optimization a little easier to trigger when doing a simple transpose.

The last test in test/correctness/interleave.cpp demonstrates this. Prior to this change trans1 would not trigger the call to interleave_vector, whereas it is probably the more likely code that people would want to write. This change essentially allows us to interleave blocks of stores of the form:
```
    trans1[ramp(0, 1, 8)] = square[ramp(0, 8, 8)]
    trans1[ramp(8, 1, 8)] = square[ramp(1, 8, 8)]
    trans1[ramp(16, 1, 8)] = square[ramp(2, 8, 8)]
    trans1[ramp(24, 1, 8)] = square[ramp(3, 8, 8)]
    trans1[ramp(32, 1, 8)] = square[ramp(4, 8, 8)]
    trans1[ramp(40, 1, 8)] = square[ramp(5, 8, 8)]
    trans1[ramp(48, 1, 8)] = square[ramp(6, 8, 8)]
    trans1[ramp(56, 1, 8)] = square[ramp(7, 8, 8)]
```
whereas before we were only interleaving:
```
    trans2[ramp(0, 8, 8)] = square[ramp(0, 1, 8)]
    trans2[ramp(1, 8, 8)] = square[ramp(8, 1, 8)]
    trans2[ramp(2, 8, 8)] = square[ramp(16, 1, 8)]
    trans2[ramp(3, 8, 8)] = square[ramp(24, 1, 8)]
    trans2[ramp(4, 8, 8)] = square[ramp(32, 1, 8)]
    trans2[ramp(5, 8, 8)] = square[ramp(40, 1, 8)]
    trans2[ramp(6, 8, 8)] = square[ramp(48, 1, 8)]
    trans2[ramp(7, 8, 8)] = square[ramp(56, 1, 8)]
```
Hmmm...I wonder if it has to do with different behavior between LLVM
versions then. I will do some local testing on my laptop to see if I can
reproduce this.

On Tue, Oct 28, 2014 at 9:57 AM, Dillon Sharlet <notifications@github.com>
wrote:

> In src/BlockFlattening.cpp:
>
> > +class BlockFlattener : public IRMutator {
> > +private:
> > +
> > +    using IRMutator::visit;
> > +
> > +    void visit(const Block *op) {
> > +        /* First we dig into the block traversing down the 'first'
> > +         * stmt until we find one that is not a block. We push all of
> > +         * the rest stmt's into the 'rest' stmt of the top-level
> > +         * block, and then fix up the 'rest' stmt recursively at the
> > +         * end. The result of this mutation is an equivalent Block
> > +         * node that does not contain any Block nodes in a 'first' stmt.
> > +         */
> > +        Stmt first = op->first;
> > +        Stmt rest  = op->rest;
> > +        while(const Block *first_block = op->first.as<Block>()) {
>
> Just on different runs (no build in between). But, it only appears to be
> happening on OSX. It seems fine on my other machines.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/halide/Halide/pull/510/files#r19485317>.
>