File: operands-to-args.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (71 lines) | stat: -rw-r--r-- 1,963 bytes parent folder | download | duplicates (5)
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
62
63
64
65
66
67
68
69
70
71
; RUN: llvm-reduce %s -o %t --delta-passes=operands-to-args --test FileCheck --test-arg %s --test-arg --match-full-lines --test-arg --check-prefix=INTERESTING --test-arg --input-file
; RUN: FileCheck %s --input-file %t --check-prefixes=REDUCED,INTERESTING

; REDUCED-LABEL: define void @func(i32 %k, ptr %Local, ptr %Global) {

; Keep one reference to the original value.
; INTERESTING: %[[LOCAL:Local[0-9]*]] = alloca i32, align 4
; INTERESTING: store i32 42, ptr %[[LOCAL]], align 4
; INTERESTING: store i32 42, ptr @Global, align 4

; Everything else must use the function argument.
; REDUCED: store i32 21, ptr %Local, align 4
; REDUCED: store i32 21, ptr %Global, align 4
; REDUCED: store i32 0, ptr %Local, align 4
; REDUCED: store i32 0, ptr %Global, align 4
; REDUCED: store float 0.000000e+00, ptr %Global, align 4

; Do not add any arguments for %Keep and @GlobalKeep.
; INTERESTING: %[[KEEP:LocalKeep[0-9]*]] = add i32 %k, 21
; INTERESTING: store i32 %[[KEEP]], ptr @GlobalKeep, align 4

; INTERESTING-LABEL: define void @func_caller() {
; REDUCED:             call void @func(i32 21, ptr null, ptr null)


@Global = global i32 42
@GlobalKeep = global i32 42

define void @func(i32 %k) {
entry:
  %Local = alloca i32, align 4

  store i32 42, ptr %Local, align 4
  store i32 42, ptr @Global, align 4

  store i32 21, ptr %Local, align 4
  store i32 21, ptr @Global, align 4

  store i32 0, ptr %Local, align 4
  store i32 0, ptr @Global, align 4

  store float 0.000000e+00, ptr @Global, align 4

  %LocalKeep = add i32 %k, 21
  store i32 %LocalKeep, ptr @GlobalKeep, align 4

  ret void
}


define void @func_caller() {
entry:
  call void @func(i32 21)
  ret void
}


; Make sure to skip functions with non-direct call users
declare void @e(ptr)

; INTERESTING-LABEL: define void @g() {
define void @g() {
  call void @e(ptr @f)
  ret void
}

; INTERESTING-LABEL: define void @f(ptr %a) {
define void @f(ptr %a) {
  %1 = load ptr, ptr %a
  ret void
}