blob: d436fa6f09617f42725fe7c6f61ec17e31360518 [file] [log] [blame]
David Bolvanskyc1b27b52018-08-28 15:27:25 +00001; RUN: opt < %s -inline -inline-remark-attribute --inline-threshold=-2 -S | FileCheck %s
2
3; Test that the inliner adds inline remark attributes to non-inlined callsites.
4
5define void @foo() {
6 call void @bar(i1 true)
7 ret void
8}
9
10define void @bar(i1 %p) {
11 br i1 %p, label %bb1, label %bb2
12
13bb1:
14 call void @foo()
15 ret void
16
17bb2:
18 call void @bar(i1 true)
19 ret void
20}
21
22;; Test 1 - Add different inline remarks to similar callsites.
23define void @test1() {
24; CHECK-LABEL: @test1
25; CHECK-NEXT: call void @bar(i1 true) [[ATTR1:#[0-9]+]]
26; CHECK-NEXT: call void @bar(i1 false) [[ATTR2:#[0-9]+]]
27 call void @bar(i1 true)
28 call void @bar(i1 false)
29 ret void
30}
31
32define void @noop() {
33 ret void
34}
35
36;; Test 2 - Printed InlineResult messages are followed by InlineCost.
37define void @test2(i8*) {
38; CHECK-LABEL: @test2
39; CHECK-NEXT: call void @noop() [[ATTR3:#[0-9]+]] [ "CUSTOM_OPERAND_BUNDLE"() ]
40; CHECK-NEXT: ret void
41 call void @noop() ; extepected to be inlined
42 call void @noop() [ "CUSTOM_OPERAND_BUNDLE"() ] ; cannot be inlined because of unsupported operand bundle
43 ret void
44}
45
46; CHECK: attributes [[ATTR1]] = { "inline-remark"="(cost=-5, threshold=-6)" }
47; CHECK: attributes [[ATTR2]] = { "inline-remark"="(cost=never): recursive" }
48; CHECK: attributes [[ATTR3]] = { "inline-remark"="unsupported operand bundle; (cost={{.*}}, threshold={{.*}})" }