[LLVMdev] loop vectorizer issue

Sara Elshobaky sara.elshobaky at gmail.com
Sun Nov 3 05:26:41 PST 2013


Hello,

I was trying to trace the Loop vectorizer of the LLVM, I wrote a simple loop
with a clear dependency. 

But found that the debug shows that 'we can vectorize this loop'

 

Here you are my  loop with dependency:

for(int k=20;k<50;k++)

     dataY[k] = dataY[k-1];

 

And the debug prints:

LV: Checking a loop in "main"

LV: Found a loop: for.body4

LV: Found an induction variable.

LV: Found a write-only loop!

LV: We can vectorize this loop!

...

LV: Vectorization is possible but not beneficial.

 

>From the LLVM IR, it contains only one 'store' instruction with '%.pre'.
Seems that no 'load' instruction prevented the Vectorizer to detect
dependency.

Is that a bug, or I'm missing something? Please advice

 

for.body4:                                        ; preds = %for.body4,
%for.cond2.preheader

  %k.030 = phi i32 [ 20, %for.cond2.preheader ], [ %inc8, %for.body4 ]

  %arrayidx6 = getelementptr inbounds i32* %0, i32 %k.030

  store i32 %.pre, i32* %arrayidx6, align 4, !tbaa !0

  %inc8 = add nsw i32 %k.030, 1

  %exitcond32 = icmp eq i32 %inc8, 50

  br i1 %exitcond32, label %for.cond10.preheader, label %for.body4

 

 

Thanks in advance,

Sara Elshobaky

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131103/23e2a4b6/attachment.html>


More information about the llvm-dev mailing list