| Diego Novillo | 7f8af8b | 2014-05-22 14:19:46 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline -pass-remarks-analysis=inline -S 2>&1 | FileCheck %s | 
|  | 2 |  | 
|  | 3 | ; CHECK: foo should always be inlined (cost=always) | 
|  | 4 | ; CHECK: foo inlined into bar | 
|  | 5 | ; CHECK: foz should never be inlined (cost=never) | 
|  | 6 | ; CHECK: foz will not be inlined into bar | 
|  | 7 |  | 
|  | 8 | ; Function Attrs: alwaysinline nounwind uwtable | 
|  | 9 | define i32 @foo(i32 %x, i32 %y) #0 { | 
|  | 10 | entry: | 
|  | 11 | %x.addr = alloca i32, align 4 | 
|  | 12 | %y.addr = alloca i32, align 4 | 
|  | 13 | store i32 %x, i32* %x.addr, align 4 | 
|  | 14 | store i32 %y, i32* %y.addr, align 4 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 15 | %0 = load i32, i32* %x.addr, align 4 | 
|  | 16 | %1 = load i32, i32* %y.addr, align 4 | 
| Diego Novillo | 7f8af8b | 2014-05-22 14:19:46 +0000 | [diff] [blame] | 17 | %add = add nsw i32 %0, %1 | 
|  | 18 | ret i32 %add | 
|  | 19 | } | 
|  | 20 |  | 
|  | 21 | ; Function Attrs: noinline nounwind uwtable | 
|  | 22 | define float @foz(i32 %x, i32 %y) #1 { | 
|  | 23 | entry: | 
|  | 24 | %x.addr = alloca i32, align 4 | 
|  | 25 | %y.addr = alloca i32, align 4 | 
|  | 26 | store i32 %x, i32* %x.addr, align 4 | 
|  | 27 | store i32 %y, i32* %y.addr, align 4 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 28 | %0 = load i32, i32* %x.addr, align 4 | 
|  | 29 | %1 = load i32, i32* %y.addr, align 4 | 
| Diego Novillo | 7f8af8b | 2014-05-22 14:19:46 +0000 | [diff] [blame] | 30 | %mul = mul nsw i32 %0, %1 | 
|  | 31 | %conv = sitofp i32 %mul to float | 
|  | 32 | ret float %conv | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | ; Function Attrs: nounwind uwtable | 
|  | 36 | define i32 @bar(i32 %j) #2 { | 
|  | 37 | entry: | 
|  | 38 | %j.addr = alloca i32, align 4 | 
|  | 39 | store i32 %j, i32* %j.addr, align 4 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 40 | %0 = load i32, i32* %j.addr, align 4 | 
|  | 41 | %1 = load i32, i32* %j.addr, align 4 | 
| Diego Novillo | 7f8af8b | 2014-05-22 14:19:46 +0000 | [diff] [blame] | 42 | %sub = sub nsw i32 %1, 2 | 
|  | 43 | %call = call i32 @foo(i32 %0, i32 %sub) | 
|  | 44 | %conv = sitofp i32 %call to float | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 45 | %2 = load i32, i32* %j.addr, align 4 | 
| Diego Novillo | 7f8af8b | 2014-05-22 14:19:46 +0000 | [diff] [blame] | 46 | %sub1 = sub nsw i32 %2, 2 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 47 | %3 = load i32, i32* %j.addr, align 4 | 
| Diego Novillo | 7f8af8b | 2014-05-22 14:19:46 +0000 | [diff] [blame] | 48 | %call2 = call float @foz(i32 %sub1, i32 %3) | 
|  | 49 | %mul = fmul float %conv, %call2 | 
|  | 50 | %conv3 = fptosi float %mul to i32 | 
|  | 51 | ret i32 %conv3 | 
|  | 52 | } | 
|  | 53 |  | 
|  | 54 | attributes #0 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } | 
|  | 55 | attributes #1 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } | 
|  | 56 | attributes #2 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } | 
|  | 57 |  | 
|  | 58 | !llvm.ident = !{!0} | 
|  | 59 |  | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 60 | !0 = !{!"clang version 3.5.0 "} |