brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 0a6b04b Raw
66 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -S -passes=loop-unroll -mtriple aarch64 | FileCheck %s3 4; Below loop's trip count is not constant and it blocks to unroll the loop.5; After setting up `UP.UpperBound = true` in `getUnrollingPreferences`,6; the loop should be unrolled.7 8define void @test(i1 %cond) {9; CHECK-LABEL: @test(10; CHECK-NEXT:  entry:11; CHECK-NEXT:    br label [[FOR_BODY:%.*]]12; CHECK:       for.body:13; CHECK-NEXT:    switch i32 0, label [[SW_DEFAULT:%.*]] [14; CHECK-NEXT:    i32 2, label [[LATCH:%.*]]15; CHECK-NEXT:    ]16; CHECK:       sw.default:17; CHECK-NEXT:    tail call void @foo()18; CHECK-NEXT:    br label [[LATCH]]19; CHECK:       latch:20; CHECK-NEXT:    br i1 false, label [[FOR_END:%.*]], label [[FOR_BODY_1:%.*]]21; CHECK:       for.body.1:22; CHECK-NEXT:    switch i32 1, label [[SW_DEFAULT_1:%.*]] [23; CHECK-NEXT:    i32 2, label [[LATCH_1:%.*]]24; CHECK-NEXT:    ]25; CHECK:       sw.default.1:26; CHECK-NEXT:    tail call void @foo()27; CHECK-NEXT:    br label [[LATCH_1]]28; CHECK:       latch.1:29; CHECK-NEXT:    br i1 [[COND:%.*]], label [[FOR_END]], label [[FOR_BODY_2:%.*]]30; CHECK:       for.body.2:31; CHECK-NEXT:    switch i32 2, label [[SW_DEFAULT_2:%.*]] [32; CHECK-NEXT:    i32 2, label [[LATCH_2:%.*]]33; CHECK-NEXT:    ]34; CHECK:       sw.default.2:35; CHECK-NEXT:    tail call void @foo()36; CHECK-NEXT:    br label [[LATCH_2]]37; CHECK:       latch.2:38; CHECK-NEXT:    br label [[FOR_END]]39; CHECK:       for.end:40; CHECK-NEXT:    ret void41;42entry:43  %0 = select i1 %cond, i32 2, i32 344  br label %for.body45 46for.body:47  %i.017 = phi i32 [ 0, %entry ], [ %inc, %latch ]48  switch i32 %i.017, label %sw.default [49  i32 2, label %latch50  ]51 52sw.default:53  tail call void @foo()54  br label %latch55 56latch:57  %inc = add nuw nsw i32 %i.017, 158  %exitcond.not = icmp eq i32 %inc, %059  br i1 %exitcond.not, label %for.end, label %for.body60 61for.end:62  ret void63}64 65declare void @foo()66