[LLVMbugs] [Bug 13067] New: Sema::computeNRVO is not very smart

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 9 20:21:34 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13067

             Bug #: 13067
           Summary: Sema::computeNRVO is not very smart
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The algorithm which Clang uses to determine which variables are NRVO candidates
is not very smart. We do not use NRVO in this case:

S f(bool b) {
  if (b) {
    S s1;
    return s1;
  } else {
    S s2;
    return s2;
  }
}

Nor (for either return) in this case:

S g(bool b) {
  S s1;
  if (b)
    return s1;
  S s2;
  return s2;
}

A simple greedy algorithm would be much better than our current approach.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list