1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[LoopUnroll] NFC. Factor out runtime-loop.ll common test behavior.

Adding COMMON prefix to get common part handled there.
Needed to simplify test changes for D53440.

llvm-svn: 345538
This commit is contained in:
Fedor Sergeev 2018-10-29 20:38:23 +00:00
parent b489907209
commit 8100e4074d

View File

@ -1,13 +1,15 @@
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
; Tests for unrolling loops with run-time trip counts
; COMMON-LABEL: @test(
; EPILOG: %xtraiter = and i32 %n
; EPILOG: %lcmp.mod = icmp ne i32 %xtraiter, 0
; EPILOG: br i1 %lcmp.mod, label %for.body.epil.preheader, label %for.end.loopexit
@ -54,11 +56,10 @@ for.end: ; preds = %for.body, %entry
; Still try to completely unroll loops with compile-time trip counts
; even if the -unroll-runtime is specified
; EPILOG: for.body:
; EPILOG-NOT: for.body.epil:
; PROLOG: for.body:
; PROLOG-NOT: for.body.prol:
; COMMON-LABEL: @test1(
; COMMON: for.body:
; COMMON-NOT: for.body.epil:
; COMMON-NOT: for.body.prol:
define i32 @test1(i32* nocapture %a) nounwind uwtable readonly {
entry:
@ -82,6 +83,7 @@ for.end: ; preds = %for.body
; This is test 2007-05-09-UnknownTripCount.ll which can be unrolled now
; if the -unroll-runtime option is turned on
; COMMON-LABEL: @foo(
; EPILOG: bb72.2:
; PROLOG: bb72.2:
@ -105,6 +107,7 @@ cond_true138:
; Test run-time unrolling for a loop that counts down by -2.
; COMMON-LABEL: @down(
; EPILOG: for.body.epil:
; EPILOG: br i1 %epil.iter.cmp, label %for.body.epil, label %for.cond.for.end_crit_edge.epilog-lcssa
@ -138,6 +141,8 @@ for.end: ; preds = %for.cond.for.end_cr
}
; Test run-time unrolling disable metadata.
; COMMON-LABEL: @test2(
; EPILOG: for.body:
; EPILOG-NOT: for.body.epil:
@ -174,11 +179,9 @@ for.end: ; preds = %for.cond.for.end_cr
; -runtime-unroll-multi-exit=true
; single exit, multiple exiting blocks.
define void @unique_exit(i32 %arg) {
; PROLOG: unique_exit(
; PROLOG-NOT: .unr
; COMMON-LABEL: @unique_exit(
; COMMON-NOT: .unr
; EPILOG: unique_exit(
; EPILOG-NOT: .unr
entry:
%tmp = icmp sgt i32 undef, %arg
br i1 %tmp, label %preheader, label %returnblock
@ -206,11 +209,9 @@ latch: ; preds = %header
; multiple exit blocks. don't unroll
define void @multi_exit(i64 %trip, i1 %cond) {
; PROLOG: multi_exit(
; PROLOG-NOT: .unr
; COMMON-LABEL: @multi_exit(
; COMMON-NOT: .unr
; EPILOG: multi_exit(
; EPILOG-NOT: .unr
entry:
br label %loop_header
@ -238,11 +239,15 @@ exit1:
exit2.loopexit:
ret void
}
!0 = distinct !{!0, !1}
!1 = !{!"llvm.loop.unroll.runtime.disable"}
; EPILOG: !0 = distinct !{!0, !1}
; need to use LABEL here to separate function IR matching from metadata matching
; COMMON-LABEL: {{^}}!0 =
; EPILOG-SAME: distinct !{!0, !1}
; EPILOG: !1 = !{!"llvm.loop.unroll.disable"}
; PROLOG: !0 = distinct !{!0, !1}
; PROLOG-SAME: distinct !{!0, !1}
; PROLOG: !1 = !{!"llvm.loop.unroll.disable"}