[LoopDelete] The useless code in the loop should have been removed, but it wasn't
Test Case:
int test()
{
long I;
long A[320] = {1};
long B[320] = {2};
long N7 = 320;
for (I = 0; I < N7; I++)
{
A[I] = A[I] + B[I];
B[I] = A[I] - B[I];
}
return 0;
The above code is actually useless code in the loop and should be deleted. It has not been deleted yet.
@fhahn
@LiqinWeng Is there any particular reason you closed this issue? LLVM should be able to remove the loop, but doesn't at the moment, unless the loop is unrolled: https://clang.godbolt.org/z/zhar8fYEh
The underlying reason is that memory optimizations (in particular DeadStoreElimination) aren't really aware of loops.
The underlying reason is that memory optimizations (in particular DeadStoreElimination) aren't really aware of loops.
Sorry, I accidentally closed the issue. I can try to solve this problem on DeadStoreElimination
For reference, here are some related issues: #56291, #45803, #45805