[LLVMbugs] [Bug 22629] New: Missed optimization: accessing a single-element array

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 18 14:15:49 PST 2015


            Bug ID: 22629
           Summary: Missed optimization: accessing a single-element array
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sami.liedes at iki.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider this code:

  int f(int x) {
    int a[] = {12};
    return a[x];

GCC knows to optimize this to

  movl     $12, %eax

The code generated by recent Clang at -O3 is:

  movslq   %edi, %rax
  movl     .L_ZZ1fiE1a(,%rax,4), %eax

  .long    12                      # 0xc

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/20150218/4e780cef/attachment.html>

More information about the llvm-bugs mailing list