IndVarSimplify: Don't let LFTR compare against a poison value
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 3 Sep 2014 23:03:18 +0000 (23:03 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 3 Sep 2014 23:03:18 +0000 (23:03 +0000)
commitc0f2b8b528d8a37b0a1522aae90af649d6357eb5
treef7fbf7a15853259c22220f8010eb2787ad13ddb5
parent699fd1909ee7c56c8cb08ef34746bc1c06d77eb9
IndVarSimplify: Don't let LFTR compare against a poison value

LinearFunctionTestReplace tries to use the *next* indvar to compare
against when possible.  However, it may be the case that the calculation
for the next indvar has NUW/NSW flags and that it may only be safely
used inside the loop.  Using it in a comparison to calculate the exit
condition could result in observing poison.

This fixes PR20680.

Differential Revision: http://reviews.llvm.org/D5174

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217102 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
test/Transforms/IndVarSimplify/lftr-address-space-pointers.ll
test/Transforms/IndVarSimplify/lftr-extend-const.ll
test/Transforms/IndVarSimplify/lftr-reuse.ll
test/Transforms/IndVarSimplify/pr20680.ll [new file with mode: 0644]