brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 2c1dff7 Raw
71 lines · plain
1; RUN: opt -passes=loop-simplify -S < %s | FileCheck %s2 3; CHECK-LABEL: @test14define void @test1(i32 %n) {5entry:6  br label %while.cond7 8while.cond:                                       ; preds = %if.then, %if.else, %entry9  %count.0 = phi i32 [ 0, %entry ], [ %add, %if.then ], [ %add2, %if.else ]10  %cmp = icmp ugt i32 %count.0, %n11  br i1 %cmp, label %while.end, label %while.body12 13while.body:                                       ; preds = %while.cond14  %rem = and i32 %count.0, 115  %cmp1 = icmp eq i32 %rem, 016  br i1 %cmp1, label %if.then, label %if.else17 18if.then:                                          ; preds = %while.body19  %add = add i32 %count.0, 120  br label %while.cond, !llvm.loop !021 22if.else:                                          ; preds = %while.body23  %add2 = add i32 %count.0, 224  br label %while.cond, !llvm.loop !025 26while.end:                                        ; preds = %while.cond27  ret void28}29 30; CHECK: if.then31; CHECK-NOT: br {{.*}}!llvm.loop{{.*}}32 33; CHECK: while.cond.backedge:34; CHECK: br label %while.cond, !llvm.loop !035 36; CHECK: if.else37; CHECK-NOT: br {{.*}}!llvm.loop{{.*}}38 39; CHECK-LABEL: @test240; CHECK: for.body:41; CHECK: br i1 %{{.*}}, label %for.body, label %cleanup.loopexit, !llvm.loop !042define void @test2(i32 %k)  {43entry:44  %cmp9 = icmp sgt i32 %k, 045  br i1 %cmp9, label %for.body.preheader, label %cleanup46 47for.body.preheader:                               ; preds = %entry48  br label %for.body49 50for.cond:                                         ; preds = %for.body51  %cmp = icmp slt i32 %inc, %k52  br i1 %cmp, label %for.body, label %cleanup.loopexit, !llvm.loop !053 54for.body:                                         ; preds = %for.body.preheader, %for.cond55  %i.010 = phi i32 [ %inc, %for.cond ], [ 0, %for.body.preheader ]56  %cmp3 = icmp sgt i32 %i.010, 357  %inc = add nsw i32 %i.010, 158  br i1 %cmp3, label %cleanup.loopexit, label %for.cond59 60cleanup.loopexit:                                 ; preds = %for.body, %for.cond61  br label %cleanup62 63cleanup:                                          ; preds = %cleanup.loopexit, %entry64  ret void65}66 67!0 = distinct !{!0, !1}68!1 = !{!"llvm.loop.distribute.enable", i1 true}69; CHECK: !0 = distinct !{!0, !1}70; CHECK: !1 = !{!"llvm.loop.distribute.enable", i1 true}71