[llvm-bugs] [Bug 26167] New: Loop vectorizer fails to maximize the use of __builtin_assume()

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 15 16:12:24 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26167

            Bug ID: 26167
           Summary: Loop vectorizer fails to maximize the use of
                    __builtin_assume()
           Product: tools
           Version: 3.7
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: marksl at synopsys.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I've been able to get the loop vectorizer to understand that the number of
iterations is positive, but I can't get it to understand it's both positive and
will iterate an even number of times. A scalar loop is produced for each of the
following test cases.

void vcpy1(short* restrict d, const char* restrict l, const char* restrict r,
int N) {
  __builtin_assume( (N > 1) && (N%2 == 0) );
#pragma clang loop vectorize(enable) vectorize_width(2)
  for (int j=0;j<N;j++)
    d[j] = l[j] + r[j];
}
void vcpy2(short* restrict d, const char* restrict l, const char* restrict r,
int N) {
  __builtin_assume( (N > 1) && ((N&1) == 0) );
#pragma clang loop vectorize(enable) vectorize_width(2)
  for (int j=0;j<N;j++)
    d[j] = l[j] + r[j];
}
void vcpy3(short* restrict d, const char* restrict l, const char* restrict r,
int N) {
  __builtin_assume(N > 1);
  __builtin_assume(N%2 == 0);
#pragma clang loop vectorize(enable) vectorize_width(2)
  for (int j=0;j<N;j++)
    d[j] = l[j] + r[j];
}
void vcpy4(short* restrict d, const char* restrict l, const char* restrict r,
int N) {
  __builtin_assume(N > 1);
  __builtin_assume((N&1) == 0);
#pragma clang loop vectorize(enable) vectorize_width(2)
  for (int j=0;j<N;j++)
    d[j] = l[j] + r[j];
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160116/4f69cb62/attachment.html>


More information about the llvm-bugs mailing list