From c88bcb845956d7868c4826ebb6a8245380724e1d Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sat, 12 Oct 2019 15:35:09 +0000 Subject: [PATCH] [NFC][LoopIdiom] Move one bcmp test into the proper place git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374660 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/LoopIdiom/bcmp-basic.ll | 47 +++++++++++++++++++ .../LoopIdiom/bcmp-negative-tests.ll | 23 --------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/test/Transforms/LoopIdiom/bcmp-basic.ll b/test/Transforms/LoopIdiom/bcmp-basic.ll index 25a80763023..d12c54c695e 100644 --- a/test/Transforms/LoopIdiom/bcmp-basic.ll +++ b/test/Transforms/LoopIdiom/bcmp-basic.ll @@ -1894,3 +1894,50 @@ cleanup4: ; preds = %for.body, %for.inc, %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] ret i1 %res } + +define i1 @exit_block_is_not_dedicated(i8* %ptr0, i8* %ptr1) { +; CHECK-LABEL: @exit_block_is_not_dedicated( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 true, label [[FOR_BODY_PREHEADER:%.*]], label [[CLEANUP:%.*]] +; CHECK: for.body.preheader: +; CHECK-NEXT: br label [[FOR_BODY:%.*]] +; CHECK: for.body: +; CHECK-NEXT: [[I_08:%.*]] = phi i64 [ [[INC:%.*]], [[FOR_COND:%.*]] ], [ 0, [[FOR_BODY_PREHEADER]] ] +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, i8* [[PTR0:%.*]], i64 [[I_08]] +; CHECK-NEXT: [[V0:%.*]] = load i8, i8* [[ARRAYIDX]] +; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i8, i8* [[PTR1:%.*]], i64 [[I_08]] +; CHECK-NEXT: [[V1:%.*]] = load i8, i8* [[ARRAYIDX1]] +; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i8 [[V0]], [[V1]] +; CHECK-NEXT: [[INC]] = add nuw nsw i64 [[I_08]], 1 +; CHECK-NEXT: br i1 [[CMP3]], label [[FOR_COND]], label [[CLEANUP_LOOPEXIT:%.*]] +; CHECK: for.cond: +; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[INC]], 8 +; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[CLEANUP_LOOPEXIT]] +; CHECK: cleanup.loopexit: +; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ true, [[FOR_COND]] ], [ false, [[FOR_BODY]] ] +; CHECK-NEXT: br label [[CLEANUP]] +; CHECK: cleanup: +; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] +; CHECK-NEXT: ret i1 [[RES]] +; +entry: + br i1 true, label %for.body, label %cleanup + +for.body: + %i.08 = phi i64 [ 0, %entry ], [ %inc, %for.cond ] + %arrayidx = getelementptr inbounds i8, i8* %ptr0, i64 %i.08 + %v0 = load i8, i8* %arrayidx + %arrayidx1 = getelementptr inbounds i8, i8* %ptr1, i64 %i.08 + %v1 = load i8, i8* %arrayidx1 + %cmp3 = icmp eq i8 %v0, %v1 + %inc = add nuw nsw i64 %i.08, 1 + br i1 %cmp3, label %for.cond, label %cleanup + +for.cond: + %cmp = icmp ult i64 %inc, 8 + br i1 %cmp, label %for.body, label %cleanup + +cleanup: + %res = phi i1 [ false, %for.body ], [ true, %for.cond ], [ false, %entry ] + ret i1 %res +} diff --git a/test/Transforms/LoopIdiom/bcmp-negative-tests.ll b/test/Transforms/LoopIdiom/bcmp-negative-tests.ll index 3808cdd2fe1..9d770adf979 100644 --- a/test/Transforms/LoopIdiom/bcmp-negative-tests.ll +++ b/test/Transforms/LoopIdiom/bcmp-negative-tests.ll @@ -59,29 +59,6 @@ cleanup: ret i1 %res } -define i1 @exit_block_is_not_dedicated(i8* %ptr0, i8* %ptr1) { -entry: - br i1 true, label %for.body, label %cleanup - -for.body: - %i.08 = phi i64 [ 0, %entry ], [ %inc, %for.cond ] - %arrayidx = getelementptr inbounds i8, i8* %ptr0, i64 %i.08 - %v0 = load i8, i8* %arrayidx - %arrayidx1 = getelementptr inbounds i8, i8* %ptr1, i64 %i.08 - %v1 = load i8, i8* %arrayidx1 - %cmp3 = icmp eq i8 %v0, %v1 - %inc = add nuw nsw i64 %i.08, 1 - br i1 %cmp3, label %for.cond, label %cleanup - -for.cond: - %cmp = icmp ult i64 %inc, 8 - br i1 %cmp, label %for.body, label %cleanup - -cleanup: - %res = phi i1 [ false, %for.body ], [ true, %for.cond ], [ false, %entry ] - ret i1 %res -} - define i1 @body_cmp_is_not_equality(i8* %ptr0, i8* %ptr1) { entry: br label %for.body -- 2.40.0