diff options
author | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-10-31 14:33:14 +0000 |
---|---|---|
committer | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-10-31 14:33:14 +0000 |
commit | 412ed34744d45dae98e5d2eea8f96993d48b7b79 (patch) | |
tree | 07cac71fdd208017a6b5d77ac211337f5967c501 /llvm/test/Transforms/LoopUnroll/runtime-loop.ll | |
parent | 1cd9917edf8493883092e4d24961f8b629a428c3 (diff) | |
download | bcm5719-llvm-412ed34744d45dae98e5d2eea8f96993d48b7b79.tar.gz bcm5719-llvm-412ed34744d45dae98e5d2eea8f96993d48b7b79.zip |
[LoopUnroll] allow customization for new-pass-manager version of LoopUnroll
Unlike its legacy counterpart new pass manager's LoopUnrollPass does
not provide any means to select which flavors of unroll to run
(runtime, peeling, partial), relying on global defaults.
In some cases having ability to run a restricted LoopUnroll that
does more than LoopFullUnroll is needed.
Introduced LoopUnrollOptions to select optional unroll behaviors.
Added 'unroll<peeling>' to PassRegistry mainly for the sake of testing.
Reviewers: chandlerc, tejohnson
Differential Revision: https://reviews.llvm.org/D53440
llvm-svn: 345723
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll/runtime-loop.ll')
-rw-r--r-- | llvm/test/Transforms/LoopUnroll/runtime-loop.ll | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop.ll index 34eaa4ec333..19072855d25 100644 --- a/llvm/test/Transforms/LoopUnroll/runtime-loop.ll +++ b/llvm/test/Transforms/LoopUnroll/runtime-loop.ll @@ -1,8 +1,16 @@ ; 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-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 +; +; Restricted versions of unroll (unroll<peeling;noruntime>, unroll-full) should not be doing runtime unrolling +; even if it is globally enabled through -unroll-runtime option +; +; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll<peeling;no-runtime>' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=NOEPILOG,COMMON +; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll<peeling;no-runtime>' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=NOPROLOG,COMMON +; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=NOEPILOG,COMMON +; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=NOPROLOG,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" @@ -14,22 +22,32 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 ; EPILOG: %lcmp.mod = icmp ne i32 %xtraiter, 0 ; EPILOG: br i1 %lcmp.mod, label %for.body.epil.preheader, label %for.end.loopexit +; NOEPILOG-NOT: %xtraiter = and i32 %n + ; PROLOG: %xtraiter = and i32 %n ; PROLOG: %lcmp.mod = icmp ne i32 %xtraiter, 0 ; PROLOG: br i1 %lcmp.mod, label %for.body.prol.preheader, label %for.body.prol.loopexit +; NOPROLOG-NOT: %xtraiter = and i32 %n + ; EPILOG: for.body.epil: ; EPILOG: %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.body.epil.preheader ] ; EPILOG: %epil.iter.sub = sub i32 %epil.iter, 1 ; EPILOG: %epil.iter.cmp = icmp ne i32 %epil.iter.sub, 0 ; EPILOG: br i1 %epil.iter.cmp, label %for.body.epil, label %for.end.loopexit.epilog-lcssa, !llvm.loop !0 +; NOEPILOG: for.body: +; NOEPILOG-NOT: for.body.epil: + ; PROLOG: for.body.prol: ; PROLOG: %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ 0, %for.body.prol.preheader ] ; PROLOG: %prol.iter.sub = sub i32 %prol.iter, 1 ; PROLOG: %prol.iter.cmp = icmp ne i32 %prol.iter.sub, 0 ; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit.unr-lcssa, !llvm.loop !0 +; NOPROLOG: for.body: +; NOPROLOG-NOT: for.body.prol: + define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly { entry: @@ -86,6 +104,8 @@ for.end: ; preds = %for.body ; COMMON-LABEL: @foo( ; EPILOG: bb72.2: ; PROLOG: bb72.2: +; NOEPILOG-NOT: bb72.2: +; NOPROLOG-NOT: bb72.2: define void @foo(i32 %trips) { entry: @@ -111,9 +131,15 @@ cond_true138: ; EPILOG: for.body.epil: ; EPILOG: br i1 %epil.iter.cmp, label %for.body.epil, label %for.cond.for.end_crit_edge.epilog-lcssa +; NOEPILOG: for.body: +; NOEPILOG-NOT: for.body.epil: + ; PROLOG: for.body.prol: ; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit +; NOPROLOG: for.body: +; NOPROLOG-NOT: for.body.prol: + define zeroext i16 @down(i16* nocapture %p, i32 %len) nounwind uwtable readonly { entry: %cmp2 = icmp eq i32 %len, 0 @@ -146,9 +172,15 @@ for.end: ; preds = %for.cond.for.end_cr ; EPILOG: for.body: ; EPILOG-NOT: for.body.epil: +; NOEPILOG: for.body: +; NOEPILOG-NOT: for.body.epil: + ; PROLOG: for.body: ; PROLOG-NOT: for.body.prol: +; NOPROLOG: for.body: +; NOPROLOG-NOT: for.body.prol: + define zeroext i16 @test2(i16* nocapture %p, i32 %len) nounwind uwtable readonly { entry: %cmp2 = icmp eq i32 %len, 0 |