[PATCH] [LAA] Merge memchecks for accesses separated by a constant offset

Adam Nemet anemet at apple.com
Mon Jun 29 17:21:56 PDT 2015


LGTM, thank you!


================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:247-252
@@ +246,8 @@
+
+      if (!Merged) {
+        // We couldn't add this pointer to any existing set or the threshold
+        // for the number of comparisons has been reached. Create a new group
+        // to hold the current pointer.
+        Groups.push_back(CheckingPtrGroup(Pointer, *this));
+      }
+    }
----------------
No {}

================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:292-295
@@ +291,6 @@
+
+  unsigned NumGroups = CheckingGroups.size();
+  if (NumGroups == 0)
+    return;
+
+  for (unsigned I = 0; I < NumGroups; ++I)
----------------
I would drop this.  Also moving the def of  N right before the loop would be a good thing.

================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:552-553
@@ -389,1 +551,4 @@
 
+  if (NeedRTCheck && CanDoRT)
+    RtCheck.groupChecks(DepCands);
+
----------------
For the record, this is not where want to call this in the long run but I am OK with this for now.

DepCands is not exposed right now but moving forward we want to initiate the grouping from the client so that things like PtrPartitions could be passed in.

I have some plans for how to do this so this will change anyway pretty soon.

================
Comment at: test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll:76-89
@@ +75,16 @@
+
+; 3 reads and 2 writes - two of the reads can be merged,
+; and the writes can be merged as well. This gives us a
+; total of 2 memory checks.
+
+; CHECK: function 'testg':
+
+; CHECK: Run-time memory checks:
+; CHECK-NEXT: Check 0:
+; CHECK: Check 1:
+; CHECK-NOT: Check 2:
+; CHECK: Group 0:
+; CHECK: Group 1:
+; CHECK: Group 2:
+; CHECK-NOT: Group 3:
+
----------------
I'd have a slight preference to fully match these lines rather than the number of checks/groups.

http://reviews.llvm.org/D10386

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list