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

            Bug ID: 34775
           Summary: Different unrolling behavior with manual hoisting
           Product: tools
           Version: 5.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: opt
          Assignee: unassignedb...@nondot.org
          Reporter: piotr.padlew...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Hey,
I am not sure if this is a bug or it is by design, but I recently found out
that
clang unrolls these two loops in different way:

#include <vector>

void bar(std::vector<int> &v, int* p) {
  auto size = v.size();
  for (int i = 0 ; i < size; i++)
    p[i] = v[i];
}

void bar2(std::vector<int> &v, int* p) {
  for (int i = 0 ; i < v.size(); i++)
    p[i] = v[i];
}

https://godbolt.org/g/U1kH8P

I would probably guess that LICM hoists the size after the unrolling, but I
haven't checked that and also have no idea which one is faster. It is just
weird to me that we were able to hoist v.size() in the bar2, but did not
perform the same unrolling.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to