76 lines · plain
1; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG2; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG3 4; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG5; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG6 7; This tests that setting the unroll count works8 9 10; EPILOG: for.body.preheader:11; EPILOG: br i1 %1, label %for.body.epil.preheader, label %for.body.preheader.new, !dbg [[PH_LOC:![0-9]+]]12; EPILOG: for.body:13; EPILOG: br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !dbg [[PH_LOC]]14; EPILOG-NOT: br i1 %niter.ncmp.2, label %for.end.loopexit{{.*}}, label %for.body15; EPILOG: for.body.epil.preheader:16; EPILOG: br label %for.body.epil, !dbg [[PH_LOC]]17; EPILOG: for.body.epil:18; EPILOG: br label %for.end.loopexit, !dbg [[EXIT_LOC:![0-9]+]]19; EPILOG: for.end.loopexit:20; EPILOG: br label %for.end, !dbg [[EXIT_LOC]]21 22; EPILOG-DAG: [[PH_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}})23; EPILOG-DAG: [[EXIT_LOC]] = !DILocation(line: 103, column: 1, scope: !{{.*}})24 25; PROLOG: for.body.preheader:26; PROLOG: br {{.*}} label %for.body.prol.preheader, label %for.body.prol.loopexit, !dbg [[PH_LOC:![0-9]+]]27; PROLOG: for.body.prol:28; PROLOG: br label %for.body.prol.loopexit, !dbg [[PH_LOC:![0-9]+]]29; PROLOG: for.body.prol.loopexit:30; PROLOG: br {{.*}} label %for.end.loopexit, label %for.body.preheader.new, !dbg [[PH_LOC]]31; PROLOG: for.body:32; PROLOG: br i1 %exitcond.1, label %for.end.loopexit.unr-lcssa, label %for.body, !dbg [[PH_LOC]]33; PROLOG-NOT: br i1 %exitcond.4, label %for.end.loopexit{{.*}}, label %for.body34 35; PROLOG-DAG: [[PH_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}})36 37define i32 @test(ptr nocapture %a, i32 %n) nounwind uwtable readonly !dbg !6 {38entry:39 %cmp1 = icmp eq i32 %n, 0, !dbg !740 br i1 %cmp1, label %for.end, label %for.body, !dbg !741 42for.body: ; preds = %for.body, %entry43 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]44 %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]45 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv, !dbg !846 %0 = load i32, ptr %arrayidx, align 4, !dbg !847 %add = add nsw i32 %0, %sum.02, !dbg !848 %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !949 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !950 %exitcond = icmp eq i32 %lftr.wideiv, %n, !dbg !951 br i1 %exitcond, label %for.end, label %for.body, !dbg !952 53for.end: ; preds = %for.body, %entry54 %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]55 ret i32 %sum.0.lcssa, !dbg !1056}57 58!llvm.module.flags = !{!0, !1, !2}59!llvm.dbg.cu = !{!11}60!0 = !{i32 2, !"Dwarf Version", i32 4}61!1 = !{i32 2, !"Debug Info Version", i32 3}62!2 = !{i32 1, !"PIC Level", i32 2}63 64!3 = !{}65!4 = !DISubroutineType(types: !3)66!5 = !DIFile(filename: "test.cpp", directory: "/tmp")67!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, unit: !11, retainedNodes: !3)68!7 = !DILocation(line: 100, column: 1, scope: !6)69!8 = !DILocation(line: 101, column: 1, scope: !6)70!9 = !DILocation(line: 102, column: 1, scope: !6)71!10 = !DILocation(line: 103, column: 1, scope: !6)72!11 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",73 file: !5,74 isOptimized: true, flags: "-O2",75 splitDebugFilename: "abc.debug", emissionKind: 2)76