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
5 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 ; TTI: remark: <stdin>:7:1: advising against unrolling the loop because it contains a call
9 ; UNROLL: remark: <stdin>:14:1: unrolled loop by a factor of 8 with run-time trip count
11 define void @contains_external_call(i32 %count) {
12 ; ALL-LABEL: @contains_external_call(
15 %cmp.not3 = icmp eq i32 %count, 0
16 br i1 %cmp.not3, label %for.cond.cleanup, label %for.body
19 %i.04 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
20 tail call void @sideeffect()
21 %inc = add nuw nsw i32 %i.04, 1
22 %cmp.not = icmp eq i32 %inc, %count
23 br i1 %cmp.not, label %for.cond.cleanup, label %for.body
29 declare void @sideeffect()
31 define i32 @no_external_calls(i32 %count) {
32 ; ALL-LABEL: @no_external_calls(
35 %cmp.not5 = icmp eq i32 %count, 0
36 br i1 %cmp.not5, label %for.end, label %for.body
39 %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
40 %inc = add nuw nsw i32 %i.06, 1
41 %cmp.not = icmp eq i32 %inc, %count
42 br i1 %cmp.not, label %for.end, label %for.body