[PATCH] D38494: [ScalarEvolution] Handling for ICmp occuring in the evolution chain.
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 19:32:39 PDT 2017
hfinkel added a comment.
In https://reviews.llvm.org/D38494#887842, @junryoungju wrote:
> can you explain me why? (I may I didn't understood why do we need to process without loop latch)
> I thought without latch cannot be evoluted from ICmp evolution.
>
> without latch loop have to me evoluted from previous SCEV operation. isn't it?
I don't understand your statement.
The point is that, in the last loop iteration, latch condition is not true, so replacing it with true is incorrect. If you have:
int values[11];
int i = 0;
do {
values[i] = i != 10;
} while (i++ != 10);
After the loop, values should be { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }. In the 11th iteration, the comparison will be false. With this patch, we'd store 1 into the values array, even for the last iteration.
https://reviews.llvm.org/D38494
More information about the llvm-commits
mailing list