[PATCH] Choose the best consecutive candidate for a store instruction in SLP vectorizer

Nadav Rotem nrotem at apple.com
Mon Jun 15 09:10:08 PDT 2015


Wei, 

Thanks for working on this.  Did you run the llvm test suite? Are there any performance wins or compile time regressions? 

I have a few comments below:

-    for (unsigned j = 0; j < e; ++j) {
-      if (i == j)
-        continue;
-      const DataLayout &DL = Stores[i]->getModule()->getDataLayout();
+    const DataLayout &DL = Stores[i]->getModule()->getDataLayout();

Please initialize ‘j' when you declare it. Also, why unsigned? 

+    unsigned j;
+    // If a store has multiple consectutive store candidates, choose
+    // the immediate succeeding or preceding one.
+    for (j = i + 1; j < e; ++j) {
+      if (R.isConsecutiveAccess(Stores[i], Stores[j], DL)) {
+        Tails.insert(Stores[j]);
+        Heads.insert(Stores[i]);
+        ConsecutiveChain[Stores[i]] = Stores[j];
+        break;
+      }
+    }

Please document this line, or simplify it. 

+    if (j < e)
+      continue;

At this point you are defining a new J variable, with a different type. This is confusing. 

+    for (int j = i - 1; j >= 0; --j) {


Can you think of a way to write this code without code duplication?

Thanks,
Nadav



> On Jun 15, 2015, at 9:00 AM, Wei Mi <wmi at google.com> wrote:
> 
> <D10445.27678.patch>





More information about the llvm-commits mailing list