LoopVectorizer: Add a check that the backedge taken count + 1 does not overflow
authorArnold Schwaighofer <aschwaighofer@apple.com>
Thu, 29 May 2014 22:10:01 +0000 (22:10 +0000)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Thu, 29 May 2014 22:10:01 +0000 (22:10 +0000)
commit06413cd0f0aafb56b86ec8f7ab44328ca49f1aeb
tree1fd307d679f0f3449fa6a0ad242623843f4cc763
parentade072c1a9cbd06e99862dff90c72af0b1f2edbe
LoopVectorizer: Add a check that the backedge taken count + 1 does not overflow

The loop vectorizer instantiates be-taken-count + 1 as the loop iteration count.
If this expression overflows the generated code was invalid.

In case of overflow the code now jumps to the scalar loop.

Fixes PR17288.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209854 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/induction.ll
test/Transforms/LoopVectorize/runtime-check-readonly.ll