File: inline_nossp.ll

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (50 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (3)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes='cgscc(inline)' %s -S -pass-remarks-missed=inline 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-INLINE %s
; RUN: opt -passes=always-inline -o - -S %s | FileCheck %s

; CHECK-INLINE: ssp not inlined into nossp_caller because it should never be inlined (cost=never): stack protected callee but caller requested no stack protector
; CHECK-INLINE: nossp not inlined into ssp_caller because it should never be inlined (cost=never): stack protected caller but callee requested no stack protector

; Not interesting to test.
define i32 @nossp() { ret i32 41 }
define i32 @ssp() sspstrong { ret i32 42 }
define i32 @nossp_alwaysinline() alwaysinline { ret i32 43 }
define i32 @ssp_alwaysinline() sspstrong alwaysinline { ret i32 44 }

; @ssp should not be inlined due to mismatch stack protector.
; @ssp_alwaysinline should be inlined due to alwaysinline.
define i32 @nossp_caller() {
; CHECK-LABEL: @nossp_caller(
; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @ssp()
; CHECK-NEXT:    ret i32 44
;
  call i32 @ssp()
  %2 = call i32 @ssp_alwaysinline()
  ret i32 %2
}
; @nossp should not be inlined due to mismatch stack protector.
; @nossp_alwaysinline should be inlined due to alwaysinline.
define i32 @ssp_caller() sspstrong {
; CHECK-LABEL: @ssp_caller(
; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @nossp()
; CHECK-NEXT:    ret i32 43
;
  call i32 @nossp()
  %2 = call i32 @nossp_alwaysinline()
  ret i32 %2
}

; The alwaysinline attribute can also appear on the CallBase (ie. the call
; site), ie. when __attribute__((flatten)) is used on the caller. Treat this
; the same as if the caller had the fn attr alwaysinline and permit inline
; substitution, despite the mismatch between caller and callee on ssp attrs.
;
; Curiously, the always_inline attribute on a CallInst is only expanded by the
; inline pass, but not always_inline pass!
define i32 @nossp_alwaysinline_caller() {
; CHECK-INLINE-LABEL: @nossp_alwaysinline_caller(
; CHECK-INLINE-NEXT:    ret i32 42
;
  %1 = call i32 @ssp() alwaysinline
  ret i32 %1
}