LoopVectorizer: Truncate i64 trip counts of i32 phis if necessary
authorArnold Schwaighofer <aschwaighofer@apple.com>
Tue, 26 Nov 2013 22:11:23 +0000 (22:11 +0000)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Tue, 26 Nov 2013 22:11:23 +0000 (22:11 +0000)
commitb40f14eb89202930dad0acd51b75373bc609bc29
treee5978125852822a959adc7814bf5f6d6904b6fae
parent2bd48f03ba8d60ce91e91a88d75c4336e3cf5b04
LoopVectorizer: Truncate i64 trip counts of i32 phis if necessary

In signed arithmetic we could end up with an i64 trip count for an i32 phi.
Because it is signed arithmetic we know that this is only defined if the i32
does not wrap. It is therefore safe to truncate the i64 trip count to a i32
value.

Fixes PR18049.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195787 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/X86/tripcount.ll [new file with mode: 0644]