[llvm-bugs] [Bug 27395] New: Missing loop canonicalization when iterating using a pointer or an integer index
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 17 22:44:15 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27395
Bug ID: 27395
Summary: Missing loop canonicalization when iterating using a
pointer or an integer index
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: mehdi.amini at apple.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Considering this simple example:
int data[8000];
int init_value;
void foo() {
auto *start = data;
while (start++ != data+8000)
*start = init_value;
}
void bar() {
for (int i = 0; i < 8000; i++)
data[i] = init_value;
}
foo() and bar() are performing the same initialization of array `data`, however
foo() is iterating using a sliding pointer while bar() is using an integer
index.
I would expect us to canonicalize the iterator one way or the other.
Right now, we can only vectorize the second form. It seems to be because the
first form iterates using a pointer, it compares to the end of the array using:
%4 = icmp ne i32* %2, getelementptr inbounds (i32* getelementptr inbounds
([8000 x i32]* @data, i32 0, i32 0), i64 8000)
This GEP prevents global alias analysis from doing anything interesting with
data (i. (Here it seems that "data" is not detected to not alias with
`init_value`...), see GlobalsAAResult::AnalyzeUsesOfPointer().
--
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/20160418/6c8ff498/attachment.html>
More information about the llvm-bugs
mailing list