[LoopIdiom] Fix store size SCEV type.
authorClement Courbet <courbet@google.com>
Thu, 7 Oct 2021 15:29:02 +0000 (17:29 +0200)
committerClement Courbet <courbet@google.com>
Mon, 11 Oct 2021 07:39:06 +0000 (09:39 +0200)
commit6aaf1e7ea931a1865cc97ebf8fcb084772f8142e
tree869fc9cb6aedc565b9ed85a4960763b0aaad1c05
parent50a08e2c6d4185df6a5b0a5b41c7ef8849aad269
[LoopIdiom] Fix store size SCEV type.

We were using the type of the loop back edge count to represent the
store size. This failed for small loop counts (e.g. in the added test,
the loop count was an i2).

Use the index type instead.

Fixes PR52104.

Differential Revision: https://reviews.llvm.org/D111401
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/test/Transforms/LoopIdiom/memset-pr52104.ll [new file with mode: 0644]