[llvm-bugs] [Bug 34188] New: std::map operator< stack frame size consumption

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 14 15:20:50 PDT 2017


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

            Bug ID: 34188
           Summary: std::map operator< stack frame size consumption
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

This could be either expected, or be a libcxx implementation defect, or clang
missing optimization, or any combination of those.

Reduced testcase:

#include <map>
#include <memory>
#include <string>
struct a;
struct b
{
  std::string c;
  std::string f;
  std::string d;
  int operator<(b e) const
  {
    return tie(c, f, d) < tie(c, f, e.d);
  }
};
struct j
{
  std::map<b, std::unique_ptr<a> > cameras;
  const a *g(const std::string &, const std::string &, const std::string &)
const;
};
using std::string;
inline b h(string, string, string)
{
  b i;
  return i;
}
const a *j::g(const string &c, const string &f, const string &d) const
{
  auto camera = cameras.find(h(0, 0, 0));
  return camera->second.get();
}


Compilation flags: -std=c++14 -c -Wframe-larger-than=0 cxx.cpp
Here is a comparison of stack frame size usage in function 'b::operator<':

/ --------------------------\
|======| libcxx | libstdc++ |
| -O3  |  n/a   |    n/a    |
| -O2  |  n/a   |    n/a    |
| -O1  |  72b   |    88b    |
| -O0  |  4840b |    88b    |
| noop |  4840b |    88b    |
\---------------------------/

The measurements were made with clang tip, libcxx tip (compiled in release
build mode, no sanitizations)

-- 
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/20170814/aaae3d04/attachment.html>


More information about the llvm-bugs mailing list