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: unassignedb...@nondot.org
          Reporter: richard-l...@metafoo.co.uk
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to