http://llvm.org/bugs/show_bug.cgi?id=18849
Bug ID: 18849
Summary: Store overwritten in next loop iteration is not
eliminated
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs