1 ; RUN: opt -inline %s -S | FileCheck %s
3 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
4 target triple = "thumbv7m-arm-none-eabi"
6 ; Check we don't inline loops at -Oz. They tend to be larger than we
10 @digits = constant [16 x i8] c"0123456789ABCDEF", align 1
11 define i8* @H(i8* %p, i32 %val, i32 %num) #0 {
15 do.body: ; preds = %do.body, %entry
16 %p.addr.0 = phi i8* [ %p, %entry ], [ %incdec.ptr, %do.body ]
17 %val.addr.0 = phi i32 [ %val, %entry ], [ %shl, %do.body ]
18 %num.addr.0 = phi i32 [ %num, %entry ], [ %dec, %do.body ]
19 %shr = lshr i32 %val.addr.0, 28
20 %arrayidx = getelementptr inbounds [16 x i8], [16 x i8]* @digits, i32 0, i32 %shr
21 %0 = load i8, i8* %arrayidx, align 1
22 %incdec.ptr = getelementptr inbounds i8, i8* %p.addr.0, i32 1
23 store i8 %0, i8* %p.addr.0, align 1
24 %shl = shl i32 %val.addr.0, 4
25 %dec = add i32 %num.addr.0, -1
26 %tobool = icmp eq i32 %dec, 0
27 br i1 %tobool, label %do.end, label %do.body
29 do.end: ; preds = %do.body
30 %scevgep = getelementptr i8, i8* %p, i32 %num
34 define nonnull i8* @call1(i8* %p, i32 %val, i32 %num) #0 {
36 ; CHECK: tail call i8* @H
37 %call = tail call i8* @H(i8* %p, i32 %val, i32 %num) #0
41 define nonnull i8* @call2(i8* %p, i32 %val) #0 {
43 ; CHECK: tail call i8* @H
44 %call = tail call i8* @H(i8* %p, i32 %val, i32 32) #0
48 attributes #0 = { minsize optsize }