[llvm-bugs] [Bug 25776] New: llvm missing opportunities to overlap non-interfering local variables

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 8 09:16:50 PST 2015


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

            Bug ID: 25776
           Summary: llvm missing opportunities to overlap non-interfering
                    local variables
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: thanm at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15416
  --> https://llvm.org/bugs/attachment.cgi?id=15416&action=edit
stack-ifthen.cc

When I compile the attached testcase "stack-ifthen.cc" with "clang++ -g -O"
using LLVM trunk (linux x86-64), I observe that the size of the stack frame is
larger than it needs to be (~1024 bytes).

Compiling with "g++-4.8 -g -O" yields a stack frame size of ~512 bytes; gcc is
able to recognize that the two local arrays can share the same stack space.
Clang/llvm creates a separate stack allocation for each array, resulting in a
larger stack frame size.

Interestingly, gcc/g++ appears to overlap the two arrays even when compiling
with -O0, which leads me to assume the layout is being done in the front end as
opposed to in the back end.

-- 
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/20151208/4d89575e/attachment.html>


More information about the llvm-bugs mailing list