brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · fb2ab75 Raw
49 lines · plain
1; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s2; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s3; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -unroll-count=4 -unroll-runtime=true -unroll-remainder 2>&1 | FileCheck %s --check-prefix=RUNTIME-UNROLL4 5; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations6; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 47; RUNTIME-UNROLL: remark: {{.*}}: unrolled loop by a factor of 48 9define i32 @sum() {10entry:11  br label %for.body12 13for.body:                                         ; preds = %for.body, %entry14  %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ]15  %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]16  %add = add nsw i32 %i.05, 417  %call = tail call i32 @baz(i32 %add) #218  %add1 = add nsw i32 %call, %s.0619  %inc = add nsw i32 %i.05, 120  %exitcond = icmp eq i32 %inc, 1621  br i1 %exitcond, label %for.end, label %for.body22 23for.end:                                          ; preds = %for.body24  ret i32 %add125}26 27; RUNTIME-UNROLL-NOT: remark: {{.*}}: completely unrolled loop with 3 iterations28; RUNTIME-UNROLL: remark: {{.*}}: unrolled loop by a factor of 429 30define i32 @runtime(i32 %n) {31entry:32  br label %for.body33 34for.body:                                         ; preds = %for.body, %entry35  %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ]36  %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]37  %add = add nsw i32 %i.05, 438  %call = tail call i32 @baz(i32 %add) #239  %add1 = add nsw i32 %call, %s.0640  %inc = add nsw i32 %i.05, 141  %exitcond = icmp eq i32 %inc, %n42  br i1 %exitcond, label %for.end, label %for.body43 44for.end:                                          ; preds = %for.body45  ret i32 %add146}47 48declare i32 @baz(i32)49