File: inline-remark.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (61 lines) | stat: -rw-r--r-- 1,735 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; RUN: opt < %s -passes=inline -inline-remark-attribute --inline-threshold=0 -S | FileCheck %s

; Test that the inliner adds inline remark attributes to non-inlined callsites.

declare void @ext();

define void @foo() {
  call void @bar(i1 true)
  ret void
}

define void @bar(i1 %p) {
  br i1 %p, label %bb1, label %bb2

bb1:
  call void @foo()
  call void @ext()
  ret void

bb2:
  call void @bar(i1 true)
  ret void
}

;; Test 1 - Add different inline remarks to similar callsites.
define void @test1() {
; CHECK-LABEL: @test1
; CHECK-NEXT: call void @bar(i1 true) [[ATTR1:#[0-9]+]]
; CHECK-NEXT: call void @bar(i1 false) [[ATTR2:#[0-9]+]]
  call void @bar(i1 true)
  call void @bar(i1 false)
  ret void
}

define void @noop() {
  ret void
}

;; Test 2 - Printed InlineResult messages are followed by InlineCost.
define void @test2(ptr) {
; CHECK-LABEL: @test2
; CHECK-NEXT: call void @noop() [[ATTR3:#[0-9]+]] [ "CUSTOM_OPERAND_BUNDLE"() ]
; CHECK-NEXT: ret void
  call void @noop() ; extepected to be inlined
  call void @noop() [ "CUSTOM_OPERAND_BUNDLE"() ] ; cannot be inlined because of unsupported operand bundle
  ret void
}

;; Test 3 - InlineResult messages come from llvm::isInlineViable()
define void @test3() {
; CHECK-LABEL: @test3
; CHECK-NEXT: call void @test3() [[ATTR4:#[0-9]+]]
; CHECK-NEXT: ret void
  call void @test3() alwaysinline
  ret void
}

; CHECK: attributes [[ATTR1]] = { "inline-remark"="(cost=25, threshold=0)" }
; CHECK: attributes [[ATTR2]] = { "inline-remark"="(cost=never): recursive" }
; CHECK: attributes [[ATTR3]] = { "inline-remark"="unsupported operand bundle; (cost={{.*}}, threshold={{.*}})" }
; CHECK: attributes [[ATTR4]] = { alwaysinline "inline-remark"="(cost=never): recursive call" }