1 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s
2 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=TTI -pass-remarks-analysis=TTI < %s -S 2>&1 | FileCheck --check-prefixes=ALL,TTI %s
3 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver4 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s
4 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver5 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s
6 ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 --try-experimental-debuginfo-iterators | FileCheck --check-prefixes=ALL,UNROLL %s
8 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
9 target triple = "x86_64-unknown-linux-gnu"
11 ; TTI: remark: <stdin>:7:1: advising against unrolling the loop because it contains a call
12 ; UNROLL: remark: <stdin>:14:1: unrolled loop by a factor of 8 with run-time trip count
14 define void @contains_external_call(i32 %count) {
15 ; ALL-LABEL: @contains_external_call(
18 %cmp.not3 = icmp eq i32 %count, 0
19 br i1 %cmp.not3, label %for.cond.cleanup, label %for.body
22 %i.04 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
23 tail call void @sideeffect()
24 %inc = add nuw nsw i32 %i.04, 1
25 %cmp.not = icmp eq i32 %inc, %count
26 br i1 %cmp.not, label %for.cond.cleanup, label %for.body
32 declare void @sideeffect()
34 define i32 @no_external_calls(i32 %count) {
35 ; ALL-LABEL: @no_external_calls(
38 %cmp.not5 = icmp eq i32 %count, 0
39 br i1 %cmp.not5, label %for.end, label %for.body
42 %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
43 %inc = add nuw nsw i32 %i.06, 1
44 %cmp.not = icmp eq i32 %inc, %count
45 br i1 %cmp.not, label %for.end, label %for.body