[llvm-bugs] [Bug 37927] New: [GlobalMerge] GlobalMerge pass hurts the performance when merging global arrays

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 25 09:10:44 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37927

            Bug ID: 37927
           Summary: [GlobalMerge] GlobalMerge pass hurts the performance
                    when merging global arrays
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: haicheng at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180625/46a5ea87/attachment.html>


More information about the llvm-bugs mailing list