From c6ab01eccae05aee4bae81a875a6eb88907247c5 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 3 Sep 2014 23:03:18 +0000 Subject: 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 llvm-svn: 217102 --- llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll') diff --git a/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll b/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll index 4736f857bcc..eeffd0f5502 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll @@ -2,7 +2,7 @@ ; CHECK-LABEL: @foo( ; CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16 -; CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512 +; CHECK: %exitcond = icmp ne i32 %indvars.iv, 511 define void @foo() #0 { entry: br label %for.body @@ -21,7 +21,7 @@ for.end: ; preds = %for.body ; Check that post-incrementing the backedge taken count does not overflow. ; CHECK-LABEL: @postinc( -; CHECK: icmp eq i32 %indvars.iv.next, 256 +; CHECK: icmp eq i32 %indvars.iv, 255 define i32 @postinc() #0 { entry: br label %do.body -- cgit v1.2.3