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: [email protected]
Reporter: [email protected]
CC: [email protected]
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs