[LoopIdiom] BCmp: loop exit count must not be wider than size_t that `bcmp` takes
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 14 Oct 2019 19:46:34 +0000 (19:46 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 14 Oct 2019 19:46:34 +0000 (19:46 +0000)
commit76e02af70487ba194db42e3720d1975c317a0629
tree9dddff2bd4573d7d5b726653145a6fffe04ce808
parentb9c55e2760b1be461f05a10ca92696b3381036d2
[LoopIdiom] BCmp: loop exit count must not be wider than size_t that `bcmp` takes

As reported by Joerg Sonnenberger in IRC, for 32-bit systems,
where pointer and size_t are 32-bit, if you use 64-bit-wide variable
in the loop, you could end up with loop exit count being of the type
wider than the size_t. Now, i'm not sure if we can produce `bcmp`
from that (just truncate?), but we certainly should not assert/miscompile.

llvm-svn: 374811
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/test/Transforms/LoopIdiom/bcmp-basic.ll