We use a parametric abstraction of the domain to split alias groups if accesses cannot be executed under the same parameter evaluation. The two test cases check that we can remove alias groups if the pointers which might alias are never accessed under the same parameter evaluation and that the minimal/maximal accesses are not global but with regards to the parameter evaluation.
Details
Diff Detail
Event Timeline
The patch looks technical OK to me.
Avoid alias checks all together seems clearly beneficial to me. It is not as clear if splitting alias groups for cases like the one below is worth the additional complexity or if there may even be cases where it further complicates the generated code. On the other side, as the code is self contained and can easily be moved into a sub-function we can probably see this in the future.
lib/Analysis/ScopInfo.cpp | ||
---|---|---|
1214 | Maybe add a comment (or extract this loop into its own function) | |
test/ScopInfo/aliasing_conditional_alias_groups_1.ll | ||
4 | Nice. | |
test/ScopInfo/aliasing_conditional_alias_groups_2.ll | ||
6 | Before this change we got: %tmp38 = icmp ne i32 %b, 0 %tmp39 = select i1 %tmp38, i64 6, i64 1024 %polly.access.B = getelementptr i32* %B, i64 %tmp39 %tmp40 = select i1 %tmp38, i64 0, i64 7 %polly.access.A = getelementptr i32* %A, i64 %tmp40 %tmp41 = icmp ule i32* %polly.access.B, %polly.access.A %tmp42 = select i1 %tmp38, i64 1024, i64 8 %polly.access.A1 = getelementptr i32* %A, i64 %tmp42 %tmp43 = select i1 %tmp38, i64 5, i64 0 %polly.access.B2 = getelementptr i32* %B, i64 %tmp43 %tmp44 = icmp ule i32* %polly.access.A1, %polly.access.B2 %tmp45 = or i1 %tmp41, %tmp44 12 instructions after this change we got: %polly.access.A = getelementptr i32* %A, i64 8 %tmp42 = icmp ule i32* %polly.access.A, %B %polly.access.B1 = getelementptr i32* %B, i64 1024 %polly.access.A2 = getelementptr i32* %A, i64 7 %tmp43 = icmp ule i32* %polly.access.B1, %polly.access.A2 %tmp44 = or i1 %tmp42, %tmp43 %polly.access.A3 = getelementptr i32* %A, i64 1024 %polly.access.B4 = getelementptr i32* %B, i64 5 %tmp45 = icmp ule i32* %polly.access.A3, %polly.access.B4 %polly.access.B5 = getelementptr i32* %B, i64 6 %tmp46 = icmp ule i32* %polly.access.B5, %A %tmp47 = or i1 %tmp45, %tmp46 %tmp48 = and i1 %tmp44, %tmp47 13 instructions This does not seem to be a clear improvement (in this case rather a small regression at least in terms of instruction count). |
test/ScopInfo/aliasing_conditional_alias_groups_2.ll | ||
---|---|---|
6 | But it's more precise ;) Just look at the alias groups we generate, two small precise ones instead of one overaproximated one :) |
s/devide/divide/