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

Tobias Grosser tobias at grosser.es
Wed Oct 1 03:26:46 PDT 2014


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.

================
Comment at: lib/Analysis/ScopInfo.cpp:1214
@@ -1203,1 +1213,3 @@
 
+  for (unsigned u = 0; u < AliasGroups.size(); u++) {
+    AliasGroupTy NewAG;
----------------
Maybe add a comment (or extract this loop into its own function)

================
Comment at: test/ScopInfo/aliasing_conditional_alias_groups_1.ll:4
@@ +3,3 @@
+; Check that there is no alias group because we either access A or B never both.
+;
+; CHECK: Alias Groups (0):
----------------
Nice.

================
Comment at: test/ScopInfo/aliasing_conditional_alias_groups_2.ll:6
@@ +5,3 @@
+;
+; CHECK: Alias Groups (2):
+;
----------------
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).

http://reviews.llvm.org/D5436






More information about the llvm-commits mailing list