<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GlobalMerge] GlobalMerge pass hurts the performance when merging global arrays"
   href="https://bugs.llvm.org/show_bug.cgi?id=37927">37927</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GlobalMerge] GlobalMerge pass hurts the performance when merging global arrays
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>haicheng@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Disabling GlobalMerge pass can improve 2/3 of spec20xx benchmarks and only 2
benchmarks have large regression.  I looked into it and I believe the cause is
merging global arrays with other globals.

The motivation examples of this pass is merging global arrays using the same
index like below:

static int foo[N], bar[N], baz[N];

for (i = 0; i < N; ++i)
  foo[i] = bar[i] * baz[i];

The same base registers can be reused among three memory accesses.  However, if
the array accesses use different indices like this:

  foo[i] = bar[j] * baz[k];

We need to use reg+reg+imm to access which cannot be folded into the addressing
mode of AArch64 or ARM.

I did a simple experiment by skipping all global arrays during the global
collecting phase and 3/4 benchmarks of spec20xx got improved and the
regressions are all noise.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>