This is an archive of the discontinued LLVM Phabricator instance.

[Polly][RTC] Use the domain to split alias groups.
ClosedPublic

Authored by jdoerfert on Sep 22 2014, 4:53 AM.

Details

Summary
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.

Diff Detail

Repository
rL LLVM

Event Timeline

jdoerfert updated this revision to Diff 13926.Sep 22 2014, 4:53 AM
jdoerfert retitled this revision from to [Polly][RTC] Use the domain to split alias groups..
jdoerfert edited the test plan for this revision. (Show Details)
jdoerfert added a reviewer: grosser.
jdoerfert updated this object.
jdoerfert added subscribers: Restricted Project, Unknown Object (MLST).
sebpop added a subscriber: sebpop.Sep 22 2014, 12:01 PM

LGTM.

lib/Analysis/ScopInfo.cpp
1176 ↗(On Diff #13926)

s/devide/divide/

1182 ↗(On Diff #13926)

s/more then/more than/

test/ScopInfo/aliasing_conditional_alias_groups_2.ll
4 ↗(On Diff #13926)

s/depeend/depend/

grosser accepted this revision.Oct 1 2014, 3:26 AM
grosser edited edge metadata.

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 ↗(On Diff #13926)

Maybe add a comment (or extract this loop into its own function)

test/ScopInfo/aliasing_conditional_alias_groups_1.ll
4 ↗(On Diff #13926)

Nice.

test/ScopInfo/aliasing_conditional_alias_groups_2.ll
6 ↗(On Diff #13926)

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).

This revision is now accepted and ready to land.Oct 1 2014, 3:26 AM
jdoerfert added inline comments.Oct 1 2014, 5:50 AM
test/ScopInfo/aliasing_conditional_alias_groups_2.ll
6 ↗(On Diff #13926)

But it's more precise ;)

Just look at the alias groups we generate, two small precise ones instead of one overaproximated one :)

jdoerfert closed this revision.Oct 1 2014, 5:52 AM
jdoerfert updated this revision to Diff 14278.

Closed by commit rL218758 (authored by @jdoerfert).