[LLVMbugs] [Bug 20568] New: failure to remove trivially dead loop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 6 14:17:43 PDT 2014


            Bug ID: 20568
           Summary: failure to remove trivially dead loop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


LLVM does not remove the loops in this code:

#include <stdio.h>
#include <time.h>

static int const N = 0x8000;

int main()
    clock_t const start = clock();
    for (int i = 0; i < N; ++i)
        int a[N];    // Never used outside of this block, but not optimized
        for (int j = 0; j < N; ++j)
            ++a[j];  // This is undefined behavior too, but Clang doesn't see
    clock_t const finish = clock();
    fprintf(stderr, "%u ms\n",
        static_cast<unsigned int>((finish - start) * 1000 / CLOCKS_PER_SEC));
    return 0;

(See also PR13050; this seems like a different problem, though.)

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/20140806/958ceb40/attachment.html>

More information about the llvm-bugs mailing list