[LLVMdev] First attempt at recognizing pointer reduction

Nadav Rotem nrotem at apple.com
Mon Oct 21 09:00:01 PDT 2013


Renato, 

This looks like the right direction.  Did you run it on the LLVM test suite to check if it finds new loops to vectorize ?

Thanks,
Nadav


On Oct 21, 2013, at 8:23 AM, Renato Golin <renato.golin at linaro.org> wrote:

> Hi Nadav, Arnold,
> 
> I managed to find some time to work on the pointer reduction, and I got a patch that can make "canVectorize()" pass.
> 
> Basically what I do is to teach AddReductionVar() about pointers, saying they don't really have an exit instructions, and that (maybe) the final store is a good candidate (is it?).
> 
> This makes it recognize the writes and reads, but then "canVectorizeMemory()" bails because it can't find the array bounds. This will be my next step, but I'd like to know if I'm in the right direction, with the right assumptions about the reduction detection, before proceeding into more complicated bits.
> 
> An example of the debug output I get for my earlier example:
> 
> LV: Checking a loop in "fn1"
> LV: Found a loop: for.body
> 
> == Induction ==
> 
> LV: Found an induction variable.
> 
> == Our write reduction ==
> 
> LV: Found a pointer add reduction PHI.  %WRITE913 = phi i8* [ %incdec.ptr18, %for.body ], [ %WRITE, %for.body.preheader ]
> 
> == Not sure what this is... Will check. ==
> 
> LV: Found an non-int non-pointer PHI.
> 
> == Our read reduction ==
> 
> LV: Found a pointer add reduction PHI.  %READ1012 = phi i8* [ %incdec.ptr2, %for.body ], [ %READ, %for.body.preheader ]
> 
> == Below are the memory operations's validation, which I'll deal with later ==
> 
> LV: Found an unidentified write ptr: i8* %WRITE
> LV: Found an unidentified write ptr: i8* %WRITE
> LV: Found an unidentified write ptr: i8* %WRITE
> LV: Found an unidentified read ptr: i8* %READ
> LV: Found an unidentified read ptr: i8* %READ
> LV: Found an unidentified read ptr: i8* %READ
> LV: Found a runtime check ptr:  %WRITE913 = phi i8* [ %incdec.ptr18, %for.body ], [ %WRITE, %for.body.preheader ]
> LV: Found a runtime check ptr:  %incdec.ptr16 = getelementptr inbounds i8* %WRITE913, i64 1
> LV: Found a runtime check ptr:  %incdec.ptr17 = getelementptr inbounds i8* %WRITE913, i64 2
> LV: Found a runtime check ptr:  %READ1012 = phi i8* [ %incdec.ptr2, %for.body ], [ %READ, %for.body.preheader ]
> LV: Found a runtime check ptr:  %incdec.ptr = getelementptr inbounds i8* %READ1012, i64 1
> LV: Found a runtime check ptr:  %incdec.ptr1 = getelementptr inbounds i8* %READ1012, i64 2
> LV: We need to do 18 pointer comparisons.
> LV: We can't vectorize because we can't find the array bounds.
> 
> cheers,
> --renato
> <pointer-reduction.patch>




More information about the llvm-dev mailing list