File: ipra-exact-definition.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (44 lines) | stat: -rw-r--r-- 1,432 bytes parent folder | download | duplicates (21)
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
; RUN: llc -mtriple armv7a--none-eabi < %s -enable-ipra | FileCheck %s

; A linkone_odr function (the same applies to available_externally, linkonce,
; weak, common, extern_weak and weak_odr) could be replaced with a
; differently-compiled version of the same source at link time, which might use
; different registers, so we can't do IPRA on it.
define linkonce_odr void @leaf_linkonce_odr() {
entry:
  ret void
}
define void @test_linkonce_odr() {
; CHECK-LABEL: test_linkonce_odr:
entry:
; CHECK: ASM1: r3
; CHECK: mov   [[TEMP:r[0-9]+]], r3
; CHECK: bl    leaf_linkonce_odr
; CHECK: mov   r3, [[TEMP]]
; CHECK: ASM2: r3
  %0 = tail call i32 asm sideeffect "// ASM1: $0", "={r3},0"(i32 undef)
  tail call void @leaf_linkonce_odr()
  %1 = tail call i32 asm sideeffect "// ASM2: $0", "={r3},0"(i32 %0)
  ret void
}

; This function has external linkage (the same applies to private, internal and
; appending), so the version we see here is guaranteed to be the version
; selected by the linker, so we can do IPRA.
define external void @leaf_external() {
entry:
  ret void
}
define void @test_external() {
; CHECK-LABEL: test_external:
entry:
; CHECK: ASM1: r3
; CHECK-NOT:   r3
; CHECK: bl    leaf_external
; CHECK-NOT:   r3
; CHECK: ASM2: r3
  %0 = tail call i32 asm sideeffect "// ASM1: $0", "={r3},0"(i32 undef)
  tail call void @leaf_external()
  %1 = tail call i32 asm sideeffect "// ASM2: $0", "={r3},0"(i32 %0)
  ret void
}