[llvm-bugs] [Bug 39643] New: unable to optimize creation and use of a lookup table into the table entry

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 12 18:13:49 PST 2018


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

            Bug ID: 39643
           Summary: unable to optimize creation and use of a lookup table
                    into the table entry
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org

Testcase:

#include <array>
static std::array<int, 1000> f() {
  std::array<int, 1000> a = {};
  for (int n = 0; n != 1000; ++n) a[n] = n*n*n;
  return a;
}
int cube(int n) { return f()[n]; }

We should be able to optimize that to:

int cube(int n) { return n*n*n; }

-- 
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/20181113/c1affa17/attachment.html>


More information about the llvm-bugs mailing list