[ScalarEvolution] Infer loop max trip count from array accesses
authorLiren Peng <pengliren@linux.alibaba.com>
Wed, 3 Nov 2021 02:40:18 +0000 (10:40 +0800)
committerLiren Peng <pengliren@linux.alibaba.com>
Wed, 3 Nov 2021 02:40:18 +0000 (10:40 +0800)
commit57e093162e27334730d8ed8f7b25b1b6f65ec8c8
tree7d48b2733d9fed3541e4e81560c72ebda9fe8f0f
parent8f101971b6d54e2fc470e853e413fd01cfff20b5
[ScalarEvolution] Infer loop max trip count from array accesses

Data references in a loop should not access elements over the
statically allocated size. So we can infer a loop max trip count
from this undefined behavior.

Reviewed By: reames, mkazantsev, nikic

Differential Revision: https://reviews.llvm.org/D109821
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/unittests/Analysis/ScalarEvolutionTest.cpp