[LLVMbugs] [Bug 18849] New: Store overwritten in next loop iteration is not eliminated

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 15 05:37:08 PST 2014


            Bug ID: 18849
           Summary: Store overwritten in next loop iteration is not
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: tobias at grosser.es
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12065
  --> http://llvm.org/bugs/attachment.cgi?id=12065&action=edit
The LLVM-IR file to reproduce this bug

This loop contains a store that is overwritten right in the next loop iteration
and the store in the last loop iteration is overwritten right after the loop.
So the store is fully redundant.

void f(float *restrict A, float *restrict B, long N) {
  B[0] = A[0];
  for (long i = 1; i < N - 1; i += 1) {
    B[i - 1] += A[i]; 
    B[i] = A[i]; << This store is unneccessary
  B[N - 2] += A[N - 1];

I would expect LLVM to eliminate this store.

The attached test case was slightly modified by removing the unnecessary reload
of 'B[N - 2] +=' to ensure that this load is not potentially obfuscating
the store right after the load.

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/20140215/63a3c7f0/attachment.html>

More information about the llvm-bugs mailing list