[LLVMdev] LLVM Loop Vectorizer puzzle
maxs
xtxwy.ustc at gmail.com
Wed May 22 20:23:49 PDT 2013
Hi,
I have the llvm loop vectorizer to complie the following sample:
//=================
int test(int *a, int n) {
for(int i = 0; i < n; i++) {
a[i] += i;
}
return 0;
}
//================
The corresponded .ll file has a loop preheader:
//================
for.body.lr.ph: ; preds = %entry
%cnt.cast = zext i32 %n to i64
%0 = and i32 %n, 7
%n.mod.vf = zext i32 %0 to i64
%n.vec = sub i64 %cnt.cast, %n.mod.vf
%cmp.zero = icmp eq i32 %0, %n
br i1 %cmp.zero, label %middle.block, label %vector.body
//================
That is , if n <=7, the program will skip the vector.body. In
LoopVectorize.cpp , I see the following code:
//================
static cl::opt<unsigned>
TinyTripCountVectorThreshold("vectorizer-min-trip-count", cl::init(16),
... );
//================
The minimal loop count is 16. What is the "n<=7" meaning? Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130523/24091e31/attachment.html>
More information about the llvm-dev
mailing list