diff --git a/llvm/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll b/llvm/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll index faecbfbe07ab..de5e30473a6c 100644 --- a/llvm/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll +++ b/llvm/test/Transforms/IndVarSimplify/2012-07-17-lftr-undef.ll @@ -1,12 +1,26 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -indvars -S | FileCheck %s +@.str3 = private constant [6 x i8] c"%lld\0A\00", align 1 +declare i32 @printf(i8* noalias nocapture, ...) nounwind + ; PR13371: indvars pass incorrectly substitutes 'undef' values ; ; LFTR should not user %undef as the loop counter. -; CHECK-LABEL: @test( -; CHECK-NOT: icmp{{.*}}undef -@.str3 = private constant [6 x i8] c"%lld\0A\00", align 1 -declare i32 @printf(i8* noalias nocapture, ...) nounwind define i64 @test() nounwind { +; CHECK-LABEL: @test( +; CHECK-NEXT: func_start: +; CHECK-NEXT: br label [[BLOCK9:%.*]] +; CHECK: block9: +; CHECK-NEXT: [[UNDEF:%.*]] = phi i64 [ [[NEXT_UNDEF:%.*]], [[BLOCK9]] ], [ undef, [[FUNC_START:%.*]] ] +; CHECK-NEXT: [[ITER:%.*]] = phi i64 [ [[NEXT_ITER:%.*]], [[BLOCK9]] ], [ 1, [[FUNC_START]] ] +; CHECK-NEXT: [[NEXT_ITER]] = add nuw nsw i64 [[ITER]], 1 +; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 [[NEXT_ITER]], i64 [[UNDEF]]) +; CHECK-NEXT: [[NEXT_UNDEF]] = add nsw i64 [[UNDEF]], 1 +; CHECK-NEXT: [[_TMP_3:%.*]] = icmp ult i64 [[NEXT_ITER]], 100 +; CHECK-NEXT: br i1 [[_TMP_3]], label [[BLOCK9]], label [[EXIT:%.*]] +; CHECK: exit: +; CHECK-NEXT: ret i64 0 +; func_start: br label %block9 block9: ; preds = %block9,%func_start diff --git a/llvm/test/Transforms/IndVarSimplify/lftr-other-uses.ll b/llvm/test/Transforms/IndVarSimplify/lftr-other-uses.ll index 09ec237cfc33..8f620f559210 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr-other-uses.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr-other-uses.ll @@ -1,7 +1,9 @@ -; RUN: opt < %s -indvars -disable-output +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -indvars -S | FileCheck %s ; Don't RAUW the loop's original comparison instruction if it has ; other uses which aren't dominated by the new comparison instruction. +; Test is primarily checking for an assertion failure, not the actual output %struct.DecRefPicMarking_s = type { i32, i32, i32, i32, i32, %struct.DecRefPicMarking_s* } %struct.datapartition = type { %typedef.Bitstream*, %typedef.DecodingEnvironment, i32 (%struct.syntaxelement*, %struct.img_par*, %struct.inp_par*, %struct.datapartition*)* } @@ -18,19 +20,33 @@ %typedef.TextureInfoContexts = type { [2 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x [4 x %typedef.BiContextType]], [10 x [4 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]] } define void @readCBP_CABAC(%struct.syntaxelement* %se, %struct.inp_par* %inp, %struct.img_par* %img.1, %typedef.DecodingEnvironment* %dep_dp) { +; CHECK-LABEL: @readCBP_CABAC( +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOPENTRY_0:%.*]] +; CHECK: loopentry.0: +; CHECK-NEXT: [[MB_Y_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[TMP_152:%.*]], [[LOOPENTRY_1:%.*]] ] +; CHECK-NEXT: [[TMP_14:%.*]] = icmp ule i32 [[MB_Y_0]], 3 +; CHECK-NEXT: [[TMP_15:%.*]] = zext i1 [[TMP_14]] to i32 +; CHECK-NEXT: br i1 [[TMP_14]], label [[LOOPENTRY_1]], label [[LOOPEXIT_0:%.*]] +; CHECK: loopentry.1: +; CHECK-NEXT: [[TMP_152]] = add nuw nsw i32 [[MB_Y_0]], 2 +; CHECK-NEXT: br label [[LOOPENTRY_0]] +; CHECK: loopexit.0: +; CHECK-NEXT: unreachable +; entry: - br label %loopentry.0 + br label %loopentry.0 loopentry.0: ; preds = %loopentry.1, %entry - %mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopentry.1 ] ; [#uses=2] - %tmp.14 = icmp sle i32 %mb_y.0, 3 ; [#uses=2] - %tmp.15 = zext i1 %tmp.14 to i32 ; [#uses=0] - br i1 %tmp.14, label %loopentry.1, label %loopexit.0 + %mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopentry.1 ] ; [#uses=2] + %tmp.14 = icmp sle i32 %mb_y.0, 3 ; [#uses=2] + %tmp.15 = zext i1 %tmp.14 to i32 ; [#uses=0] + br i1 %tmp.14, label %loopentry.1, label %loopexit.0 loopentry.1: ; preds = %loopentry.0 - %tmp.152 = add i32 %mb_y.0, 2 ; [#uses=1] - br label %loopentry.0 + %tmp.152 = add i32 %mb_y.0, 2 ; [#uses=1] + br label %loopentry.0 loopexit.0: ; preds = %loopentry.0 - unreachable + unreachable }