[llvm-bugs] [Bug 35143] New: Failure to delete dead store

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 30 18:50:12 PDT 2017


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

            Bug ID: 35143
           Summary: Failure to delete dead store
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: chisophugis at gmail.com
                CC: llvm-bugs at lists.llvm.org

struct S {
  int x[5];
};

S get_S();

void foo() {
  S s = get_S();
  s.x[5] = 8;
}


https://godbolt.org/g/QcpRBY

Clang does not delete the store to `s.x[5] = 8`.


Looking at the IR, the pointer out argument passed to get_S seems to be marked
as `sret`. I don't know if that is strong enough to allow inferring `noescape`
on the pointer, but even manually adding `noescape` I don't see that store
being deleted by the O2 pipeline.

-- 
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/20171031/1dad0be5/attachment-0001.html>


More information about the llvm-bugs mailing list